Skip to main content
Glama
defs.bzl2.16 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//:native.bzl", _native = "native") def xcode_command_alias(name, xcode_version = None, xcode_product_build = None, **kwargs): xcode_version_specified = xcode_version and len(xcode_version) > 0 xcode_product_build_specified = xcode_product_build and len(xcode_product_build) > 0 if not xcode_version_specified and not xcode_product_build_specified: fail("Must specify either Xcode version or Xcode product build") if xcode_version_specified and xcode_product_build_specified: fail("Must specify only one of Xcode version or Xcode product build but not both") version_args = ["-n", xcode_version] if xcode_version_specified else ["-b", xcode_product_build] original_args = kwargs.pop("args", []) all_args = version_args + original_args env = kwargs.pop("env", {}) xcode_cache_seed = read_root_config("apple", "xcode_cache_seed", None) if xcode_cache_seed: # It's possible that Mac RE does not distinguish between Xcode versions, # in which case we can reset the caches by setting a unique env var. # Since the env var is part of the cache key, that means that any actions # depending on selected Xcode will get recomputed. env["BUCK2_XCODE_CACHE_SEED"] = xcode_cache_seed # This setup means that all `xcode_command_alias()` would effectively become: # xcode_version_checker VERSION ORIGINAL_COMMAND ORIGINAL_COMMAND_ARGS # `xcode_version_checker` will check the currently selected Xcode and # if it matches, it will then execute `ORIGINAL_COMMAND` # passing `ORIGINAL_COMMAND_ARGS`. _native.command_alias( name = name, exe = "prelude//toolchains/apple/xcode_version_checker:xcode_version_checker", args = all_args, env = env, visibility = ["PUBLIC"], **kwargs )

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