commit 419c3b52b673aa20926552898b35ab9f5f8eff1d parent 6bd510a0049a9016eb75ee9b4bfe9ce94b0ecdc4 Author: Mark Hammond <mhammond@skippinet.com.au> Date: Thu, 27 Nov 2025 18:48:38 +0000 Bug 1987757 - Part 1: Add `embedded-uniffi-bindgen` and `nimbus-fml` stub toolchaina. r=taskgraph-reviewers,jmaher,nalexander Differential Revision: https://phabricator.services.mozilla.com/D266038 Diffstat:
15 files changed, 343 insertions(+), 1 deletion(-)
diff --git a/Cargo.lock b/Cargo.lock @@ -7145,6 +7145,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2" [[package]] +name = "toolchain-embedded-uniffi-bindgen" +version = "0.1.0" +dependencies = [ + "mozilla-central-workspace-hack", +] + +[[package]] +name = "toolchain-nimbus-fml" +version = "0.1.0" +dependencies = [ + "mozilla-central-workspace-hack", +] + +[[package]] name = "topological-sort" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/Cargo.toml b/Cargo.toml @@ -17,6 +17,8 @@ members = [ "security/manager/ssl/qwac_trust_anchors", "security/manager/ssl/trust_anchors", "security/mls/mls_gk", + "services/app-services-tools/embedded-uniffi-bindgen", + "services/app-services-tools/nimbus-fml", "testing/geckodriver", "toolkit/components/uniffi-bindgen-gecko-js", "toolkit/crashreporter/client/app", diff --git a/build/workspace-hack/Cargo.toml b/build/workspace-hack/Cargo.toml @@ -278,3 +278,5 @@ mozwer_s = ["dep:allocator-api2", "dep:byteorder", "dep:getrandom", "dep:hashbro nmhproxy = ["dep:allocator-api2", "dep:bitflags", "dep:byteorder", "dep:form_urlencoded", "dep:hashbrown", "dep:icu_locale_core", "dep:icu_properties", "dep:idna", "dep:indexmap", "dep:once_cell", "dep:percent-encoding", "dep:serde_json", "dep:smallvec", "dep:stable_deref_trait", "dep:tinystr", "dep:unicode-bidi", "dep:url", "dep:windows-sys", "dep:yoke", "dep:zerocopy", "dep:zerofrom", "dep:zerovec"] pkcs11testmodule-static = [] test-trust-anchors-static = ["dep:bindgen", "dep:bitflags", "dep:itertools", "dep:memchr", "dep:nom", "dep:regex", "dep:smallvec"] +toolchain-embedded-uniffi-bindgen = [] +toolchain-nimbus-fml = [] diff --git a/services/app-services-tools/README.md b/services/app-services-tools/README.md @@ -0,0 +1,16 @@ +# App Services Tooling + +This directory holds tools implemented by application-services and required to be +used in the build process. + +There are 2 such tools - 'embedded-uniffi-bindgen' and 'nimbus-fml', both of which +will be called by the gradle build system. + +Note that these are effectively wrappers - the tools themselves remain in the app-services directory, +but these crates form a wrapper around them, meaning consumers don't need to know the full path +to the tool, just the path to this directory. + +NOTE: This is landing before app-services itself. That means that currently these are just +stub tools. Once we move app-services into this directory the stubs will be updated to +become actual wrappers around the tools. This helps us solve a bit of a chicken-and-egg +problem landing app-services. Updating these stubs is bug 2002854. diff --git a/services/app-services-tools/embedded-uniffi-bindgen/Cargo.toml b/services/app-services-tools/embedded-uniffi-bindgen/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "toolchain-embedded-uniffi-bindgen" +version = "0.1.0" +edition = "2021" +license = "MPL-2.0" + +[[bin]] +name = "embedded-uniffi-bindgen" + +[dependencies] +mozilla-central-workspace-hack = { version = "0.1", features = ["toolchain-embedded-uniffi-bindgen"], optional = true } diff --git a/services/app-services-tools/embedded-uniffi-bindgen/moz.build b/services/app-services-tools/embedded-uniffi-bindgen/moz.build @@ -0,0 +1,22 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +HOST_RUST_PROGRAMS = ["embedded-uniffi-bindgen"] + +with Files("**"): + BUG_COMPONENT = ("Application Services", "General") + +# copy-pasta from other moz.build file. +if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": + OS_LIBS += ["-framework CoreFoundation"] +elif CONFIG["OS_TARGET"] == "WINNT": + OS_LIBS += [ + "advapi32", + "wsock32", + "ws2_32", + "mswsock", + "winmm", + ] diff --git a/services/app-services-tools/embedded-uniffi-bindgen/src/bin/embedded-uniffi-bindgen.rs b/services/app-services-tools/embedded-uniffi-bindgen/src/bin/embedded-uniffi-bindgen.rs @@ -0,0 +1,7 @@ +/* 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/. */ + +fn main() { + unreachable!("a place-holder for the app-services monorepo migration"); +} diff --git a/services/app-services-tools/nimbus-fml/Cargo.toml b/services/app-services-tools/nimbus-fml/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "toolchain-nimbus-fml" +version = "0.1.0" +edition = "2021" +license = "MPL-2.0" + +[[bin]] +name = "nimbus-fml" + +[dependencies] +mozilla-central-workspace-hack = { version = "0.1", features = ["toolchain-nimbus-fml"], optional = true } diff --git a/services/app-services-tools/nimbus-fml/moz.build b/services/app-services-tools/nimbus-fml/moz.build @@ -0,0 +1,22 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +HOST_RUST_PROGRAMS = ["nimbus-fml"] + +with Files("**"): + BUG_COMPONENT = ("Application Services", "General") + +# copy-pasta from other moz.build file. +if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa": + OS_LIBS += ["-framework CoreFoundation"] +elif CONFIG["OS_TARGET"] == "WINNT": + OS_LIBS += [ + "advapi32", + "wsock32", + "ws2_32", + "mswsock", + "winmm", + ] diff --git a/services/app-services-tools/nimbus-fml/src/bin/nimbus-fml.rs b/services/app-services-tools/nimbus-fml/src/bin/nimbus-fml.rs @@ -0,0 +1,7 @@ +/* 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/. */ + +fn main() { + unreachable!("a place-holder for the app-services monorepo migration"); +} diff --git a/services/moz.build b/services/moz.build @@ -7,6 +7,9 @@ with Files("moz.build"): BUG_COMPONENT = ("Firefox Build System", "General") +with Files("app-services-tools/**"): + BUG_COMPONENT = ("Application Services", "General") + DIRS += [ "common", "crypto", @@ -34,6 +37,12 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] != "android": "fxaccounts", ] +if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + DIRS += [ + "app-services-tools/embedded-uniffi-bindgen", + "app-services-tools/nimbus-fml", + ] + if CONFIG["MOZ_SERVICES_SYNC"]: DIRS += ["sync"] diff --git a/taskcluster/kinds/toolchain/embedded-uniffi-bindgen.yml b/taskcluster/kinds/toolchain/embedded-uniffi-bindgen.yml @@ -0,0 +1,106 @@ +# 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/. +--- +task-defaults: + description: "embedded-uniffi-bindgen toolchain build" + worker-type: b-linux-amd + worker: + max-run-time: 1800 + env: + CRATE_PATH: services/app-services-tools/embedded-uniffi-bindgen + attributes: + local-toolchain: true + run: + script: build-rust-based-toolchain.sh + toolchain-artifact: public/build/embedded-uniffi-bindgen.tar.zst + sparse-profile: null + resources: + - 'services/app-services-tools/embedded-uniffi-bindgen' + +# For Linux platforms target "*-musl" so that the binary will be statically linked. + +linux64-embedded-uniffi-bindgen: + treeherder: + symbol: TL(eub) + platform: linux64/opt + run: + arguments: ['x86_64-unknown-linux-musl'] + attributes: + build_platform: linux64-embedded-uniffi-bindgen + fetches: + toolchain: + - linux64-rust-static + +macosx64-embedded-uniffi-bindgen: + treeherder: + symbol: TM(eub) + platform: macosx64/opt + run: + arguments: ['x86_64-apple-darwin'] + attributes: + build_platform: macosx64-embedded-uniffi-bindgen + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-macos + - macosx64-sdk-toolchain + +macosx64-aarch64-embedded-uniffi-bindgen: + treeherder: + symbol: TMA64(eub) + platform: macosx64-aarch64/opt + run: + arguments: ['aarch64-apple-darwin'] + attributes: + build_platform: macosx64-aarch64-embedded-uniffi-bindgen + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-macos + - macosx64-sdk-toolchain + +win32-embedded-uniffi-bindgen: + treeherder: + symbol: TW32(eub) + platform: win32/opt + run: + arguments: ['i686-pc-windows-msvc'] + toolchain-artifact: public/build/embedded-uniffi-bindgen.zip + attributes: + build_platform: win32-embedded-uniffi-bindgen + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-windows + - vs-toolchain + +win64-aarch64-embedded-uniffi-bindgen: + treeherder: + symbol: TWA64(eub) + platform: windows2012-aarch64/opt + run: + arguments: ['aarch64-pc-windows-msvc'] + toolchain-artifact: public/build/embedded-uniffi-bindgen.zip + attributes: + build_platform: win64-aarch64-embedded-uniffi-bindgen + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-windows + - vs-toolchain + +win64-embedded-uniffi-bindgen: + treeherder: + symbol: TW64(eub) + platform: win64/opt + run: + arguments: ['x86_64-pc-windows-msvc'] + toolchain-artifact: public/build/embedded-uniffi-bindgen.zip + attributes: + build_platform: win64-embedded-uniffi-bindgen + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-windows + - vs-toolchain diff --git a/taskcluster/kinds/toolchain/kind.yml b/taskcluster/kinds/toolchain/kind.yml @@ -35,6 +35,7 @@ tasks-from: - compiler-rt.yml - dxc.yml - dump-syms.yml + - embedded-uniffi-bindgen.yml - fix-stacks.yml - gcc.yml - geckodriver.yml @@ -50,6 +51,7 @@ tasks-from: - minidump-stackwalk.yml - misc.yml - nasm.yml + - nimbus-fml.yml - node.yml - onnx.yml - pkgconf.yml diff --git a/taskcluster/kinds/toolchain/nimbus-fml.yml b/taskcluster/kinds/toolchain/nimbus-fml.yml @@ -0,0 +1,106 @@ +# 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/. +--- +task-defaults: + description: "nimbus-fml toolchain build" + worker-type: b-linux-amd + worker: + max-run-time: 1800 + env: + CRATE_PATH: services/app-services-tools/nimbus-fml + attributes: + local-toolchain: true + run: + script: build-rust-based-toolchain.sh + toolchain-artifact: public/build/nimbus-fml.tar.zst + sparse-profile: null + resources: + - 'services/app-services-tools/nimbus-fml' + +# For Linux platforms target "*-musl" so that the binary will be statically linked. + +linux64-nimbus-fml: + treeherder: + symbol: TL(enf) + platform: linux64/opt + run: + arguments: ['x86_64-unknown-linux-musl'] + attributes: + build_platform: linux64-nimbus-fml + fetches: + toolchain: + - linux64-rust-static + +macosx64-nimbus-fml: + treeherder: + symbol: TM(enf) + platform: macosx64/opt + run: + arguments: ['x86_64-apple-darwin'] + attributes: + build_platform: macosx64-nimbus-fml + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-macos + - macosx64-sdk-toolchain + +macosx64-aarch64-nimbus-fml: + treeherder: + symbol: TMA64(enf) + platform: macosx64-aarch64/opt + run: + arguments: ['aarch64-apple-darwin'] + attributes: + build_platform: macosx64-aarch64-nimbus-fml + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-macos + - macosx64-sdk-toolchain + +win32-nimbus-fml: + treeherder: + symbol: TW32(enf) + platform: win32/opt + run: + arguments: ['i686-pc-windows-msvc'] + toolchain-artifact: public/build/nimbus-fml.zip + attributes: + build_platform: win32-nimbus-fml + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-windows + - vs-toolchain + +win64-aarch64-nimbus-fml: + treeherder: + symbol: TWA64(enf) + platform: windows2012-aarch64/opt + run: + arguments: ['aarch64-pc-windows-msvc'] + toolchain-artifact: public/build/nimbus-fml.zip + attributes: + build_platform: win64-aarch64-nimbus-fml + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-windows + - vs-toolchain + +win64-nimbus-fml: + treeherder: + symbol: TW64(enf) + platform: win64/opt + run: + arguments: ['x86_64-pc-windows-msvc'] + toolchain-artifact: public/build/nimbus-fml.zip + attributes: + build_platform: win64-nimbus-fml + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-windows + - vs-toolchain diff --git a/taskcluster/scripts/misc/build-rust-based-toolchain.sh b/taskcluster/scripts/misc/build-rust-based-toolchain.sh @@ -66,7 +66,12 @@ esac PATH="$MOZ_FETCHES_DIR/rustc/bin:$MOZ_FETCHES_DIR/clang/bin:$PATH" -CRATE_PATH=$MOZ_FETCHES_DIR/${FETCH-$project} +if [ -n "${CRATE_PATH}" ]; then + CRATE_PATH="${GECKO_PATH}/${CRATE_PATH}" +else + CRATE_PATH=$MOZ_FETCHES_DIR/${FETCH-$project} +fi + WORKSPACE_ROOT=$(cd $CRATE_PATH; cargo metadata --format-version 1 --no-deps --locked 2> /dev/null | jq -r .workspace_root) if test ! -f $WORKSPACE_ROOT/Cargo.lock; then