diff --git a/taskcluster/ci/fetch/toolchains.yml b/taskcluster/ci/fetch/toolchains.yml index 4d94d13fe374..83e611a60657 100644 --- a/taskcluster/ci/fetch/toolchains.yml +++ b/taskcluster/ci/fetch/toolchains.yml @@ -658,3 +658,10 @@ aflplusplus-4.0: type: git repo: https://github.com/AFLplusplus/AFLplusplus revision: ba3c7bfe40f9b17a691958e3525828385127ad25 + +cargo-vet: + description: cargo-vet source + fetch: + type: git + repo: https://github.com/bholley/cargo-vet + revision: 1d5cd771cd1df8921a57b346a0626e8b8f8694f6 diff --git a/taskcluster/ci/toolchain/cargo-vet.yml b/taskcluster/ci/toolchain/cargo-vet.yml new file mode 100644 index 000000000000..18f65e5420f1 --- /dev/null +++ b/taskcluster/ci/toolchain/cargo-vet.yml @@ -0,0 +1,64 @@ +# 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/. +--- +job-defaults: + description: "cargo-vet toolchain build" + attributes: + local-toolchain: true + worker-type: b-linux + worker: + max-run-time: 1800 + run: + script: build-cargo-vet.sh + toolchain-artifact: public/build/cargo-vet.tar.zst + fetches: + fetch: + - cargo-vet + +linux64-cargo-vet: + treeherder: + symbol: TL(cargo-vet) + run: + arguments: ['x86_64-unknown-linux-gnu'] + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-1.60 + - sysroot-x86_64-linux-gnu + +macosx64-cargo-vet: + treeherder: + symbol: TM(cargo-vet) + run: + arguments: ['x86_64-apple-darwin'] + toolchain-alias: macosx64-aarch64-cargo-vet + fetches: + toolchain: + - linux64-cctools-port + - linux64-clang-toolchain + - linux64-rust-macos-1.60 + - macosx64-sdk-11.0 + +macosx64-aarch64-cargo-vet: + treeherder: + symbol: TM(cargo-vet-arm64) + run: + arguments: ['aarch64-apple-darwin'] + fetches: + toolchain: + - linux64-cctools-port + - linux64-clang-toolchain + - linux64-rust-macos-1.60 + - macosx64-sdk-11.0 + +win64-cargo-vet: + treeherder: + symbol: TW64(cargo-vet) + run: + arguments: ['x86_64-pc-windows-msvc'] + fetches: + toolchain: + - linux64-clang-toolchain + - linux64-rust-windows-1.60 + - win64-vs2017 diff --git a/taskcluster/ci/toolchain/kind.yml b/taskcluster/ci/toolchain/kind.yml index d4535077c269..f23a00e91f29 100644 --- a/taskcluster/ci/toolchain/kind.yml +++ b/taskcluster/ci/toolchain/kind.yml @@ -25,6 +25,7 @@ job-defaults: jobs-from: - android.yml + - cargo-vet.yml - cbindgen.yml - clang-tidy.yml - clang.yml diff --git a/taskcluster/scripts/misc/build-cargo-vet.sh b/taskcluster/scripts/misc/build-cargo-vet.sh new file mode 100755 index 000000000000..1cfa931c304c --- /dev/null +++ b/taskcluster/scripts/misc/build-cargo-vet.sh @@ -0,0 +1,55 @@ +#!/bin/bash +set -x -e -v + +PROJECT=cargo-vet + +# Needed by osx-cross-linker. +export TARGET=$1 + +case "$TARGET" in +x86_64-unknown-linux-gnu) + # Native Linux Build + EXE= + FEATURES="--features reqwest/native-tls-vendored" + export RUSTFLAGS="-Clinker=$MOZ_FETCHES_DIR/clang/bin/clang++ -C link-arg=--sysroot=$MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu -C link-arg=-fuse-ld=lld" + export CC=$MOZ_FETCHES_DIR/clang/bin/clang + export CFLAGS="--sysroot=$MOZ_FETCHES_DIR/sysroot-x86_64-linux-gnu" + ;; +*-apple-darwin) + # Cross-compiling for Mac on Linux. + EXE= + FEATURES= + export PATH="$MOZ_FETCHES_DIR/clang/bin:$PATH" + export PATH="$MOZ_FETCHES_DIR/cctools/bin:$PATH" + export RUSTFLAGS="-C linker=$GECKO_PATH/taskcluster/scripts/misc/osx-cross-linker" + if test "$TARGET" = "aarch64-apple-darwin"; then + export MACOSX_DEPLOYMENT_TARGET=11.0 + else + export MACOSX_DEPLOYMENT_TARGET=10.12 + fi + export CC="$MOZ_FETCHES_DIR/clang/bin/clang" + export TARGET_CC="$CC -isysroot $MOZ_FETCHES_DIR/MacOSX11.0.sdk" + ;; +x86_64-pc-windows-msvc) + # Cross-compiling for Windows on Linux. + EXE=.exe + FEATURES= + export CC=$MOZ_FETCHES_DIR/clang/bin/clang-cl + export TARGET_AR=$MOZ_FETCHES_DIR/clang/bin/llvm-lib + + . $GECKO_PATH/taskcluster/scripts/misc/vs-setup.sh + export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=$MOZ_FETCHES_DIR/clang/bin/lld-link + ;; +esac + +PATH="$MOZ_FETCHES_DIR/rustc/bin:$PATH" + +cd $MOZ_FETCHES_DIR/$PROJECT + +cargo build --verbose --release --target "$TARGET" --bin $PROJECT $FEATURES + +mkdir ${PROJECT} +cp target/$TARGET/release/${PROJECT}${EXE} ${PROJECT}/${PROJECT}${EXE} +tar -acf ${PROJECT}.tar.zst ${PROJECT} +mkdir -p $UPLOAD_DIR +cp ${PROJECT}.tar.zst $UPLOAD_DIR