100 lines
2.3 KiB
JavaScript
Executable File
100 lines
2.3 KiB
JavaScript
Executable File
"use strict";
|
|
const gulp = require('gulp');
|
|
const clean = 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 = () => {
|
|
return gulp.src('target/*', {read: false}).pipe(clean());
|
|
};
|
|
|
|
exports.generate = () => {
|
|
return new Haxe().haxelib([
|
|
'run', 'protohx', 'generate', 'protohx.json'
|
|
]);
|
|
};
|
|
|
|
exports.install = () => {
|
|
return new Haxe().install(packageInfo.haxeDependencies);
|
|
};
|
|
|
|
/**
|
|
* ToDo:
|
|
* install before build?
|
|
* generate before build?
|
|
* [haxe] generate project.xml | project.hxp (http://www.openfl.org/lime/docs/project-files/hxp-format/)
|
|
* [haxe] another /tmp/build directories for another builds
|
|
* debug without sockets?
|
|
* linux deb package
|
|
* windows target
|
|
* window exe package (innosetup)
|
|
* flash html wrapper
|
|
*/
|
|
|
|
const config = new Project.Config({
|
|
meta: {
|
|
title: 'Tank\'z',
|
|
pack: 'ru.m.tankz',
|
|
company: 'MegaLoMania',
|
|
version: packageInfo.version,
|
|
},
|
|
libs: packageInfo.haxeDependencies,
|
|
sources: [
|
|
'src/common/haxe',
|
|
'src-gen/haxe',
|
|
],
|
|
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'],
|
|
assets: ['src/client/resources'],
|
|
main: 'ru.m.tankz.Client',
|
|
})
|
|
).bind(module, gulp);
|
|
|
|
/**
|
|
* editor
|
|
*/
|
|
const editor = new Project(
|
|
Project.BuildSystem.OPENFL, [
|
|
Project.Platform.FLASH
|
|
], config.branch({
|
|
name: 'editor',
|
|
sources: ['src/client/haxe', 'src/editor/haxe'],
|
|
assets: ['src/client/resources'],
|
|
main: 'ru.m.tankz.editor.Editor',
|
|
})
|
|
).bind(module, gulp);
|
|
|
|
/**
|
|
* 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, gulp);
|