diff --git a/package.json b/package.json index 687f7d69..e10f9fb9 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.1.0", "type": "module", "scripts": { + "prebuild": "node scripts/setupTaskcluster.js", "build": "rollup -c && npm run build-addon && web-ext --config=web-ext-config.cjs build --overwrite-dest && mv web-ext-artifacts/*.zip web-ext-artifacts/rally_core.xpi", "build-addon": "npm run glean && rollup -c rollup.config.addon.js --config-enable-data-submission", "build-local-addon": "npm run glean && rollup -c rollup.config.addon.js --config-disable-remote-settings --config-studies-list-url=/public/locally-available-studies.json", diff --git a/scripts/setupTaskcluster.js b/scripts/setupTaskcluster.js new file mode 100644 index 00000000..c6ef5243 --- /dev/null +++ b/scripts/setupTaskcluster.js @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import * as exec from "child_process"; +import { promisify } from "util"; + +// Define an async/await version of "exec". +const execAsync = promisify(exec.exec); + +if (!('TASK_ID' in process.env)) { + // If this is not running on TaskCluster, exit + // without an error code. + process.exit(0); +} + +console.log("Running in TaskCluster. Running set-up."); + +// The TaskCluster instance on the Mozilla add-ons pipeline +// does not allow image customization, so python3 venv cannot +// be installed. That package is required for Glean to build. +// We make sure to have all the dependencies in place when on +// TaskCluster by running the commands manually. +execAsync("apt-get -y install python3-venv");