Skip to main content
Glama
xcode.bzl2.21 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//cxx:argsfiles.bzl", "CompileArgsfile", # @unused Used as a type ) load( "@prelude//cxx:cxx_sources.bzl", "CxxSrcWithFlags", # @unused Used as a type ) load("@prelude//ide_integrations/xcode:data.bzl", "XcodeDataInfoKeys") def cxx_populate_xcode_attributes( ctx, srcs: list[CxxSrcWithFlags], argsfiles: dict[str, CompileArgsfile], product_name: str) -> dict[str, typing.Any]: converted_srcs = {} for src in srcs: file_properties = _get_artifact_owner(src.file) if src.flags: # List of resolved_macros will encode as: # [['\"-some-flag\"'], ['\"-another-flag\"']] # # Convert it to a string and rip-out the quotes # so it appears as ["-some-flag", "-another-flag"] file_properties["flags"] = [str(flag).replace('\"', "") for flag in src.flags] converted_srcs[src.file] = file_properties data = { XcodeDataInfoKeys.ARGSFILES_BY_EXT: { ext: argsfile.file for ext, argsfile in argsfiles.items() }, XcodeDataInfoKeys.HEADERS: _get_artifacts_with_owners(ctx.attrs.headers), XcodeDataInfoKeys.PRODUCT_NAME: product_name, XcodeDataInfoKeys.SRCS: converted_srcs, } if hasattr(ctx.attrs, "exported_headers"): data[XcodeDataInfoKeys.EXPORTED_HEADERS] = _get_artifacts_with_owners(ctx.attrs.exported_headers) return data def _get_artifacts_with_owners(files: typing.Any) -> dict[Artifact, dict[str, Label]]: if type(files) == "dict": return {artifact: _get_artifact_owner(artifact) for _, artifact in files.items()} else: return {file: _get_artifact_owner(file) for file in files} def _get_artifact_owner(file: Artifact) -> dict[str, Label]: if file.owner: return {"target": file.owner} else: return {}

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