Skip to main content
Glama
rust.bzl3.5 kB
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under both the MIT license found in the # LICENSE-MIT file in the root directory of this source tree and the Apache # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. load("@prelude//rust:rust_toolchain.bzl", "PanicRuntime", "RustToolchainInfo") _DEFAULT_TRIPLE = select({ "config//os:linux": select({ "config//cpu:arm64": "aarch64-unknown-linux-gnu", "config//cpu:x86_64": "x86_64-unknown-linux-gnu", }), "config//os:macos": select({ "config//cpu:arm64": "aarch64-apple-darwin", "config//cpu:x86_64": "x86_64-apple-darwin", }), "config//os:windows": select({ "config//cpu:arm64": select({ # Rustup's default ABI for the host on Windows is MSVC, not GNU. # When you do `rustup install stable` that's the one you get. It # makes you opt in to GNU by `rustup install stable-gnu`. "DEFAULT": "aarch64-pc-windows-msvc", "config//abi:gnu": "aarch64-pc-windows-gnu", "config//abi:msvc": "aarch64-pc-windows-msvc", }), "config//cpu:x86_64": select({ "DEFAULT": "x86_64-pc-windows-msvc", "config//abi:gnu": "x86_64-pc-windows-gnu", "config//abi:msvc": "x86_64-pc-windows-msvc", }), }), }) def _system_rust_toolchain_impl(ctx): return [ DefaultInfo(), RustToolchainInfo( allow_lints = ctx.attrs.allow_lints, clippy_driver = RunInfo(args = ["clippy-driver"]), clippy_toml = ctx.attrs.clippy_toml[DefaultInfo].default_outputs[0] if ctx.attrs.clippy_toml else None, compiler = RunInfo(args = ["rustc"]), default_edition = ctx.attrs.default_edition, panic_runtime = PanicRuntime("unwind"), deny_lints = ctx.attrs.deny_lints, doctests = ctx.attrs.doctests, nightly_features = ctx.attrs.nightly_features, report_unused_deps = ctx.attrs.report_unused_deps, rustc_binary_flags = ctx.attrs.rustc_binary_flags, rustc_flags = ctx.attrs.rustc_flags, rustc_target_triple = ctx.attrs.rustc_target_triple, rustc_test_flags = ctx.attrs.rustc_test_flags, rustdoc = RunInfo(args = ["rustdoc"]), rustdoc_flags = ctx.attrs.rustdoc_flags, warn_lints = ctx.attrs.warn_lints, ), ] system_rust_toolchain = rule( impl = _system_rust_toolchain_impl, attrs = { "allow_lints": attrs.list(attrs.string(), default = []), "clippy_toml": attrs.option(attrs.dep(providers = [DefaultInfo]), default = None), "default_edition": attrs.option(attrs.string(), default = None), "deny_lints": attrs.list(attrs.string(), default = []), "doctests": attrs.bool(default = False), "nightly_features": attrs.bool(default = False), "report_unused_deps": attrs.bool(default = False), "rustc_binary_flags": attrs.list(attrs.arg(), default = []), "rustc_flags": attrs.list(attrs.arg(), default = []), "rustc_target_triple": attrs.string(default = _DEFAULT_TRIPLE), "rustc_test_flags": attrs.list(attrs.arg(), default = []), "rustdoc_flags": attrs.list(attrs.arg(), default = []), "warn_lints": attrs.list(attrs.string(), default = []), }, is_toolchain_rule = True, )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server