# 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/.
---
loader: taskgraph.loader.transform:loader

kind-dependencies:
    - toolchain
    - fetch

transforms:
    - gecko_taskgraph.transforms.build:transforms
    - gecko_taskgraph.transforms.build_attrs:transforms
    - gecko_taskgraph.transforms.build_lints:transforms
    - gecko_taskgraph.transforms.job:transforms
    - gecko_taskgraph.transforms.task:transforms

task-defaults:
    index:
        product: firefox
    treeherder:
        symbol: Searchfox(idx)
        kind: build
        tier: 2
    run-on-projects: ['mozilla-central']
    optimization: null
    use-python: default
    # These builds don't use sccache because otherwise we wouldn't index
    # the files that sccache optimizes away compilation for.
    use-sccache: false

tasks:
    linux64-searchfox/debug:
        description: "Linux64 Debug Searchfox"
        index:
            job-name: linux64-searchfox-debug
        treeherder:
            platform: linux64/debug
        worker-type: b-linux-gcp
        worker:
            max-run-time: 10800
            env:
                PERFHERDER_EXTRA_OPTIONS: searchfox
                MOZSEARCH_PLATFORM: "linux"
        run:
            using: mozharness
            actions: [build]
            config:
                - builds/releng_base_firefox.py
                - builds/releng_sub_linux_configs/64_searchfox_and_debug.py
            script: "mozharness/scripts/fx_desktop_build.py"
            tooltool-downloads: public
            keep-artifacts: false
        fetches:
            toolchain:
                - linux64-clang
                - linux64-nasm
                - linux64-node
                - linux64-rust
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-pkgconf
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    macosx64-searchfox/debug:
        description: "MacOS X x64 Debug Cross-compile Searchfox"
        index:
            job-name: macosx64-searchfox-debug
        treeherder:
            platform: osx-cross/debug
        worker-type: b-linux-gcp
        worker:
            max-run-time: 10800
            env:
                PERFHERDER_EXTRA_OPTIONS: searchfox
                MOZSEARCH_PLATFORM: "macosx"
        run:
            using: mozharness
            actions: [get-secrets, build]
            config:
                - builds/releng_base_firefox.py
                - builds/releng_base_mac_64_cross_builds.py
            script: "mozharness/scripts/fx_desktop_build.py"
            custom-build-variant-cfg: cross-debug-searchfox
            secrets: true
            keep-artifacts: false
        fetches:
            toolchain:
                - linux64-clang
                - linux64-hfsplus
                - linux64-libdmg
                - linux64-nasm
                - linux64-node
                - linux64-rust-cross
                - linux64-cbindgen
                - linux64-dump_syms
                - macosx64-sdk
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    macosx64-aarch64-searchfox/debug:
        description: "MacOS X aarch64 Debug Cross-compile Searchfox"
        index:
            job-name: macosx64-aarch64-searchfox-debug
        treeherder:
            platform: osx-cross-aarch64/debug
        worker-type: b-linux-gcp
        worker:
            max-run-time: 10800
            env:
                PERFHERDER_EXTRA_OPTIONS: searchfox
                MOZSEARCH_PLATFORM: "macosx"
        run:
            using: mozharness
            actions: [get-secrets, build]
            config:
                - builds/releng_base_firefox.py
                - builds/releng_base_mac_64_cross_builds.py
            extra-config:
                extra_mozconfig_content:
                    - ac_add_options --target=aarch64-apple-darwin
            script: "mozharness/scripts/fx_desktop_build.py"
            custom-build-variant-cfg: cross-debug-searchfox
            secrets: true
            keep-artifacts: false
        fetches:
            toolchain:
                - linux64-clang
                - linux64-hfsplus
                - linux64-libdmg
                - linux64-nasm
                - linux64-node
                - linux64-rust-cross
                - linux64-cbindgen
                - linux64-dump_syms
                - macosx64-sdk
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    ios-searchfox/debug:
        description: "ios Debug Cross-compile Searchfox"
        index:
            job-name: ios-searchfox-debug
        treeherder:
            platform: ios/debug
        worker-type: b-linux-gcp
        worker:
            max-run-time: 10800
            env:
                PERFHERDER_EXTRA_OPTIONS: searchfox
                MOZSEARCH_PLATFORM: "ios"
        run:
            using: mozharness
            actions: [get-secrets, build]
            config:
                - builds/releng_base_firefox.py
            script: "mozharness/scripts/fx_desktop_build.py"
            secrets: true
            keep-artifacts: false
            extra-config:
                app_name: mobile/ios
                stage_platform: ios
                mozconfig_platform: ios
                disable_package_metrics: true
            mozconfig-variant: debug-searchfox
        fetches:
            toolchain:
                - linux64-clang
                - linux64-hfsplus
                - linux64-libdmg
                - linux64-nasm
                - linux64-node
                - linux64-rust-ios
                - linux64-cbindgen
                - linux64-dump_syms
                - ios-sdk
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    win64-searchfox/debug:
        description: "Win64 Searchfox Debug (clang-cl)"
        index:
            job-name: win64-searchfox-debug
        treeherder:
            platform: windows2012-64/debug
        worker-type: b-linux-gcp
        worker:
            max-run-time: 10800
            env:
                PERFHERDER_EXTRA_OPTIONS: searchfox
                MOZSEARCH_PLATFORM: "windows"
        run:
            using: mozharness
            options: [append-env-variables-from-configs]
            actions: [get-secrets, build]
            script: mozharness/scripts/fx_desktop_build.py
            secrets: true
            config:
                - builds/releng_base_firefox.py
                - builds/releng_base_linux_64_builds.py
                - builds/taskcluster_sub_win64/searchfox_debug.py
            extra-config:
                mozconfig_platform: win64
        fetches:
            toolchain:
                - linux64-clang
                - linux64-rust-cross
                - linux64-rust-size
                - linux64-nasm
                - linux64-node
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-wine
                - linux64-winchecksec
                - nsis
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi
                - vs
                - windows-rs
            fetch:
                - upx-3.95-win

    android-armv7-searchfox/debug:
        description: "Android ARMv7 Debug Searchfox"
        index:
            job-name: android-armv7-searchfox-debug
        treeherder:
            platform: android-4-1-armv7/debug
        worker-type: b-linux-gcp
        worker:
            docker-image: {in-tree: android-build}
            max-run-time: 10800
            env:
                PERFHERDER_EXTRA_OPTIONS: searchfox
                MOZSEARCH_PLATFORM: "android-armv7"
                GRADLE_USER_HOME: "/builds/worker/checkouts/gecko/mobile/android/gradle/dotgradle-offline"
                TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
        run:
            using: mozharness
            actions: [get-secrets, build]
            config:
                - builds/releng_base_android_64_builds.py
            script: "mozharness/scripts/fx_desktop_build.py"
            secrets: true
            custom-build-variant-cfg: arm-debug-searchfox
            tooltool-downloads: internal
        fetches:
            toolchain:
                - android-gradle-dependencies
                - android-ndk-linux
                - android-sdk-linux
                - linux64-jdk
                - linux64-clang
                - linux64-rust-cross
                - linux64-rust-size
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-nasm
                - linux64-node
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi
