commit 499e44f544e4f2ce13a796f5905cabaae97f441f
parent 0b95eab13cbc4f6daebe75b96cec26bdae4cc988
Author: Alex Hochheiden <ahochheiden@mozilla.com>
Date: Mon, 8 Dec 2025 20:35:26 +0000
Bug 1967968 - Add `Terser` toolchain in CI r=firefox-build-system-reviewers,glandium,Standard8
Differential Revision: https://phabricator.services.mozilla.com/D266031
Diffstat:
14 files changed, 184 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -97,6 +97,7 @@ devtools/**/node_modules/
tools/browsertime/node_modules/
tools/lint/eslint/eslint-plugin-mozilla/node_modules/
tools/lint/stylelint/stylelint-plugin-mozilla/node_modules/
+tools/terser/node_modules/
browser/components/asrouter/node_modules/
browser/components/aboutwelcome/node_modules/
browser/extensions/newtab/node_modules/
diff --git a/.hgignore b/.hgignore
@@ -90,6 +90,7 @@
^tools/browsertime/node_modules/
^tools/lint/eslint/eslint-plugin-mozilla/node_modules/
^tools/lint/stylelint/stylelint-plugin-mozilla/node_modules/
+^tools/terser/node_modules/
^browser/components/asrouter/node_modules/
^browser/components/aboutwelcome/node_modules/
^browser/extensions/newtab/node_modules/
diff --git a/build/sparse-profiles/taskgraph b/build/sparse-profiles/taskgraph
@@ -44,6 +44,8 @@ path:browser/components/aboutwelcome/package.json
path:browser/components/aboutwelcome/package-lock.json
path:browser/components/asrouter/package.json
path:browser/components/asrouter/package-lock.json
+path:tools/terser/package.json
+path:tools/terser/package-lock.json
# for new-style try pushes
path:try_task_config.json
diff --git a/taskcluster/kinds/artifact-build/kind.yml b/taskcluster/kinds/artifact-build/kind.yml
@@ -42,6 +42,9 @@ task-defaults:
tooltool-downloads: public
keep-artifacts: false
use-python: default
+ fetches:
+ toolchain:
+ - terser
tasks:
linux64-artifact/opt:
diff --git a/taskcluster/kinds/build-fat-aar/kind.yml b/taskcluster/kinds/build-fat-aar/kind.yml
@@ -111,6 +111,7 @@ task-defaults:
- linux64-node
- sysroot-x86_64-linux-gnu
- sysroot-wasm32-wasi
+ - terser
armeabi-v7a:
- artifact: target.maven.zip
dest: armeabi-v7a
diff --git a/taskcluster/kinds/build/kind.yml b/taskcluster/kinds/build/kind.yml
@@ -37,6 +37,9 @@ task-defaults:
MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE: system
use-python: default
use-uv: true
+ fetches:
+ toolchain:
+ - terser
run:
mozconfig-variant:
by-release-type:
diff --git a/taskcluster/kinds/instrumented-build/kind.yml b/taskcluster/kinds/instrumented-build/kind.yml
@@ -42,6 +42,7 @@ task-defaults:
fetches:
toolchain:
- linux64-sccache
+ - terser
tasks:
linux64-shippable/opt:
diff --git a/taskcluster/kinds/source-test/mozlint.yml b/taskcluster/kinds/source-test/mozlint.yml
@@ -327,6 +327,7 @@ node-licenses:
ln -s ../tools/lint/eslint/eslint-plugin-spidermonkey-js node_modules &&
cp -r $MOZ_FETCHES_DIR/eslint-plugin-mozilla/node_modules tools/lint/eslint/eslint-plugin-mozilla/node_modules &&
cp -r $MOZ_FETCHES_DIR/stylelint-plugin-mozilla/node_modules tools/lint/stylelint/stylelint-plugin-mozilla/node_modules &&
+ cp -r $MOZ_FETCHES_DIR/terser/node_modules tools/terser/node_modules &&
./mach lint -v -l node-licenses -f treeherder -f json:/builds/worker/mozlint.json .
when:
files-changed:
@@ -338,12 +339,14 @@ node-licenses:
- package.json
- tools/lint/eslint/eslint-plugin-mozilla/package.json
- tools/lint/stylelint/stylelint-plugin-mozilla/package.json
+ - tools/terser/package.json
fetches:
toolchain:
- linux64-node
- node-modules
- eslint-plugin-mozilla
- stylelint-plugin-mozilla
+ - terser
node-package-names:
description: Lint for node package name issues
diff --git a/taskcluster/kinds/source-test/python.yml b/taskcluster/kinds/source-test/python.yml
@@ -393,11 +393,14 @@ mozbuild:
by-platform:
linux2404-64/opt:
- linux64-node
+ - terser
macosx1470-64/opt:
- macosx64-node
+ - terser
windows11-64/opt:
- win64-node
- win64-mozmake
+ - terser
when:
files-changed:
- '**/moz.configure'
diff --git a/taskcluster/kinds/toolchain/misc.yml b/taskcluster/kinds/toolchain/misc.yml
@@ -473,6 +473,21 @@ stylelint-plugin-mozilla:
toolchain:
- linux64-node
+terser:
+ description: "npm install terser node_modules"
+ treeherder:
+ symbol: TL(terser)
+ run:
+ script: terser.sh
+ sparse-profile: null
+ resources:
+ - 'tools/terser/package.json'
+ - 'tools/terser/package-lock.json'
+ toolchain-artifact: public/build/terser.tar.zst
+ fetches:
+ toolchain:
+ - linux64-node
+
newtab-node-modules:
description: "npm install newtab node_modules"
treeherder:
diff --git a/taskcluster/scripts/misc/terser.sh b/taskcluster/scripts/misc/terser.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -vex
+
+set -x -e
+
+echo "running as" $(id)
+
+set -v
+
+cd $GECKO_PATH
+
+export PATH=$PATH:$MOZ_FETCHES_DIR/node/bin
+
+./mach configure --disable-compile-environment
+./mach npm ci --prefix tools/terser
+
+# We have tools/terser/{node_modules,...} and want
+# terser/{node_modules}.
+cd tools/
+tar caf /tmp/terser.tar.zst terser
+mkdir -p /builds/worker/artifacts
+mv /tmp/terser.tar.zst /builds/worker/artifacts/
+\ No newline at end of file
diff --git a/tools/lint/node-licenses.yml b/tools/lint/node-licenses.yml
@@ -7,6 +7,7 @@ node-licenses:
- package.json
- tools/lint/eslint/eslint-plugin-mozilla/package.json
- tools/lint/stylelint/stylelint-plugin-mozilla/package.json
+ - tools/terser/package.json
exclude: []
extensions:
- json
diff --git a/tools/terser/package-lock.json b/tools/terser/package-lock.json
@@ -0,0 +1,120 @@
+{
+ "name": "terser",
+ "version": "1.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "version": "1.0.0",
+ "dependencies": {
+ "terser": "5.44.0"
+ }
+ },
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/source-map": {
+ "version": "0.3.11",
+ "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz",
+ "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==",
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.25"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.30",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.30.tgz",
+ "integrity": "sha512-GQ7Nw5G2lTu/BtHTKfXhKHok2WGetd4XYcVKGx00SjAk8GMwgJM3zr6zORiPGuOE+/vkc90KtTosSSvaCjKb2Q==",
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/acorn": {
+ "version": "8.15.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
+ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/buffer-from": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
+ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
+ "license": "MIT"
+ },
+ "node_modules/commander": {
+ "version": "2.20.3",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+ "license": "MIT"
+ },
+ "node_modules/source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/source-map-support": {
+ "version": "0.5.21",
+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
+ "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
+ "license": "MIT",
+ "dependencies": {
+ "buffer-from": "^1.0.0",
+ "source-map": "^0.6.0"
+ }
+ },
+ "node_modules/terser": {
+ "version": "5.44.0",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.44.0.tgz",
+ "integrity": "sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w==",
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "@jridgewell/source-map": "^0.3.3",
+ "acorn": "^8.15.0",
+ "commander": "^2.20.0",
+ "source-map-support": "~0.5.20"
+ },
+ "bin": {
+ "terser": "bin/terser"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ }
+ }
+}
diff --git a/tools/terser/package.json b/tools/terser/package.json
@@ -0,0 +1,8 @@
+{
+ "version": "1.0.0",
+ "description": "Terser JavaScript minifier for Mozilla builds",
+ "private": true,
+ "dependencies": {
+ "terser": "5.44.0"
+ }
+}