[build] added environ setup in haxe tasks
This commit is contained in:
@@ -51,6 +51,36 @@ class Haxe extends Sdk {
|
||||
}
|
||||
}
|
||||
|
||||
static get pamFile() {
|
||||
return `${os.homedir()}/.pam_environment`;
|
||||
}
|
||||
|
||||
checkEnviron() {
|
||||
if (fs.existsSync(Haxe.pamFile)) {
|
||||
const data = fs.readFileSync(Haxe.pamFile, 'utf8');
|
||||
// ToDo: parse file
|
||||
if (data.indexOf('HAXE_VERSION')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
setupEnviron() {
|
||||
if (this.checkEnviron()) return;
|
||||
// ToDo: parse file
|
||||
const haxeVersion = `HAXE_VERSION=${this.version}`;
|
||||
const haxeStdPath = `HAXE_STD_PATH=${this.binPath}/std`;
|
||||
const haxeHome = `HAXE_HOME=${this.binPath}`;
|
||||
const pathDefault = `PATH DEFAULT="\${PATH}:${this.binPath}"`;
|
||||
const data = [haxeVersion, haxeStdPath, haxeHome, pathDefault, ''];
|
||||
fs.appendFileSync(Haxe.pamFile, data.join('\n'));
|
||||
}
|
||||
|
||||
prepare() {
|
||||
return super.prepare().then(() => this.setupEnviron());
|
||||
}
|
||||
|
||||
get link() {
|
||||
if (Sdk.System.isWindows) {
|
||||
return `https://github.com/HaxeFoundation/haxe/releases/download/${this.version}/haxe-${this.version}-win.zip`;
|
||||
|
||||
Reference in New Issue
Block a user