Use targets in hak environment for cross-compiling

This arranges the hak environment target info around target IDs that come from
the builder, which simplifies cross-compiling. The `target.js` module is a
generated copy of the builder's `target.ts`.
This commit is contained in:
J. Ryan Stinnett
2021-06-23 16:18:09 +01:00
parent a171fa417b
commit 997f2c21bf
3 changed files with 53 additions and 29 deletions
+14 -2
View File
@@ -1,5 +1,5 @@
/*
Copyright 2020 The Matrix.org Foundation C.I.C.
Copyright 2020-2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -53,7 +53,19 @@ async function main() {
process.exit(1);
}
const hakEnv = new HakEnv(prefix, packageJson);
// Apply `--target <target>` option if specified
const targetIndex = process.argv.indexOf('--target');
let targetId;
if (targetIndex >= 0) {
if ((targetIndex + 1) >= process.argv.length) {
console.error("--target option specified without a target");
process.exit(1);
}
// Extract target ID and remove from args
targetId = process.argv.splice(targetIndex, 2)[1];
}
const hakEnv = new HakEnv(prefix, packageJson, targetId);
const deps = {};