fix(haxe): replace old broken haxelib when haxe preparing
test / test (push) Failing after 5m43s

This commit is contained in:
2026-11-01 18:28:46 +03:00
parent b3d1aee9ed
commit d079cbaac5
+22 -12
View File
@@ -78,26 +78,36 @@ export class Haxe extends Sdk {
env.addPath(this.path, "LD_LIBRARY_PATH");
}
prepare() {
return Promise.all([this.neko.prepare(), super.prepare()]).then(() => {
fs.copyFileSync(
path.resolve(import.meta.dirname, "template/haxe/activate"),
path.resolve(this.path, "activate"),
);
});
async replaceHaxelib(version: string): Promise<any> {
const haxe = new Haxe(version);
await haxe.prepare();
fs.copyFileSync(haxe.haxelibBin, this.haxelibBin);
}
get link(): string {
async prepare(): Promise<any> {
await Promise.all([this.neko.prepare(), super.prepare()]);
fs.copyFileSync(path.resolve(import.meta.dirname, "template/haxe/activate"), path.resolve(this.path, "activate"));
// TODO: old haxelib fail with EOF
if (this.intVersion < 430) {
await this.replaceHaxelib(Haxe.VERSION_4_3_7);
}
}
static buildLink(version: string): string {
if (System.isWindows) {
return `https://github.com/HaxeFoundation/haxe/releases/download/${this.version}/haxe-${this.version}-win.zip`;
return `https://github.com/HaxeFoundation/haxe/releases/download/${version}/haxe-${version}-win.zip`;
} else if (System.isLinux) {
let arch = System.archInt;
return `https://github.com/HaxeFoundation/haxe/releases/download/${this.version}/haxe-${this.version}-linux${arch}.tar.gz`;
return `https://github.com/HaxeFoundation/haxe/releases/download/${version}/haxe-${version}-linux${arch}.tar.gz`;
} else {
throw `Unsupported os: ${System.os}`;
}
}
get link(): string {
return Haxe.buildLink(this.version);
}
haxe(args: any) {
this.activate();
return exec(".", [this.haxeBin].concat(args).join(" "));
@@ -179,7 +189,7 @@ export class Haxe extends Sdk {
args.push("-debug");
}
const target = path.resolve(buildDir, platform, "bin");
if (platform !== "cpp") {
if (platform !== Platform.CPP) {
fse.emptyDirSync(target);
}
for (const asset of config.assets) {
@@ -193,7 +203,7 @@ export class Haxe extends Sdk {
)[platform] || "**/*";
return this.haxe(args).then(() => {
let r = vfs.src(`${target}/${result}`, { encoding: false });
if (platform === "cpp") {
if (platform === Platform.CPP) {
r = r.pipe(rename(config.meta.filename!));
}
return r;