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

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

kind-dependencies:
  - toolchain

tasks:
  pr:
    attributes:
      run-on-pr-type: all
      resource-monitor: true
    needs-sccache: false # TODO: Bug 1623426 deal with this once we're in prod
    run-on-tasks-for: [github-pull-request, cron]
    description: Build and test (Android - linux-x86-64)
    scopes:
      - project:releng:services/tooltool/api/download/internal
    worker-type: b-linux
    worker:
      max-run-time: 1800
      env: {}
    run:
      pre-gradlew:
        - [git, submodule, update, --init]
        - [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=linux-x86-64\n" > local.properties']
      gradlew:
        - 'clean'
        - 'assembleDebug'
        - 'testDebug'
      using: gradlew
      use-caches: true

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