89 lines
2.0 KiB
JavaScript
Executable File
89 lines
2.0 KiB
JavaScript
Executable File
"use strict";
|
|
const gulp = require('gulp');
|
|
const clean = require('gulp-clean');
|
|
const Config = require('./config.json');
|
|
const Project = require('./build/project');
|
|
const version = require('./build/version');
|
|
const packageInfo = require('./package.json');
|
|
const {Sdk, Haxe} = 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({
|
|
version: version,
|
|
lib: packageInfo.haxeDependencies,
|
|
cp: [
|
|
'src/common/haxe',
|
|
'src-gen/haxe',
|
|
],
|
|
macro: [
|
|
`CompilationOption.set('build','${dateformat(new Date(), 'yyyy-mm-dd HH:MM:ss')}')`
|
|
]
|
|
});
|
|
|
|
/**
|
|
* client
|
|
*/
|
|
const client = new Project(config.update({
|
|
name: 'client',
|
|
cp: ['src/client/haxe'],
|
|
main: 'ru.m.tankz.Client',
|
|
}), [
|
|
Project.Platform.FLASH,
|
|
Project.Platform.HTML5,
|
|
Project.Platform.LINUX,
|
|
]).bind(module);
|
|
|
|
/**
|
|
* editor
|
|
*/
|
|
const editor = new Project(config.update({
|
|
name: 'editor',
|
|
cp: ['src/client/haxe', 'src/editor/haxe'],
|
|
main: 'ru.m.tankz.editor.Editor',
|
|
}), [
|
|
Project.Platform.FLASH,
|
|
]).bind(module);
|
|
|
|
/**
|
|
* server
|
|
*/
|
|
const server = new Project(config.update({
|
|
name: 'server',
|
|
cp: ['src/server/haxe'],
|
|
main: 'ru.m.tankz.server.Server',
|
|
}), [
|
|
Project.Platform.NEKO,
|
|
]).bind(module);
|