[haxe] lib, cp, main params for openfl
This commit is contained in:
@@ -139,6 +139,7 @@ class Haxe extends Sdk {
|
||||
* command: 'build',
|
||||
* platform: 'flash',
|
||||
* version: '1.0.0',
|
||||
* lib: {},
|
||||
* values: {},
|
||||
* macro: [],
|
||||
* outputFile: 'out.swf',
|
||||
@@ -147,6 +148,9 @@ class Haxe extends Sdk {
|
||||
openfl(params) {
|
||||
params = Object.assign({
|
||||
version: null,
|
||||
lib: [],
|
||||
cp: [],
|
||||
main: null,
|
||||
values: {},
|
||||
macro: [],
|
||||
debug: false,
|
||||
@@ -164,6 +168,22 @@ class Haxe extends Sdk {
|
||||
const endStream = (callback) => {
|
||||
log(this.tag, colors.cyan(`openfl ${params.command} ${params.platform}`));
|
||||
const args = ['-cwd', files[0].path, 'run', 'openfl', params.command, params.platform];
|
||||
// lib
|
||||
let lib = params.lib;
|
||||
if (!Array.isArray(lib)) {
|
||||
lib = Object.entries(lib).map(([k, v]) => `${k}:${v.split('@')[0]}`);
|
||||
}
|
||||
for (const item of lib) {
|
||||
args.push(`--haxelib="${item}"`);
|
||||
}
|
||||
// cp
|
||||
for (const item of params.cp) {
|
||||
args.push(`--source="${item}"`);
|
||||
}
|
||||
if (params.main) {
|
||||
args.push(`--app-main="${params.main}"`);
|
||||
}
|
||||
// macro
|
||||
for (const macro of params.macro) {
|
||||
args.push(`--haxeflag="--macro ${macro}"`);
|
||||
}
|
||||
@@ -176,9 +196,9 @@ class Haxe extends Sdk {
|
||||
}
|
||||
}
|
||||
const buildDir = path.join(os.tmpdir(), 'build');
|
||||
args.push(`--app-path=${buildDir}`);
|
||||
args.push(`--app-path="${buildDir}"`);
|
||||
if (params.outputFile) {
|
||||
args.push(`--app-file=${params.outputFile}`);
|
||||
args.push(`--app-file="${params.outputFile}"`);
|
||||
}
|
||||
if (params.version) args.push(`--meta-version=${params.version}`);
|
||||
if (params.debug) {
|
||||
@@ -224,6 +244,7 @@ class Haxe extends Sdk {
|
||||
params = Object.assign({
|
||||
version: null,
|
||||
values: {},
|
||||
lib: [],
|
||||
macro: [],
|
||||
debug: false,
|
||||
}, params);
|
||||
@@ -240,13 +261,21 @@ class Haxe extends Sdk {
|
||||
const endStream = (callback) => {
|
||||
log(this.tag, colors.cyan("haxe", params.platform), '=>', colors.magenta(params.outputFile));
|
||||
const args = [];
|
||||
// main
|
||||
args.push('-main', params.main);
|
||||
for (const lib of params.lib) {
|
||||
args.push('-lib', lib);
|
||||
// lib
|
||||
let lib = params.lib;
|
||||
if (!Array.isArray(lib)) {
|
||||
lib = Object.entries(lib).map(([k, v]) => `${k}:${v.split('@')[0]}`);
|
||||
}
|
||||
for (const item of lib) {
|
||||
args.push('-lib', item);
|
||||
}
|
||||
// cp
|
||||
for (const cp of params.cp) {
|
||||
args.push('-cp', cp);
|
||||
}
|
||||
// macro
|
||||
for (const macro of params.macro) {
|
||||
args.push('--macro', `"${macro}"`);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gulp-haxetool",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"description": "Haxe tool for gulp",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user