diff --git a/build/tasks.ts b/build/tasks.ts index 4c10b1fb4520..23321a08f11f 100644 --- a/build/tasks.ts +++ b/build/tasks.ts @@ -6,13 +6,19 @@ import * as path from "path"; import * as zlib from "zlib"; const isWin = os.platform() === "win32"; +const arg = process.argv.slice(3); +const availableArches = ["ia32", "x64", "arm", "arm64"]; +const linuxArch = arg.length === 0 ? "x64" : arg; const libPath = path.join(__dirname, "../lib"); const vscodePath = path.join(libPath, "vscode"); const pkgsPath = path.join(__dirname, "../packages"); -const defaultExtensionsPath = path.join(libPath, "VSCode-linux-x64/resources/app/extensions"); +const defaultExtensionsPath = path.join(libPath, `VSCode-linux-${linuxArch}/resources/app/extensions`); const vscodeVersion = "1.32.0"; const buildServerBinary = register("build:server:binary", async (runner) => { + if (!(availableArches.some(x => x === linuxArch))) { + throw new Error(`${linuxArch} is not available. Available Arches are ${availableArches}`); + } await ensureInstalled(); await copyForDefaultExtensions(); await Promise.all([ @@ -64,7 +70,19 @@ const dependencyNexeBinary = register("dependency:nexe", async (runner) => { if (!fs.existsSync(upxBinary)) { fse.mkdirpSync(upxFolder); runner.cwd = upxFolder; - const upxExtract = await runner.execute("bash", ["-c", "curl -L https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz | tar xJ --strip-components=1"]); + var upxArch = ""; + if ("ia32" === linuxArch) { + upxArch = "i386"; + } if ("x64" === linuxArch) { + upxArch = "amd64"; + } if ("arm" === linuxArch) { + upxArch = "armeb"; + } if ("arm64" === linuxArch) { + upxArch = "arm64"; + } else { + throw new Error(`Unsupported Arch ${linuxArch}`) + } + const upxExtract = await runner.execute("bash", ["-c", `curl -L https://github.com/upx/upx/releases/download/v3.95/upx-3.95-${upxArch}_linux.tar.xz | tar xJ --strip-components=1`]); if (upxExtract.exitCode !== 0) { throw new Error(`Failed to extract upx: ${upxExtract.stderr}`); } @@ -197,7 +215,7 @@ const buildDefaultExtensions = register("build:default-extensions", async (runne if (!fs.existsSync(defaultExtensionsPath)) { await copyForDefaultExtensions(); runner.cwd = extDirPath; - const resp = await runner.execute(isWin ? "npx.cmd" : "npx", [isWin ? "gulp.cmd" : "gulp", "vscode-linux-x64", "--max-old-space-size=32384"]); + const resp = await runner.execute(isWin ? "npx.cmd" : "npx", [isWin ? "gulp.cmd" : "gulp", `vscode-linux-${linuxArch}`, "--max-old-space-size=32384"]); if (resp.exitCode !== 0) { throw new Error(`Failed to build default extensions: ${resp.stderr}`); }