[build] linux platform
This commit is contained in:
@@ -10,6 +10,8 @@ const version = require('./version');
|
|||||||
const prepare = require('./prepare');
|
const prepare = require('./prepare');
|
||||||
const debug = require('../tasks/debug');
|
const debug = require('../tasks/debug');
|
||||||
const webserver = require('gulp-webserver');
|
const webserver = require('gulp-webserver');
|
||||||
|
const run = require('gulp-run');
|
||||||
|
const tail = require('../tasks/tail');
|
||||||
|
|
||||||
|
|
||||||
const generate = () => function generate() {
|
const generate = () => function generate() {
|
||||||
@@ -57,6 +59,7 @@ const webapp = function () {
|
|||||||
exports['client:flash:html'] = gulp.parallel(flashIndex, flashJs);
|
exports['client:flash:html'] = gulp.parallel(flashIndex, flashJs);
|
||||||
exports['client:flash'] = gulp.series(prepare(Haxe.ID), generate(), build('flash'), exports['client:flash:html']);
|
exports['client:flash'] = gulp.series(prepare(Haxe.ID), generate(), build('flash'), exports['client:flash:html']);
|
||||||
exports['client:html5'] = gulp.series(prepare(Haxe.ID), generate(), build('html5'));
|
exports['client:html5'] = gulp.series(prepare(Haxe.ID), generate(), build('html5'));
|
||||||
|
exports['client:linux'] = gulp.series(prepare(Haxe.ID), generate(), build('linux'));
|
||||||
exports['client:webapp'] = webapp;
|
exports['client:webapp'] = webapp;
|
||||||
exports['client'] = gulp.series(prepare(Haxe.ID), generate(), gulp.parallel(build('flash'), build('html5')), exports['client:flash:html'], webapp);
|
exports['client'] = gulp.series(prepare(Haxe.ID), generate(), gulp.parallel(build('flash'), build('html5')), exports['client:flash:html'], webapp);
|
||||||
|
|
||||||
@@ -70,15 +73,32 @@ const testFlash = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const testHtml5 = function() {
|
const testHtml5 = function() {
|
||||||
return gulp.series(build('html5'), () => gulp.src('target/html5').pipe(webserver({
|
return gulp.series(
|
||||||
host: 'localhost', port: 3000,
|
build('html5'),
|
||||||
open: true,
|
() => gulp.src('target/html5').pipe(webserver({
|
||||||
fallback: 'index.html'
|
host: 'localhost', port: 3000,
|
||||||
})))();
|
open: true,
|
||||||
|
fallback: 'index.html'
|
||||||
|
}))
|
||||||
|
)();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const testLinux = function() {
|
||||||
|
const argv = yargs.argv;
|
||||||
|
return gulp.series(
|
||||||
|
build('linux'),
|
||||||
|
() => gulp.src('target/linux/tankz')
|
||||||
|
.pipe(run('./tankz', {cwd: 'target/linux', verbosity: 1}))
|
||||||
|
.pipe(tail(debug.log))
|
||||||
|
.pipe(gulp.dest('target/log'))
|
||||||
|
)();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
exports['client:flash:test'] = gulp.series(prepare(Haxe.ID, FlashPlayer.ID), testFlash);
|
exports['client:flash:test'] = gulp.series(prepare(Haxe.ID, FlashPlayer.ID), testFlash);
|
||||||
exports['client:html5:test'] = gulp.series(prepare(Haxe.ID), testHtml5);
|
exports['client:html5:test'] = gulp.series(prepare(Haxe.ID), testHtml5);
|
||||||
|
exports['client:linux:test'] = gulp.series(prepare(Haxe.ID), testLinux);
|
||||||
exports['client:test'] = exports['client:flash:test'];
|
exports['client:test'] = exports['client:flash:test'];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
"gulp-babel": "^7.0.0",
|
"gulp-babel": "^7.0.0",
|
||||||
"gulp-clean": "^0.3.2",
|
"gulp-clean": "^0.3.2",
|
||||||
"gulp-concat": "^2.6.1",
|
"gulp-concat": "^2.6.1",
|
||||||
|
"gulp-run": "^1.7.1",
|
||||||
"gulp-template": "^5.0.0",
|
"gulp-template": "^5.0.0",
|
||||||
"gulp-uglify": "^3.0.0",
|
"gulp-uglify": "^3.0.0",
|
||||||
"gulp-webserver": "^0.9.1",
|
"gulp-webserver": "^0.9.1",
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ class GameFrame extends VGroupView implements ViewBuilder implements IPacketHand
|
|||||||
game.engine.listeners.push(render);
|
game.engine.listeners.push(render);
|
||||||
game.start(state);
|
game.start(state);
|
||||||
content.addEventListener(Event.ENTER_FRAME, redraw);
|
content.addEventListener(Event.ENTER_FRAME, redraw);
|
||||||
Provider.get(IConnection).packetHandler.addListener(this);
|
//Provider.get(IConnection).packetHandler.addListener(this);
|
||||||
render.draw(game.engine);
|
render.draw(game.engine);
|
||||||
timer = new Timer(10);
|
timer = new Timer(10);
|
||||||
timer.run = updateEngine;
|
timer.run = updateEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onHide():Void {
|
public function onHide():Void {
|
||||||
Provider.get(IConnection).packetHandler.removeListener(this);
|
//Provider.get(IConnection).packetHandler.removeListener(this);
|
||||||
if (timer != null) {
|
if (timer != null) {
|
||||||
timer.stop();
|
timer.stop();
|
||||||
timer = null;
|
timer = null;
|
||||||
|
|||||||
@@ -44,4 +44,4 @@ module.exports = () => {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.log = log;
|
module.exports.log = _log;
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ class Haxe extends Sdk {
|
|||||||
if (!Array.isArray(packages)) {
|
if (!Array.isArray(packages)) {
|
||||||
packages = Object.entries(packages).map(([k, v]) => ({name: k, version: v}));
|
packages = Object.entries(packages).map(([k, v]) => ({name: k, version: v}));
|
||||||
}
|
}
|
||||||
console.log('packages', packages);
|
|
||||||
|
|
||||||
for (let pack of packages) {
|
for (let pack of packages) {
|
||||||
const args = [];
|
const args = [];
|
||||||
@@ -88,7 +87,6 @@ class Haxe extends Sdk {
|
|||||||
args.push('install', pack);
|
args.push('install', pack);
|
||||||
} else if (typeof pack === 'object') {
|
} else if (typeof pack === 'object') {
|
||||||
version = pack.version;
|
version = pack.version;
|
||||||
console.log('z', version.substr(0, 3));
|
|
||||||
if (version.substr(0, 3) === 'git') {
|
if (version.substr(0, 3) === 'git') {
|
||||||
pack.git = version;
|
pack.git = version;
|
||||||
version = null;
|
version = null;
|
||||||
@@ -108,7 +106,6 @@ class Haxe extends Sdk {
|
|||||||
} else if (pack.git) {
|
} else if (pack.git) {
|
||||||
path += '/git';
|
path += '/git';
|
||||||
}
|
}
|
||||||
console.log('p', path);
|
|
||||||
if (!fs.existsSync(path)) {
|
if (!fs.existsSync(path)) {
|
||||||
promise = promise.then(next(args));
|
promise = promise.then(next(args));
|
||||||
}
|
}
|
||||||
@@ -186,6 +183,7 @@ class Haxe extends Sdk {
|
|||||||
const result = {
|
const result = {
|
||||||
'flash': `${buildDir}/flash/bin/*.swf`,
|
'flash': `${buildDir}/flash/bin/*.swf`,
|
||||||
'html5': `${buildDir}/html5/bin/**/*`,
|
'html5': `${buildDir}/html5/bin/**/*`,
|
||||||
|
'linux': `${buildDir}/linux/bin/**/*`,
|
||||||
}[params.platform];
|
}[params.platform];
|
||||||
vfs.src(result).pipe(through.obj((file, enc, cb) => {
|
vfs.src(result).pipe(through.obj((file, enc, cb) => {
|
||||||
file.debug = debug;
|
file.debug = debug;
|
||||||
|
|||||||
43
tasks/tail.js
Normal file
43
tasks/tail.js
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
const through = require('through2');
|
||||||
|
const colors = require('ansi-colors');
|
||||||
|
const log = require('fancy-log');
|
||||||
|
|
||||||
|
const TAG = colors.green('[tail]');
|
||||||
|
|
||||||
|
|
||||||
|
const { Writable } = require('stream');
|
||||||
|
const { StringDecoder } = require('string_decoder');
|
||||||
|
|
||||||
|
|
||||||
|
class StringWritable extends Writable {
|
||||||
|
constructor(handler, options) {
|
||||||
|
super(options);
|
||||||
|
this.handler = handler;
|
||||||
|
const state = this._writableState;
|
||||||
|
this._decoder = new StringDecoder(state.defaultEncoding);
|
||||||
|
this.data = '';
|
||||||
|
}
|
||||||
|
_write(chunk, encoding, callback) {
|
||||||
|
if (encoding === 'buffer') {
|
||||||
|
chunk = this._decoder.write(chunk);
|
||||||
|
for (const line of chunk.split('\n')) if (line.length) {
|
||||||
|
this.handler(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.data += chunk;
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
_final(callback) {
|
||||||
|
this.data += this._decoder.end();
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = (handler) => {
|
||||||
|
return through.obj(function (file, enc, callback) {
|
||||||
|
file.contents.pipe(new StringWritable(handler));
|
||||||
|
this.push(file);
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user