# 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_schedules:transforms
    - gecko_taskgraph.transforms.build_lints:transforms
    - gecko_taskgraph.transforms.job:transforms
    - gecko_taskgraph.transforms.artifact:transforms
    - gecko_taskgraph.transforms.task:transforms

task-defaults:
    shipping-phase: build
    treeherder:
        symbol: Bpgo(instr)
        tier: 1
    worker:
        max-run-time: 7200
        env:
            PERFHERDER_EXTRA_OPTIONS: instrumented
            MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE: system
    use-python: default
    run:
        using: mozharness
        actions: [get-secrets, build]
        script: mozharness/scripts/fx_desktop_build.py
        secrets: true
    use-sccache:
        by-release-level:
            production: false
            staging: true
    fetches:
        toolchain:
            - linux64-sccache

tasks:
    linux-shippable/opt:
        description: "Linux Instrumented"
        index:
            product: firefox
            job-name: instrumented-linux
        shipping-product: firefox
        treeherder:
            platform: linux32-shippable/opt
        worker-type: b-linux-gcp
        run:
            config:
                - builds/releng_base_firefox.py
                - builds/releng_base_linux_32_builds.py
            mozconfig-variant: profile-generate
            tooltool-downloads: public
        run-on-projects: ['release']
        fetches:
            toolchain:
                - linux64-clang
                - linux64-rust
                - linux64-rust-size
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-nasm
                - linux64-node
                - linux64-pkgconf
                - sysroot-i686-linux-gnu
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    linux64-shippable/opt:
        description: "Linux64 Instrumented"
        index:
            product: firefox
            job-name: instrumented-linux64
        shipping-product: firefox
        treeherder:
            platform: linux64-shippable/opt
        worker-type: b-linux-gcp
        run:
            config:
                - builds/releng_base_firefox.py
                - builds/releng_base_linux_64_builds.py
            mozconfig-variant: profile-generate
            tooltool-downloads: public
        run-on-projects: ['release']
        fetches:
            toolchain:
                - linux64-clang
                - linux64-rust
                - linux64-rust-size
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-nasm
                - linux64-node
                - linux64-pkgconf
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    linux64-aarch64-shippable/opt:
        description: "Linux AArch64 (a.k.a. ARM64) Instrumented"
        index:
            product: firefox
            job-name: instrumented-linux64-aarch64
        shipping-product: firefox
        treeherder:
            platform: linux64-aarch64-shippable/opt
        worker-type: b-linux-gcp
        run:
            config:
                - builds/releng_base_firefox.py
                - builds/releng_base_linux_64_builds.py
            mozconfig-variant: profile-generate
            extra-config:
                extra_mozconfig_content:
                    - ac_add_options --target=aarch64
                    - unset MOZ_STDCXX_COMPAT
            tooltool-downloads: public
        run-on-projects: ['mozilla-central']
        fetches:
            toolchain:
                - linux64-clang
                - linux64-rust
                - linux64-rust-size
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-nasm
                - linux64-node
                - linux64-pkgconf
                - sysroot-aarch64-linux-gnu
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    macosx64-shippable/opt:
        description: "MacOS X x64 Cross-compile Instrumented"
        shipping-phase: build
        shipping-product: firefox
        treeherder:
            platform: osx-shippable/opt
        worker-type: b-linux-gcp
        worker:
            max-run-time: 7200
            env:
                PERFHERDER_EXTRA_OPTIONS: instrumented
        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"
            secrets: true
            mozconfig-variant: profile-generate
        run-on-projects: ['release']
        fetches:
            toolchain:
                - linux64-clang
                - linux64-hfsplus
                - linux64-libdmg
                - linux64-rust-macos
                - linux64-rust-size
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-nasm
                - linux64-node
                - macosx64-sdk
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    macosx64-aarch64-shippable/opt:
        description: "MacOS X aarch64 Cross-compile Instrumented"
        shipping-phase: build
        shipping-product: firefox
        treeherder:
            platform: osx-aarch64-shippable/opt
        worker-type: b-linux-gcp
        worker:
            max-run-time: 7200
            env:
                PERFHERDER_EXTRA_OPTIONS: instrumented
        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"
            secrets: true
            mozconfig-variant: profile-generate
            extra-config:
                mozconfig_platform: macosx64-aarch64
        run-on-projects: ['release']
        fetches:
            toolchain:
                - linux64-clang
                - linux64-hfsplus
                - linux64-libdmg
                - linux64-rust-macos
                - linux64-rust-size
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-nasm
                - linux64-node
                - macosx64-sdk
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    android-x86-shippable/opt:
        description: "Android 5.0 x86 PGO instrumented"
        index:
            product: mobile
            job-name: instrumented-android-x86
        shipping-product: fennec
        treeherder:
            platform: android-5-0-x86/pgo
        worker-type: b-linux-gcp
        worker:
            docker-image: {in-tree: android-build}
            env:
                GRADLE_USER_HOME: "/builds/worker/checkouts/gecko/mobile/android/gradle/dotgradle-offline"
                TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
            artifacts:
                - name: public/build
                  path: /builds/worker/artifacts/
                  type: directory
                - name: public/build/geckoview-androidTest.apk
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview/outputs/apk/androidTest/withGeckoBinaries/debug/geckoview-withGeckoBinaries-debug-androidTest.apk
                  type: file
                - name: public/build/geckoview-test_runner.apk
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/test_runner/outputs/apk/withGeckoBinaries/debug/test_runner-withGeckoBinaries-debug.apk
                  type: file
                - name: public/build/geckoview-test_runner.aab
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/test_runner/outputs/bundle/withGeckoBinariesDebug/test_runner-withGeckoBinaries-debug.aab
                  type: file
                - name: public/build/geckoview_example.apk
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview_example/outputs/apk/withGeckoBinaries/debug/geckoview_example-withGeckoBinaries-debug.apk
                  type: file
                - name: public/build/geckoview_example.aab
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview_example/outputs/bundle/withGeckoBinariesDebug/geckoview_example-withGeckoBinaries-debug.aab
                  type: file
        run:
            config:
                - builds/releng_base_android_64_builds.py
            custom-build-variant-cfg: x86-profile-generate
            tooltool-downloads: internal
        run-on-projects: ['release']
        fetches:
            toolchain:
                - android-gradle-dependencies
                - android-ndk-linux
                - android-sdk-linux
                - linux64-jdk
                - linux64-clang
                - linux64-rust-android
                - linux64-rust-size
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-nasm
                - linux64-node
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    android-x86_64-shippable/opt:
        description: "Android 5.0 x86_64 PGO instrumented"
        index:
            product: mobile
            job-name: instrumented-android-x86_64
        shipping-product: fennec
        treeherder:
            platform: android-5-0-x86_64/pgo
        worker-type: b-linux-gcp
        worker:
            docker-image: {in-tree: android-build}
            env:
                GRADLE_USER_HOME: "/builds/worker/checkouts/gecko/mobile/android/gradle/dotgradle-offline"
                TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
            artifacts:
                - name: public/build
                  path: /builds/worker/artifacts/
                  type: directory
                - name: public/build/geckoview-androidTest.apk
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview/outputs/apk/androidTest/withGeckoBinaries/debug/geckoview-withGeckoBinaries-debug-androidTest.apk
                  type: file
                - name: public/build/geckoview-test_runner.apk
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/test_runner/outputs/apk/withGeckoBinaries/debug/test_runner-withGeckoBinaries-debug.apk
                  type: file
                - name: public/build/geckoview-test_runner.aab
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/test_runner/outputs/bundle/withGeckoBinariesDebug/test_runner-withGeckoBinaries-debug.aab
                  type: file
                - name: public/build/geckoview_example.apk
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview_example/outputs/apk/withGeckoBinaries/debug/geckoview_example-withGeckoBinaries-debug.apk
                  type: file
                - name: public/build/geckoview_example.aab
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview_example/outputs/bundle/withGeckoBinariesDebug/geckoview_example-withGeckoBinaries-debug.aab
                  type: file
        run:
            config:
                - builds/releng_base_android_64_builds.py
            custom-build-variant-cfg: x86_64-profile-generate
            tooltool-downloads: internal
        run-on-projects: ['release']
        fetches:
            toolchain:
                - android-gradle-dependencies
                - android-ndk-linux
                - android-sdk-linux
                - linux64-jdk
                - linux64-clang
                - linux64-rust-android
                - linux64-rust-size
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-nasm
                - linux64-node
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    android-aarch64-shippable/opt:
        description: "Android 5.0 AArch64 PGO instrumented"
        index:
            product: mobile
            job-name: instrumented-android-aarch64
        shipping-product: fennec
        treeherder:
            platform: android-5-0-aarch64/pgo
        worker-type: b-linux-gcp
        worker:
            docker-image: {in-tree: android-build}
            env:
                GRADLE_USER_HOME: "/builds/worker/checkouts/gecko/mobile/android/gradle/dotgradle-offline"
                TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
            artifacts:
                - name: public/build
                  path: /builds/worker/artifacts/
                  type: directory
                - name: public/build/geckoview-androidTest.apk
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview/outputs/apk/androidTest/withGeckoBinaries/debug/geckoview-withGeckoBinaries-debug-androidTest.apk
                  type: file
                - name: public/build/geckoview-test_runner.apk
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/test_runner/outputs/apk/withGeckoBinaries/debug/test_runner-withGeckoBinaries-debug.apk
                  type: file
                - name: public/build/geckoview-test_runner.aab
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/test_runner/outputs/bundle/withGeckoBinariesDebug/test_runner-withGeckoBinaries-debug.aab
                  type: file
                - name: public/build/geckoview_example.apk
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview_example/outputs/apk/withGeckoBinaries/debug/geckoview_example-withGeckoBinaries-debug.apk
                  type: file
                - name: public/build/geckoview_example.aab
                  path: /builds/worker/workspace/obj-build/gradle/build/mobile/android/geckoview_example/outputs/bundle/withGeckoBinariesDebug/geckoview_example-withGeckoBinaries-debug.aab
                  type: file
        run:
            config:
                - builds/releng_base_android_64_builds.py
            custom-build-variant-cfg: aarch64-profile-generate
            tooltool-downloads: internal
        run-on-projects: ['release']
        fetches:
            toolchain:
                - android-gradle-dependencies
                - android-ndk-linux
                - android-sdk-linux
                - linux64-jdk
                - linux64-clang
                - linux64-rust-android
                - linux64-rust-size
                - linux64-cbindgen
                - linux64-dump_syms
                - linux64-nasm
                - linux64-node
                - sysroot-x86_64-linux-gnu
                - sysroot-wasm32-wasi

    win32-shippable/opt:
        description: "Win32 Shippable PGO Instrumented"
        index:
            product: firefox
            job-name: instrumented-win32
        shipping-product: firefox
        treeherder:
            platform: windows2012-32-shippable/opt
        worker-type: b-linux-gcp
        run:
            options: [append-env-variables-from-configs]
            mozconfig-variant: profile-generate
            config:
                - builds/releng_base_firefox.py
                - builds/releng_base_linux_64_builds.py
            extra-config:
                stage_platform: win32
                mozconfig_platform: win32
        run-on-projects: ['release']
        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

    win64-nightlyasrelease/opt:
        description: "Win64 Shippable PGO Instrumented"
        index:
            product: firefox
            job-name: instrumented-nightlyasrelease-win64
        shipping-product: firefox
        treeherder:
            platform: win64-nightlyasrelease/opt
        worker-type: b-linux-gcp
        run:
            options: [append-env-variables-from-configs]
            mozconfig-variant: profile-generate
            config:
                - builds/releng_base_firefox.py
                - builds/releng_base_linux_64_builds.py
            extra-config:
                stage_platform: win64
                mozconfig_platform: win64
                extra_mozconfig_content:
                    - ac_add_options --as-milestone=release
        run-on-projects: [trunk-only]
        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

    win64-shippable/opt:
        description: "Win64 Shippable PGO Instrumented"
        index:
            product: firefox
            job-name: instrumented-win64
        shipping-product: firefox
        treeherder:
            platform: windows2012-64-shippable/opt
        worker-type: b-linux-gcp
        run:
            options: [append-env-variables-from-configs]
            mozconfig-variant: profile-generate
            config:
                - builds/releng_base_firefox.py
                - builds/releng_base_linux_64_builds.py
            extra-config:
                stage_platform: win64
                mozconfig_platform: win64
        run-on-projects: ['release']
        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
