# 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:
    worker-type: b-linux-gcp
    worker:
        max-run-time: 1800

linux64-binutils-2.31.1:
    description: "Binutils toolchain build"
    treeherder:
        symbol: TL(binutil2.31)
    run:
        script: build-binutils-linux.sh
        resources:
            - 'build/unix/build-binutils/build-binutils.sh'
        toolchain-artifact: public/build/binutils.tar.zst
    fetches:
        fetch:
            - binutils-2.31.1
        toolchain:
            # C++ code in gold doesn't compile with recent versions of GCC.
            - linux64-gcc-8
            - linux64-toolchain-sysroot

linux64-binutils:
    description: "Binutils toolchain build"
    treeherder:
        symbol: TL(binutil)
    run:
        script: build-binutils-linux.sh
        resources:
            - 'build/unix/build-binutils/build-binutils.sh'
        toolchain-artifact: public/build/binutils.tar.zst
    fetches:
        fetch:
            - binutils-2.41
        toolchain:
            - linux64-toolchain-sysroot

linux64-cctools-port:
    description: "cctools-port toolchain build"
    treeherder:
        symbol: TL(cctools-clang)
    run:
        script: build-cctools-port.sh
        resources:
            - taskcluster/scripts/misc/cctools.patch
        toolchain-artifact: public/build/cctools.tar.zst
    fetches:
        toolchain:
            - linux64-clang-toolchain
            - linux64-toolchain-sysroot
        fetch:
            - cctools-port
            - libtapi
            - ldid

linux64-hfsplus:
    description: "hfsplus toolchain build"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(hfs+)
    run:
        script: build-hfsplus-linux.sh
        resources:
            - 'build/unix/build-hfsplus/build-hfsplus.sh'
        toolchain-artifact: public/build/hfsplus.tar.zst
    fetches:
        fetch:
            - hfsplus-tools
        toolchain:
            - linux64-clang-toolchain

linux64-libdmg:
    description: "libdmg-hfsplus toolchain build"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(libdmg-hfs+)
    run:
        script: build-dmg-hfsplus.sh
        toolchain-artifact: public/build/dmg.tar.zst
        toolchain-alias: linux64-dmg
    fetches:
        fetch:
            - libdmg-hfsplus
        toolchain:
            - linux64-clang-toolchain
            - linux64-toolchain-sysroot

linux64-mkbom:
    description: "mkbom toolchain build"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(mkbom)
    run:
        script: build-mkbom-linux.sh
        toolchain-artifact: public/build/mkbom.tar.zst
    fetches:
        fetch:
            - bomutils
        toolchain:
            - linux64-clang-toolchain
            - linux64-toolchain-sysroot

linux64-xar:
    description: "xar toolchain build"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(xar)
    run:
        script: build-xar-linux.sh
        toolchain-artifact: public/build/xar.tar.zst
    fetches:
        fetch:
            - xar
        toolchain:
            - linux64-clang-toolchain
            - linux64-toolchain-sysroot

linux64-mar-tools:
    description: "mar-tools toolchain build"
    treeherder:
        symbol: TL(mar-tools)
    fetches:
        toolchain:
            - linux64-clang-toolchain
    run:
        script: build-mar-tools.sh
        sparse-profile: null
        toolchain-artifact: public/build/mar-tools.tar.zst
        resources:
            - build/moz.configure
            - modules/libmar/
            - moz.configure
            - other-licenses/bsdiff/
            - other-licenses/nsis/Contrib/CityHash/cityhash/
            - toolkit/mozapps/update/updater/bspatch/
            - tools/update-packaging/

linux64-zucchini-bin:
    description: "zucchini bin toolchain build"
    treeherder:
        symbol: TL(zucchini-bin)
    fetches:
        toolchain:
            - linux64-clang-toolchain
        fetch:
            - chromium-depot-tools
    worker:
        env:
            # Note: this revision is for the "chromium/src" trunk
            # https://chromium.googlesource.com/chromium/src/+/refs/heads/main
            CHROMIUM_REVISION: 59c5ba8f94f8b0d4de6da2769d2eedddd08da956
    run:
        script: build-zucchini.sh
        toolchain-artifact: public/build/zucchini.tar.xz

linux64-upx:
    description: "UPX build"
    treeherder:
        symbol: TL(upx)
        tier: 1
    run:
        script: build-upx.sh
        toolchain-artifact: public/build/upx.tar.zst

linux64-msix-packaging:
    description: "msix-packaging build"
    treeherder:
        symbol: TL(msix-packaging)
        tier: 1
    run:
        script: build-msix-packaging.sh
        toolchain-artifact: public/build/msix-packaging.tar.zst
    fetches:
        fetch:
            - msix-packaging
        toolchain:
            - linux64-clang-toolchain
            - linux64-toolchain-sysroot

linux64-custom-v8:
    description: "Custom v8 build"
    treeherder:
        symbol: TL(custom-v8)
    worker:
        docker-image: {in-tree: custom-v8}
        max-run-time: 3600
    run:
        script: build-custom-v8.sh
        arguments: [
            d8.tar.zst,
            is_debug=false,
            target_cpu="x64"
        ]
        toolchain-artifact: public/build/d8.tar.zst

macosx64-xz:
    description: "xz development library"
    worker-type: b-osx-1015
    treeherder:
        symbol: TM(xz)
    worker:
        max-run-time: 30000
    run:
        script: build-xz.sh
        toolchain-artifact: public/build/xz.tar.zst
    fetches:
        fetch:
            - xz-5.4.4
        toolchain:
            - macosx64-clang-toolchain
            - macosx64-sdk-toolchain

macosx-custom-car:
    description: "Custom chromium-as-release build for mac (x64, cross compiled on arm)"
    worker-type: b-osx-arm64
    attributes:
        cached_task: false
    treeherder:
        symbol: TM(custom-car)
        tier: 2
    worker:
        max-run-time: 50000
    use-python: "3.11"
    run-on-projects: []
    run:
        script: build-custom-car.sh
        arguments: [
            car_macosx.tar.zst,
            blink_symbol_level=0,
            chrome_pgo_phase=2,
            dcheck_always_on=false,
            enable_nacl=false,
            enable_resource_allowlist_generation=false,
            is_chrome_branded=false,
            is_clang=true,
            is_component_build=false,
            is_debug=false,
            is_official_build=true,
            symbol_level=0,
            target_cpu="x64",
            use_v8_context_snapshot=false,
            v8_symbol_level=0
        ]
        toolchain-artifact: public/build/car_macosx.tar.zst
    fetches:
        toolchain:
            - MacOSX15.4.sdk

macosx-arm64-custom-car:
    description: "Custom chromium-as-release build for mac (apple silicon)"
    worker-type: b-osx-arm64
    attributes:
        cached_task: false
    treeherder:
        symbol: TM(custom-car-arm)
        tier: 2
    worker:
        max-run-time: 40000
    use-python: "3.11"
    run-on-projects: []
    run:
        script: build-custom-car.sh
        arguments: [
            car_macosx_arm.tar.zst,
            blink_symbol_level=0,
            chrome_pgo_phase=2,
            dcheck_always_on=false,
            enable_nacl=false,
            enable_resource_allowlist_generation=false,
            is_chrome_branded=false,
            is_clang=true,
            is_component_build=false,
            is_debug=false,
            is_official_build=true,
            symbol_level=0,
            target_cpu="arm64",
            use_v8_context_snapshot=false,
            v8_symbol_level=0
        ]
        toolchain-artifact: public/build/car_macosx_arm.tar.zst
    fetches:
        toolchain:
            - MacOSX15.4.sdk

android-custom-car:
    description: "Custom chromium-as-release build for Android"
    attributes:
        cached_task: false
    treeherder:
        symbol: TL(custom-car-android)
    worker:
        docker-image: {in-tree: custom-car-android}
        max-run-time: 30000
    use-python: "3.11"
    run-on-projects: []
    run:
        script: build-custom-car.sh
        arguments: [
            car_android.tar.zst,
            blink_symbol_level=0,
            chrome_pgo_phase=2,
            dcheck_always_on=false,
            enable_nacl=false,
            enable_resource_allowlist_generation=false,
            is_chrome_branded=false,
            is_clang=true,
            is_component_build=false,
            is_debug=false,
            is_official_build=true,
            symbol_level=0,
            target_cpu="arm64",
            target_os="android",
            is_android=true,
            is_high_end_android=true,
            v8_symbol_level=0
        ]
        toolchain-artifact: public/build/car_android.tar.zst

linux64-custom-car:
    description: "Custom chromium-as-release build for Linux"
    attributes:
        cached_task: false
    treeherder:
        symbol: TL(custom-car)
    worker:
        docker-image: {in-tree: custom-car-linux}
        max-run-time: 25000
    use-python: "3.11"
    run-on-projects: []
    run:
        script: build-custom-car.sh
        arguments: [
            car_linux.tar.zst,
            blink_symbol_level=0,
            chrome_pgo_phase=2,
            dcheck_always_on=false,
            enable_nacl=false,
            enable_resource_allowlist_generation=false,
            is_chrome_branded=false,
            is_clang=true,
            is_component_build=false,
            is_debug=false,
            is_official_build=true,
            symbol_level=0,
            target_cpu="x64",
            use_v8_context_snapshot=false,
            v8_symbol_level=0
        ]
        toolchain-artifact: public/build/car_linux.tar.zst

win64-custom-car:
    description: "Custom chromium-as-release build for Windows"
    attributes:
        cached_task: false
    treeherder:
        symbol: TW64(custom-car)
    worker-type: b-win2022
    worker:
        max-run-time: 18000
        env:
            MSYSTEM: "MINGW64"
    use-python: "3.11"
    run-on-projects: []
    run:
        script: build-custom-car.sh
        arguments: [
            car_win64.tar.zst,
            chrome_pgo_phase=2,
            dcheck_always_on=false,
            enable_nacl=false,
            enable_resource_allowlist_generation=false,
            is_chrome_branded=false,
            is_clang=true,
            is_component_build=false,
            is_debug=false,
            is_official_build=true,
            symbol_level=2,
            target_cpu=\"x64\",
            use_v8_context_snapshot=false,
        ]
        toolchain-artifact: public/build/car_win64.tar.zst
    fetches:
        toolchain:
            - win64-vs2022-car

browsertime:
    description: "npm install browsertime node_modules"
    treeherder:
        symbol: TL(browsertime)
    run:
        script: browsertime.sh
        sparse-profile: null
        resources:
            - 'tools/browsertime/package.json'
            - 'tools/browsertime/package-lock.json'
            - 'tools/browsertime/mach_commands.py'
        toolchain-artifact: public/build/browsertime.tar.zst
    fetches:
        toolchain:
            - linux64-node

aboutwelcome-node-modules:
    description: "npm install aboutwelcome node_modules"
    treeherder:
        symbol: TL(aboutwelcome-node)
    run:
        script: generic-node-modules.sh
        arguments: ['aboutwelcome', 'browser/components/aboutwelcome/']
        sparse-profile: null
        resources:
            - 'browser/components/aboutwelcome/package.json'
            - 'browser/components/aboutwelcome/package-lock.json'
        toolchain-artifact: public/build/aboutwelcome-node-modules.tar.zst
    fetches:
        toolchain:
            - linux64-node

asrouter-node-modules:
    description: "npm install asrouter node_modules"
    treeherder:
        symbol: TL(asrouter-node)
    run:
        script: generic-node-modules.sh
        arguments: ['asrouter', 'browser/components/asrouter/']
        sparse-profile: null
        resources:
            - 'browser/components/asrouter/package.json'
            - 'browser/components/asrouter/package-lock.json'
        toolchain-artifact: public/build/asrouter-node-modules.tar.zst
    fetches:
        toolchain:
            - linux64-node

eslint-plugin-mozilla:
    description: "npm install eslint-plugin-mozilla node_modules"
    treeherder:
        symbol: TL(epm)
    run:
        script: eslint-plugin-mozilla.sh
        sparse-profile: null
        resources:
            - 'tools/lint/eslint/eslint-plugin-mozilla/package.json'
            - 'tools/lint/eslint/eslint-plugin-mozilla/package-lock.json'
        toolchain-artifact: public/build/eslint-plugin-mozilla.tar.zst
    fetches:
        toolchain:
            - linux64-node

stylelint-plugin-mozilla:
    description: "npm install stylelint-plugin-mozilla node_modules"
    treeherder:
        symbol: TL(spm)
    run:
        script: stylelint-plugin-mozilla.sh
        sparse-profile: null
        resources:
            - 'tools/lint/stylelint/stylelint-plugin-mozilla/package.json'
            - 'tools/lint/stylelint/stylelint-plugin-mozilla/package-lock.json'
        toolchain-artifact: public/build/stylelint-plugin-mozilla.tar.zst
    fetches:
        toolchain:
            - linux64-node

newtab-node-modules:
    description: "npm install newtab node_modules"
    treeherder:
        symbol: TL(newtab-node)
    run:
        script: generic-node-modules.sh
        arguments: ['newtab', 'browser/extensions/newtab/']
        sparse-profile: null
        resources:
            - 'browser/extensions/newtab/package.json'
            - 'browser/extensions/newtab/package-lock.json'
        toolchain-artifact: public/build/newtab-node-modules.tar.zst
    fetches:
        toolchain:
            - linux64-node

node-modules:
    description: "npm install top-level node_modules"
    treeherder:
        symbol: TL(node)
    run:
        script: node-modules.sh
        sparse-profile: null
        resources:
            - 'package.json'
            - 'package-lock.json'
            - 'tools/lint/eslint/__init__.py'
            - 'tools/lint/eslint/setup_helper.py'
            - 'tools/lint/eslint/eslint-plugin-mozilla/package.json'
            - 'tools/lint/eslint/eslint-plugin-mozilla/package-lock.json'
            - 'tools/lint/eslint/eslint-plugin-spidermonkey-js/package.json'
        toolchain-artifact: public/build/node-modules.tar.zst
    fetches:
        toolchain:
            - linux64-node

wrench-deps:
    description: "Downloads all the crates needed for building wrench"
    treeherder:
        symbol: WR(wrench-deps)
    worker:
        docker-image: {in-tree: webrender}
    run:
        script: wrench-deps-vendoring.sh
        sparse-profile: null
        resources:
            - 'gfx/wr/**/Cargo.toml'
            - 'gfx/wr/Cargo.lock'
            - 'gfx/wr/ci-scripts/install-meson.sh'
        toolchain-artifact: public/build/wrench-deps.tar.zst
    fetches:
        toolchain:
            - linux64-rust  # whatever m-c is built with

linux64-wine:
    description: "Wine build for Windows Cross Compile"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(wine)
        tier: 1
    worker:
        max-run-time: 10800
    run:
        script: build-wine.sh
        toolchain-artifact: public/build/wine.tar.zst
    fetches:
        fetch:
            - wine

linux64-winchecksec:
    description: "winchecksec"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(winchecksec)
    run:
        script: build-winchecksec.sh
        arguments: ['x86_64-unknown-linux-gnu']
        toolchain-artifact: public/build/winchecksec.tar.zst
        tooltool-downloads: internal
    fetches:
        fetch:
            - winchecksec

win64-winchecksec:
    description: "winchecksec"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TW64(winchecksec)
    run:
        script: build-winchecksec.sh
        arguments: ['x86_64-pc-windows-msvc']
        toolchain-artifact: public/build/winchecksec.tar.zst
        tooltool-downloads: internal
    fetches:
        fetch:
            - winchecksec
        toolchain:
            - linux64-clang-toolchain
            - vs-toolchain

linux64-makecab:
    description: "makecab toolchain build"
    treeherder:
        symbol: TL(cab)
    worker:
        env:
            FETCH: rust-makecab
    run:
        script: build-rust-based-toolchain.sh
        arguments: ['x86_64-unknown-linux-gnu']
        toolchain-artifact: public/build/makecab.tar.zst
    fetches:
        fetch:
            - makecab
        toolchain:
            - linux64-clang-toolchain
            - linux64-rust-toolchain
            - sysroot-x86_64-linux-gnu

win64-mozmake:
    description: "mozmake for Windows"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TW64(mozmake)
    run:
        script: build-mozmake.sh
        arguments: ['x86_64-pc-windows-msvc']
        toolchain-artifact: public/build/mozmake.tar.zst
    fetches:
        fetch:
            - gnumake
        toolchain:
            - linux64-clang-toolchain
            - vs-toolchain

win64-aarch64-mozmake:
    description: "mozmake for Windows"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TWA64(mozmake)
    run:
        script: build-mozmake.sh
        arguments: ['aarch64-pc-windows-msvc']
        toolchain-artifact: public/build/mozmake.tar.zst
    fetches:
        fetch:
            - gnumake
        toolchain:
            - linux64-clang-toolchain
            - vs-toolchain

nsis:
    description: "NSIS for Linux and Windows"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(nsis)
    run:
        script: build-nsis.sh
        toolchain-artifact: public/build/nsis.tar.zst
    fetches:
        fetch:
            - nsis-3.07
            - nsis-3.07-win
        toolchain:
            - linux64-clang-toolchain
            - sysroot-x86_64-linux-gnu

win64-vs2022-car:
    description: "VS 2022 toolchain with SDK 10.0.26100.x, for CaR builds"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TW64(msvc2022-car)
    worker:
        env:
            MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE: system
    run:
        script: get_vs.py
        arguments:
            - build/vs/vs2022-car.yaml
        resources:
            - build/vs/vs2022-car.yaml
        toolchain-artifact: project/gecko/vs/vs.tar.zst

win64-vs2022:
    description: "VS 2022"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TW64(msvc2022)
    worker:
        env:
            MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE: system
    run:
        script: get_vs.py
        arguments:
            - build/vs/vs2022.yaml
        resources:
            - build/vs/vs2022.yaml
        toolchain-artifact: project/gecko/vs/vs.tar.zst
        toolchain-alias:
            - vs
            - vs-toolchain

win64-aarch64-vs2022:
    description: "VS 2022"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TWA64(msvc2022)
    worker:
        env:
            MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE: system
    run:
        script: get_vs.py
        arguments:
            - build/vs/vs2022-aarch64.yaml
        resources:
            - build/vs/vs2022-aarch64.yaml
        toolchain-artifact: project/gecko/vs/vs.tar.zst
        toolchain-alias: win64-aarch64-vs

linux64-afl-instrumentation-4.0:
    description: "AFL++ instrumentation toolchain build"
    treeherder:
        symbol: TL(afl++)
    worker:
        max-run-time: 3600
    run:
        script: build-afl.sh
        resources:
            - taskcluster/scripts/misc/afl-nyx.patch
        toolchain-artifact: public/build/afl-instrumentation.tar.zst
        toolchain-alias: linux64-afl-instrumentation
    fetches:
        fetch:
            - afl-plus-plus-4.0
        toolchain:
            - linux64-clang
            - linux64-toolchain-sysroot

linux64-cargo-apk:
    description: "cargo-apk toolchain build"
    treeherder:
        symbol: TL(cargo-apk)
    worker:
        env:
            FETCH: android-ndk-rs/cargo-apk
    run:
        script: build-rust-based-toolchain.sh
        arguments: ['x86_64-unknown-linux-gnu']
        resources:
            - taskcluster/scripts/misc/cargo-apk-Cargo.lock
        toolchain-artifact: public/build/cargo-apk.tar.zst
    fetches:
        fetch:
            - android-ndk-rs
        toolchain:
            - linux64-clang-toolchain
            - linux64-rust-toolchain
            - sysroot-x86_64-linux-gnu

windows-rs:
    # Bootstrap cannot use fetches directly, so we have this task to
    # expose the corresponding fetch as a toolchain artifact.
    description: Source of the windows rust crate
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TW64(windows-rs)
    run:
        script: dummy.sh
        toolchain-artifact: public/build/windows-rs.tar.zst
    dependencies:
        fetch-windows-rs: fetch-windows-rs
    fetches:
        fetch-windows-rs:
            - artifact: windows-rs.tar.zst
              extract: false
              dest: ../artifacts

win64-cmake:
    description: "cmake toolchain build"
    treeherder:
        symbol: TW64(cmake)
    run:
        script: build-cmake.sh
        toolchain-artifact: public/build/cmake.tar.zst
    fetches:
        fetch:
            - cmake
        toolchain:
            - linux64-clang-toolchain
            - vs-toolchain

win64-libxml2:
    description: "libxml2 toolchain build"
    treeherder:
        symbol: TW64(libxml2)
    run:
        script: build-libxml2.sh
        arguments: ['x86_64-pc-windows-msvc']
        toolchain-artifact: public/build/libxml2.tar.zst
    fetches:
        fetch:
            - libxml2
        toolchain:
            - linux64-clang-toolchain
            - vs-toolchain

win64-aarch64-libxml2:
    description: "libxml2 toolchain build"
    treeherder:
        symbol: TWA64(libxml2)
    run:
        script: build-libxml2.sh
        arguments: ['aarch64-pc-windows-msvc']
        toolchain-artifact: public/build/libxml2.tar.zst
    fetches:
        fetch:
            - libxml2
        toolchain:
            - linux64-clang-toolchain
            - vs-toolchain

talos-pdfs:
    description: "Gathers all the PDFs needed for the pdfpaint test"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TL(talos-pdfs)
    worker:
        max-run-time: 3600
    run:
        script: run-fetch-talos-pdfs.sh
        sparse-profile: null
        resources:
            - 'taskcluster/scripts/misc/fetch-talos-pdfs.py'
        toolchain-artifact: public/build/talos-pdfs.tar.zst
    fetches:
        fetch:
            - mozilla-pdf.js

win64-dxc:
    description: "DirectX Shader Compiler (x86_64)"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TW64(dxc)
    run:
        script: build-dxc.sh
        arguments:
            - "x86_64"
        toolchain-artifact: public/build/dxc-x86_64-pc-windows-msvc.tar.zst
        toolchain-alias: dxc-x86_64-pc-windows-msvc
    fetches:
        toolchain:
            - linux64-clang-toolchain
            - vs-toolchain
        fetch:
            - dxc-src

win64-aarch64-dxc:
    description: "DirectX Shader Compiler (aarch64)"
    attributes:
        local-toolchain: true
    treeherder:
        symbol: TWA64(dxc)
    run:
        script: build-dxc.sh
        arguments:
            - "aarch64"
        toolchain-artifact: public/build/dxc-aarch64-pc-windows-msvc.tar.zst
        toolchain-alias: dxc-aarch64-pc-windows-msvc
    fetches:
        toolchain:
            - linux64-clang-toolchain
            - vs-toolchain
        fetch:
            - dxc-src
