# 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-docker-amd
    worker:
        max-run-time: 1800
    use-python: "3.11"
    attributes:
        local-toolchain: true
    run:
        script: build-onnxruntime.sh
    fetches:
        fetch:
            - onnxruntime-src
            - onnxruntime-deps


onnxruntime-x86_64-linux-gnu:
    description: "ONNX Runtime (linux x64)"
    treeherder:
        symbol: TL(onnx)
    run:
        arguments:
            - "Linux"
            - "x64"
        toolchain-artifact: public/build/onnxruntime-x86_64-linux-gnu.tar.zst
    fetches:
        toolchain:
            - linux64-clang-toolchain

# onnxruntime-i686-linux-gnu: requires more work upstream
# onnxruntime-aarch64-linux-gnu: requires more work upstream

onnxruntime-x86_64-windows-msvc:
    description: "ONNX Runtime (win64 x64)"
    worker-type: b-win2022
    worker:
        max-run-time: 7200
    treeherder:
        symbol: TW64(onnx)
    run:
        arguments:
            - "Windows"
        toolchain-artifact: public/build/onnxruntime-x86_64-windows-msvc.tar.zst
    fetches:
        toolchain:
            - win64-cmake
            - win64-clang
            - vs-toolchain
        fetch:
            - win64-ninja


onnxruntime-i686-windows-msvc:
    description: "ONNX Runtime (win32 x86)"
    worker-type: b-win2022
    worker:
        max-run-time: 7200
    treeherder:
        symbol: TW32(onnx)
    run:
        arguments:
            - "Windows"
            - "x86"
        toolchain-artifact: public/build/onnxruntime-i686-windows-msvc.tar.zst
    fetches:
        toolchain:
            - win64-cmake
            - win64-clang
            - vs-toolchain
        fetch:
            - win64-ninja


# onnxruntime-aarch64-windows-msvc: requires more work upstream

onnxruntime-x86_64-apple-darwin:
    description: "ONNX Runtime (macOS x64)"
    worker-type: b-osx-1015
    treeherder:
        symbol: TM(onnx)
    run:
        arguments:
            - "Darwin"
            - "x86_64"
        toolchain-artifact: public/build/onnxruntime-x86_64-apple-darwin.tar.zst
    fetches:
        toolchain:
            - macosx64-clang-toolchain
            - macosx64-sdk-toolchain
        fetch:
            - macosx64-cmake
            - macosx64-ninja


onnxruntime-aarch64-apple-darwin:
    description: "ONNX Runtime (macOS aarch64)"
    worker-type: b-osx-1015
    treeherder:
        symbol: TMA64(onnx)
    run:
        arguments:
            - "Darwin"
            - "arm64"
        toolchain-artifact: public/build/onnxruntime-aarch64-apple-darwin.tar.zst
    fetches:
        toolchain:
            - macosx64-clang-toolchain
            - macosx64-sdk-toolchain
        fetch:
            - macosx64-cmake
            - macosx64-ninja


onnxruntime-arm-linux-androideabi:
    description: "ONNX Runtime (android arm)"
    treeherder:
        symbol: TL(onnx-android-arm)
    run:
        arguments:
            - "Android"
            - "armeabi-v7a"
        toolchain-artifact: public/build/onnxruntime-arm-linux-androideabi.tar.zst
    fetches:
        toolchain:
            - linux64-clang-toolchain
            - android-ndk-linux
            - android-sdk-linux

onnxruntime-aarch64-linux-android:
    description: "ONNX Runtime (android aarch64)"
    treeherder:
        symbol: TL(onnx-android-aarch64)
    run:
        arguments:
            - "Android"
            - "arm64-v8a"
        toolchain-artifact: public/build/onnxruntime-aarch64-linux-android.tar.zst
    fetches:
        toolchain:
            - linux64-clang-toolchain
            - android-ndk-linux
            - android-sdk-linux

onnxruntime-x86_64-linux-android:
    description: "ONNX Runtime (android x64)"
    treeherder:
        symbol: TL(onnx-android-x64)
    run:
        arguments:
            - "Android"
            - "x86_64"
        toolchain-artifact: public/build/onnxruntime-x86_64-linux-android.tar.zst
    fetches:
        toolchain:
            - linux64-clang-toolchain
            - android-ndk-linux
            - android-sdk-linux
