This commit is contained in:
+26
-17
@@ -10,6 +10,7 @@ import { System } from "../common/system";
|
||||
import template from "../common/template";
|
||||
import type { Config, LibDef } from "../core/config";
|
||||
import { Sdk } from "../core/sdk";
|
||||
import { Platform } from "../core/type";
|
||||
import { Neko } from "./neko";
|
||||
|
||||
export class Haxe extends Sdk {
|
||||
@@ -109,7 +110,7 @@ export class Haxe extends Sdk {
|
||||
return path.join(Haxe.buildDir, config.name);
|
||||
}
|
||||
|
||||
openfl(command: string, platform: string, config: Config, debug = false) {
|
||||
openfl(command: string, platform: Platform, config: Config, debug = false) {
|
||||
this.log.i("_openfl_ _build_ *%s*", platform);
|
||||
this.activate();
|
||||
const buildDir = this.resolveBuildDir(config);
|
||||
@@ -125,35 +126,41 @@ export class Haxe extends Sdk {
|
||||
const target = path.resolve(buildDir, platform, "bin");
|
||||
fse.emptyDirSync(target);
|
||||
const result =
|
||||
{
|
||||
android: `app/build/outputs/**/${config.meta.filename}-debug.apk`,
|
||||
flash: "*.swf",
|
||||
}[platform] || "**/*";
|
||||
(
|
||||
{
|
||||
[Platform.ANDROID]: `app/build/outputs/**/${config.meta.filename}-debug.apk`,
|
||||
[Platform.FLASH]: "*.swf",
|
||||
} as Record<Platform, string>
|
||||
)[platform] || "**/*";
|
||||
return this.haxelib(args).then(() => {
|
||||
let r = vfs.src(`${target}/${result}`, { encoding: false });
|
||||
if (platform === "android") {
|
||||
if (platform === Platform.ANDROID) {
|
||||
r = r.pipe(rename(`${config.meta.filename}_${config.meta.version}.apk`));
|
||||
}
|
||||
return r;
|
||||
});
|
||||
}
|
||||
|
||||
build(platform: string, config: Config, debug = false) {
|
||||
build(platform: Platform, config: Config, debug = false) {
|
||||
this.log.i("_build_ *%s*", platform);
|
||||
this.activate();
|
||||
const buildDir = this.resolveBuildDir(config);
|
||||
fse.ensureDirSync(buildDir);
|
||||
|
||||
const ext =
|
||||
{
|
||||
flash: ".swf",
|
||||
neko: ".n",
|
||||
}[platform] || "";
|
||||
(
|
||||
{
|
||||
[Platform.FLASH]: ".swf",
|
||||
[Platform.NEKO]: ".n",
|
||||
} as Record<Platform, string>
|
||||
)[platform] || "";
|
||||
|
||||
const out =
|
||||
{
|
||||
flash: "swf",
|
||||
}[platform] || platform;
|
||||
(
|
||||
{
|
||||
[Platform.FLASH]: "swf",
|
||||
} as Record<Platform, string>
|
||||
)[platform] || platform;
|
||||
|
||||
const project = template.render("project.hxml", {
|
||||
...config,
|
||||
@@ -177,9 +184,11 @@ export class Haxe extends Sdk {
|
||||
fse.copySync(asset, path.join(target, asset.split("/").pop()!));
|
||||
}
|
||||
const result =
|
||||
{
|
||||
cpp: `${config.meta.filename}/${config.main.split(".").pop()}${debug ? "-debug" : ""}`,
|
||||
}[platform] || "**/*";
|
||||
(
|
||||
{
|
||||
[Platform.CPP]: `${config.meta.filename}/${config.main.split(".").pop()}${debug ? "-debug" : ""}`,
|
||||
} as Record<Platform, string>
|
||||
)[platform] || "**/*";
|
||||
return this.haxe(args).then(() => {
|
||||
let r = vfs.src(`${target}/${result}`, { encoding: false });
|
||||
if (platform === "cpp") {
|
||||
|
||||
Reference in New Issue
Block a user