build: use ruffle

This commit is contained in:
2026-07-13 22:20:27 +03:00
parent a3be62eec7
commit c34308ed7c
3 changed files with 7484 additions and 7502 deletions

View File

@@ -1,11 +1,13 @@
const gulp = require('gulp'); const gulp = require("gulp");
const gulpClean = require('gulp-clean'); const gulpClean = require("gulp-clean");
const Config = require('./config.json'); const Config = require("./config.json");
const packageInfo = require('./package.json'); const packageInfo = require("./package.json");
const {System, Sdk, Haxe, Project} = require('gulp-haxetool'); const { System, Sdk, Haxe, Project } = require("gulp-haxetool");
const dateformat = require('dateformat'); const dateformat = require("dateformat");
const argv = require('yargs').argv; const argv = require("yargs").argv;
const publish = require('./tasks/gulp-publish'); const publish = require("./tasks/gulp-publish");
Project.useRuffle();
if (packageInfo.haxe) { if (packageInfo.haxe) {
Haxe.VERSION = packageInfo.haxe; Haxe.VERSION = packageInfo.haxe;
@@ -20,7 +22,7 @@ if (Config.BuildDir) {
} }
exports.clean = function clean() { exports.clean = function clean() {
return gulp.src('target/*', {read: false}).pipe(gulpClean()); return gulp.src("target/*", { read: false }).pipe(gulpClean());
}; };
exports.setup = function setup() { exports.setup = function setup() {
@@ -49,32 +51,25 @@ exports.generate = function generate() {
*/ */
const config = new Project.Config({ const config = new Project.Config({
meta: { meta: {
title: 'Tank\'z', title: "Tank'z",
filename: 'tankz', filename: "tankz",
icon: 'src/client/resources/icon.png', icon: "src/client/resources/icon.png",
pack: 'ru.m.tankz', pack: "ru.m.tankz",
author: 'shmyga <shmyga.z@gmail.com>', author: "shmyga <shmyga.z@gmail.com>",
company: 'MegaLoMania', company: "MegaLoMania",
version: packageInfo.version + (Config.Develop ? '-SNAPSHOT' : ''), version: packageInfo.version + (Config.Develop ? "-SNAPSHOT" : ""),
}, },
key: Config.Key, key: Config.Key,
libs: packageInfo.haxeDependencies, libs: packageInfo.haxeDependencies,
sources: [ sources: ["src/common/haxe", "src-gen/haxe"],
'src/common/haxe', assets: ["src/common/resources/config"],
'src-gen/haxe', flags: ["proto_debug"],
],
assets: [
'src/common/resources/config',
],
flags: [
'proto_debug',
],
macros: [ macros: [
`CompilationOption.set('build','${dateformat(new Date(), 'yyyy-mm-dd HH:MM:ss')}')`, `CompilationOption.set('build','${dateformat(new Date(), "yyyy-mm-dd HH:MM:ss")}')`,
] ],
}); });
const host = argv.host || 'localhost'; const host = argv.host || "localhost";
const port = argv.port || 5000; const port = argv.port || 5000;
/** /**
@@ -90,16 +85,11 @@ const client = new Project(
Project.Platform.ANDROID, Project.Platform.ANDROID,
], ],
config.branch({ config.branch({
name: 'client', name: "client",
sources: [ sources: ["src/client/haxe"],
'src/client/haxe', main: "ru.m.tankz.Client",
], preloader: "ru.m.tankz.Preloader",
main: 'ru.m.tankz.Client', assets: ["src/common/resources/level", "src/client/resources"],
preloader: 'ru.m.tankz.Preloader',
assets: [
'src/common/resources/level',
'src/client/resources',
],
meta: { meta: {
width: 1024, width: 1024,
height: 576, height: 576,
@@ -113,7 +103,7 @@ const client = new Project(
macros: [ macros: [
`CompilationOption.set('host','${host}')`, `CompilationOption.set('host','${host}')`,
`CompilationOption.set('port',${port})`, `CompilationOption.set('port',${port})`,
] ],
}), }),
).bind(module, gulp); ).bind(module, gulp);
@@ -122,33 +112,23 @@ const client = new Project(
*/ */
const editor = new Project( const editor = new Project(
Project.BuildSystem.OPENFL, Project.BuildSystem.OPENFL,
[ [Project.Platform.FLASH, Project.Platform.HTML5, Project.Platform.LINUX],
Project.Platform.FLASH,
Project.Platform.HTML5,
Project.Platform.LINUX,
],
config.branch({ config.branch({
name: 'editor', name: "editor",
sources: [ sources: ["src/client/haxe", "src/editor/haxe"],
'src/client/haxe', main: "ru.m.tankz.editor.Editor",
'src/editor/haxe', preloader: "ru.m.tankz.Preloader",
], assets: ["src/client/resources", "src/editor/resources"],
main: 'ru.m.tankz.editor.Editor',
preloader: 'ru.m.tankz.Preloader',
assets: [
'src/client/resources',
'src/editor/resources',
],
meta: { meta: {
filename: 'editor', filename: "editor",
pack: 'ru.m.tankz.editor', pack: "ru.m.tankz.editor",
width: 1024, width: 1024,
height: 768, height: 768,
}, },
flags: [ flags: [
//'dev_layout', //'dev_layout',
] ],
}) }),
).bind(module, gulp); ).bind(module, gulp);
/** /**
@@ -158,19 +138,22 @@ const server = new Project(
Project.BuildSystem.HAXE, Project.BuildSystem.HAXE,
Project.Platform.CPP, Project.Platform.CPP,
config.branch({ config.branch({
name: 'server', name: "server",
sources: ['src/server/haxe'], sources: ["src/server/haxe"],
main: 'ru.m.tankz.server.Server', main: "ru.m.tankz.server.Server",
assets: [ assets: ["src/common/resources/level"],
'src/common/resources/level',
]
}), }),
).bind(module, gulp); ).bind(module, gulp);
/** /**
* publish * publish
*/ */
module.exports.publish = publish(packageInfo.name, packageInfo.version, Config.PublishDir, Config.PublishUrl); module.exports.publish = publish(
packageInfo.name,
packageInfo.version,
Config.PublishDir,
Config.PublishUrl,
);
/** /**
* default * default
@@ -178,37 +161,35 @@ module.exports.publish = publish(packageInfo.name, packageInfo.version, Config.P
const defaultSeries = [ const defaultSeries = [
exports.clean, exports.clean,
exports.generate, exports.generate,
module.exports['client:flash:build'], module.exports["client:flash:build"],
module.exports['client:flash:html'], module.exports["client:flash:html"],
module.exports['client:html5:build'], module.exports["client:html5:build"],
module.exports['editor:flash:build'], module.exports["editor:flash:build"],
module.exports['editor:flash:html'], module.exports["editor:flash:html"],
module.exports['editor:html5:build'], module.exports["editor:html5:build"],
module.exports['server:cpp:build'], module.exports["server:cpp:build"],
]; ];
if (System.isLinux) { if (System.isLinux) {
defaultSeries.push( defaultSeries.push(
module.exports['client:linux:build'], module.exports["client:linux:build"],
module.exports['client:linux:archive'], module.exports["client:linux:archive"],
module.exports['client:linux:deb'], module.exports["client:linux:deb"],
module.exports['client:android:build'], module.exports["client:android:build"],
); );
} }
if (System.isWindows) { if (System.isWindows) {
defaultSeries.push( defaultSeries.push(
module.exports['client:windows:build'], module.exports["client:windows:build"],
module.exports['client:windows:archive'], module.exports["client:windows:archive"],
module.exports['client:windows:installer'], module.exports["client:windows:installer"],
); );
} }
defaultSeries.push( defaultSeries.push(exports.publish);
exports.publish,
);
module.exports.default = gulp.series(defaultSeries); module.exports.default = gulp.series(defaultSeries);

13
package-lock.json generated
View File

@@ -1,18 +1,18 @@
{ {
"name": "tankz", "name": "tankz",
"version": "0.17.6", "version": "0.18.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "tankz", "name": "tankz",
"version": "0.17.6", "version": "0.18.0",
"devDependencies": { "devDependencies": {
"dateformat": "^3.0.3", "dateformat": "^3.0.3",
"gulp": "^4.0.0", "gulp": "^4.0.0",
"gulp-add": "0.0.2", "gulp-add": "0.0.2",
"gulp-clean": "^0.4.0", "gulp-clean": "^0.4.0",
"gulp-haxetool": "^0.1.9", "gulp-haxetool": "^0.2.1",
"yargs": "^13.2.4" "yargs": "^13.2.4"
} }
}, },
@@ -3296,10 +3296,11 @@
} }
}, },
"node_modules/gulp-haxetool": { "node_modules/gulp-haxetool": {
"version": "0.1.9", "version": "0.2.1",
"resolved": "https://registry.npmjs.org/gulp-haxetool/-/gulp-haxetool-0.1.9.tgz", "resolved": "https://registry.npmjs.org/gulp-haxetool/-/gulp-haxetool-0.2.1.tgz",
"integrity": "sha512-ABS3nWVrGMA0iLnIoOHl06zp6OOB9BCE5Nda0cpuaKVX2LGMPnJMhxPJNDQXvMhYTDnX90z2EpyIFDH6Pyv37A==", "integrity": "sha512-+p38E66G67AxYY1V8ZHRGlNG08EnfdEJezteKhocjBFjnGIguJrwFc0paGvL/zlyWJV1vSyfiLWN8J5HYZLjYg==",
"dev": true, "dev": true,
"license": "ISC",
"dependencies": { "dependencies": {
"ansi-colors": "^1.1.0", "ansi-colors": "^1.1.0",
"async": "^2.6.0", "async": "^2.6.0",

View File

@@ -7,7 +7,7 @@
"gulp": "^4.0.0", "gulp": "^4.0.0",
"gulp-add": "0.0.2", "gulp-add": "0.0.2",
"gulp-clean": "^0.4.0", "gulp-clean": "^0.4.0",
"gulp-haxetool": "^0.1.9", "gulp-haxetool": "^0.2.1",
"yargs": "^13.2.4" "yargs": "^13.2.4"
}, },
"haxeDependencies": { "haxeDependencies": {