[build] remove deprecated gulp-utils
This commit is contained in:
@@ -2,14 +2,14 @@ const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const tmp = require('tmp-file');
|
||||
const gutil = require('gulp-util');
|
||||
const exec = require('./exec');
|
||||
const download = require('./download');
|
||||
const gulp = require('gulp');
|
||||
const through = require('through2');
|
||||
const col = gutil.colors;
|
||||
const Sdk = require('./sdk');
|
||||
const dateformat = require('dateformat');
|
||||
const Vinyl = require('vinyl');
|
||||
const PluginError = require('plugin-error');
|
||||
const colors = require('ansi-colors');
|
||||
const log = require('fancy-log');
|
||||
|
||||
|
||||
class Haxe extends Sdk {
|
||||
@@ -26,15 +26,7 @@ class Haxe extends Sdk {
|
||||
}
|
||||
|
||||
get binPath() {
|
||||
if (os.type() === 'Windows_NT') {
|
||||
if (this.intVersion >= 342) {
|
||||
return `${this.path}`;
|
||||
} else {
|
||||
return `${this.path}/haxe-${this.version}`;
|
||||
}
|
||||
} else if (os.type() === 'Linux') {
|
||||
return `${this.path}/haxe-${this.version}`;
|
||||
}
|
||||
return `${this.path}/haxe-${this.version}`;
|
||||
}
|
||||
|
||||
get haxeBin() {
|
||||
@@ -80,7 +72,7 @@ class Haxe extends Sdk {
|
||||
install(packages) {
|
||||
let promise = this.haxelib(['setup', `${this.path}/lib`]);
|
||||
const next = (args) => () => {
|
||||
gutil.log(this.tag, col.cyan('haxelib', 'install'), col.magenta(args[1]));
|
||||
log(this.tag, colors.cyan('haxelib', 'install'), colors.magenta(args[1]));
|
||||
return this.haxelib(args);
|
||||
};
|
||||
|
||||
@@ -146,7 +138,7 @@ class Haxe extends Sdk {
|
||||
};
|
||||
|
||||
const endStream = (callback) => {
|
||||
gutil.log(this.tag, col.cyan("openfl", params.command, params.platform), '=>', col.magenta(params.outputFile));
|
||||
log(this.tag, colors.cyan("openfl", params.command, params.platform), '=>', colors.magenta(params.outputFile));
|
||||
const args = ['-cwd', files[0].path, 'run', 'openfl', params.command, params.platform];
|
||||
if (params.values) for (let key of Object.keys(params.values)) {
|
||||
const value = params.values[key];
|
||||
@@ -163,28 +155,29 @@ class Haxe extends Sdk {
|
||||
args.push(`--app-file=${name}`);
|
||||
if (params.version) args.push(`--meta-version=${params.version}`);
|
||||
//if (params.build) args.push(`--haxedef=BUILD="${params.build}"`);
|
||||
args.push(`--haxeflag="--macro=CompilationOption.set('build','${params.build}')"`);
|
||||
args.push(`--haxeflag="--macro CompilationOption.set('build','${params.build}')"`);
|
||||
let debug = null;
|
||||
if (params.debug) {
|
||||
debug = {
|
||||
host: 'localhost',
|
||||
port: 6000 + Math.floor(Math.random() * 1000),
|
||||
};
|
||||
args.push(`--haxeflag="--macro=CompilationOption.set('debug.address','${debug.host}')"`);
|
||||
args.push(`--haxeflag="--macro=CompilationOption.set('debug.port','${debug.port}')"`);
|
||||
args.push(`--haxeflag="--macro CompilationOption.set('debug.address','${debug.host}')"`);
|
||||
args.push(`--haxeflag="--macro CompilationOption.set('debug.port','${debug.port}')"`);
|
||||
args.push('-debug');
|
||||
}
|
||||
//console.log('haxelib', args.join(' '));
|
||||
this.haxelib(args).then(() => {
|
||||
const out = new gutil.File({
|
||||
const out = new Vinyl({
|
||||
path: params.outputFile,
|
||||
contents: fs.createReadStream(`${dir}/flash/bin/${name}.swf`)
|
||||
//contents: fs.createReadStream(`${dir}/flash/bin/${name}.swf`),
|
||||
contents: fs.readFileSync(`${dir}/flash/bin/${name}.swf`),
|
||||
});
|
||||
out.debug = debug;
|
||||
stream.push(out);
|
||||
callback();
|
||||
}).catch((error) => {
|
||||
stream.emit('error', new gutil.PluginError({plugin: this.name, message: error}));
|
||||
stream.emit('error', new PluginError({plugin: this.name, message: error}));
|
||||
callback();
|
||||
});
|
||||
};
|
||||
@@ -225,7 +218,7 @@ class Haxe extends Sdk {
|
||||
};
|
||||
|
||||
const endStream = (callback) => {
|
||||
gutil.log(this.tag, col.cyan("haxe", params.platform), '=>', col.magenta(params.outputFile));
|
||||
log(this.tag, colors.cyan("haxe", params.platform), '=>', colors.magenta(params.outputFile));
|
||||
const args = [];
|
||||
args.push('-main', params.main);
|
||||
for (const lib of params.lib) {
|
||||
@@ -262,15 +255,16 @@ class Haxe extends Sdk {
|
||||
}
|
||||
//console.log('haxe', args.join(' '));
|
||||
this.haxe(args).then(() => {
|
||||
const out = new gutil.File({
|
||||
const out = new Vinyl({
|
||||
path: params.outputFile,
|
||||
contents: fs.createReadStream(tmpFile.path)
|
||||
//contents: fs.createReadStream(tmpFile.path),
|
||||
contents: fs.readFileSync(tmpFile.path),
|
||||
});
|
||||
out.debug = debug;
|
||||
stream.push(out);
|
||||
callback();
|
||||
}).catch((error) => {
|
||||
stream.emit('error', new gutil.PluginError({plugin: this.name, message: error}));
|
||||
stream.emit('error', new PluginError({plugin: this.name, message: error}));
|
||||
callback();
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user