# 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/.

# ⚠️ If you add, rename or delete a task here, please also update .mergify.yml! ⚠️
---
loader: app_services_taskgraph.loader.build_config:loader

transforms:
  - app_services_taskgraph.transforms.worker:transforms
  - app_services_taskgraph.transforms.secrets:transforms
  - app_services_taskgraph.transforms.module_build:transforms
  - taskgraph.transforms.run:transforms
  - taskgraph.transforms.task:transforms

kind-dependencies:
  - toolchain

task-defaults:
  attributes:
    run-on-pr-type: full-ci
    resource-monitor: true
  run-on-tasks-for: [github-pull-request, github-push, cron]
  description: "{module_name} - Build and test"
  scopes:
    - project:releng:services/tooltool/api/download/internal
  worker-type: b-linux
  worker:
    chain-of-trust: true
    max-run-time: 1800
    env: {}
  run:
    pre-gradlew:
      - [source, taskcluster/scripts/toolchain/setup-fetched-rust-toolchain.sh]
      - [source, taskcluster/scripts/toolchain/cross-compile-setup.sh]
      - [source, taskcluster/scripts/toolchain/copy-libs-dir.sh, libs]
      - [bash, '-c', 'echo "rust.targets=arm,arm64,x86_64,x86,darwin,linux-x86-64\n" > local.properties']
    gradlew:
      - ':{module_name}:assembleRelease'
      - ':{module_name}:publish'
      - ':{module_name}:checkMavenArtifacts'
    dummy-secrets:
        by-level:
            '3': []
            default:
                - content: "faketoken"
                  path: .symbols_upload_token
    secrets:
        by-level:
            '3':
                - name: project/application-services/symbols-token
                  key: token
                  path: .symbols_upload_token
            default: []
    using: gradlew
    use-caches: true

  fetches:
    toolchain:
      - android-libs
      - desktop-linux-libs
      - desktop-macos-libs
      - rust
