Files
tankz/gulpfile.js
2018-05-04 16:45:37 +03:00

107 lines
2.4 KiB
JavaScript
Executable File

"use strict";
const gulp = require('gulp');
const gulpClean = require('gulp-clean');
const Config = require('./config.json');
const packageInfo = require('./package.json');
const {Sdk, Haxe, Project} = require('gulp-haxetool');
const dateformat = require('dateformat');
if (Config.SdkDir) {
Sdk.dir = Config.SdkDir;
}
exports.clean = function clean() {
return gulp.src('target/*', {read: false}).pipe(gulpClean());
};
exports.generate = function generate() {
return new Haxe().haxelib(['run', 'protohx', 'generate', 'protohx.json']);
};
/**
* ToDo:
* windows target
* window exe package (innosetup)
*/
const config = new Project.Config({
meta: {
title: 'Tank\'z',
filename: 'tankz',
icon: 'resources/images/tank/player/tank_p3_0-0.png',
pack: 'ru.m.tankz',
author: 'shmyga <shmyga.z@gmail.com>',
company: 'MegaLoMania',
version: packageInfo.version,
},
libs: packageInfo.haxeDependencies,
sources: [
'src/common/haxe',
'src-gen/haxe',
],
assets: [
'src/client/resources'
],
macros: [
`CompilationOption.set('build','${dateformat(new Date(), 'yyyy-mm-dd HH:MM:ss')}')`
]
});
/**
* client
*/
const client = new Project(
Project.BuildSystem.OPENFL,
[
Project.Platform.FLASH,
Project.Platform.HTML5,
Project.Platform.LINUX,
],
config.branch({
name: 'client',
sources: ['src/client/haxe'],
main: 'ru.m.tankz.Client',
}),
module.exports.generate
).bind(module);
/**
* editor
*/
const editor = new Project(
Project.BuildSystem.OPENFL,
Project.Platform.FLASH,
config.branch({
name: 'editor',
sources: ['src/client/haxe', 'src/editor/haxe'],
main: 'ru.m.tankz.editor.Editor',
meta: {filename: 'editor'}
})
).bind(module);
/**
* server
*/
const server = new Project(
Project.BuildSystem.HAXE,
Project.Platform.NEKO,
config.branch({
name: 'server',
sources: ['src/server/haxe'],
main: 'ru.m.tankz.server.Server',
})
).bind(module);
/**
* default
*/
module.exports.default = gulp.series(
exports.clean,
module.exports['client:flash:build'],
module.exports['client:html5:build'],
module.exports['client:linux:build'],
module.exports['editor:flash:build'],
module.exports['server:neko:build'],
module.exports['client:flash:pack'],
module.exports['client:linux:pack'],
);