PACKAGE

load("@prelude//rust:cargo_package.bzl", "set_reindeer_platforms")

# Which platform a configuration is, by the names buck/cargo/crates.bzl keys
# cargo's plans by, which is how the third-party rules in third-party/rust pick
# their features and dependencies. This is the prelude's own map with one
# addition: wasi-guest, the plugins, which is the same triple as wasi and
# differs only by the constraint buck/constraints says why exists.
set_reindeer_platforms(
    select({
        "DEFAULT": None,
        "prelude//os:android": select({
            "DEFAULT": None,
            "prelude//cpu:arm64": "android-arm64",
        }),
        "prelude//os:linux": select({
            "DEFAULT": None,
            "prelude//cpu:arm64": "linux-arm64",
            "prelude//cpu:x86_64": "linux-x86_64",
        }),
        "prelude//os:macos": select({
            "DEFAULT": None,
            "prelude//cpu:arm64": "macos-arm64",
            "prelude//cpu:x86_64": "macos-x86_64",
        }),
        "prelude//os:none": select({
            "DEFAULT": None,
            "prelude//cpu:wasm32": "wasm32",
        }),
        "prelude//os:wasi": select({
            "DEFAULT": None,
            "prelude//cpu:wasm32": select({
                "DEFAULT": "wasi",
                "root//buck/constraints:guest": "wasi-guest",
            }),
        }),
        "prelude//os:windows": select({
            "DEFAULT": None,
            "prelude//cpu:arm64": "windows-arm64",
            "prelude//cpu:x86_64": "windows-x86_64",
        }),
    })
)