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"); env.addPath(this.path, "LD_LIBRARY_PATH");
} }
prepare() { async replaceHaxelib(version: string): Promise<any> {
return Promise.all([this.neko.prepare(), super.prepare()]).then(() => { const haxe = new Haxe(version);
fs.copyFileSync( await haxe.prepare();
path.resolve(import.meta.dirname, "template/haxe/activate"), fs.copyFileSync(haxe.haxelibBin, this.haxelibBin);
path.resolve(this.path, "activate"),
);
});
} }
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) { 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) { } else if (System.isLinux) {
let arch = System.archInt; 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 { } else {
throw `Unsupported os: ${System.os}`; throw `Unsupported os: ${System.os}`;
} }
} }
get link(): string {
return Haxe.buildLink(this.version);
}
haxe(args: any) { haxe(args: any) {
this.activate(); this.activate();
return exec(".", [this.haxeBin].concat(args).join(" ")); return exec(".", [this.haxeBin].concat(args).join(" "));
@@ -179,7 +189,7 @@ export class Haxe extends Sdk {
args.push("-debug"); args.push("-debug");
} }
const target = path.resolve(buildDir, platform, "bin"); const target = path.resolve(buildDir, platform, "bin");
if (platform !== "cpp") { if (platform !== Platform.CPP) {
fse.emptyDirSync(target); fse.emptyDirSync(target);
} }
for (const asset of config.assets) { for (const asset of config.assets) {
@@ -193,7 +203,7 @@ export class Haxe extends Sdk {
)[platform] || "**/*"; )[platform] || "**/*";
return this.haxe(args).then(() => { return this.haxe(args).then(() => {
let r = vfs.src(`${target}/${result}`, { encoding: false }); let r = vfs.src(`${target}/${result}`, { encoding: false });
if (platform === "cpp") { if (platform === Platform.CPP) {
r = r.pipe(rename(config.meta.filename!)); r = r.pipe(rename(config.meta.filename!));
} }
return r; return r;