Vendor dependencies
Let's see how I like this workflow.
This commit is contained in:
parent
34d1830413
commit
9c435dc440
7500 changed files with 1665121 additions and 99 deletions
30
vendor/cxx/tools/buck/prelude/go/packages.bzl
vendored
Normal file
30
vendor/cxx/tools/buck/prelude/go/packages.bzl
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# 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//utils:utils.bzl", "value_or")
|
||||
|
||||
def go_attr_pkg_name(ctx: "context") -> str.type:
|
||||
"""
|
||||
Return the Go package name for the given context corresponing to a rule.
|
||||
"""
|
||||
return value_or(ctx.attrs.package_name, ctx.label.package)
|
||||
|
||||
def merge_pkgs(pkgss: [{str.type: "artifact"}]) -> {str.type: "artifact"}:
|
||||
"""
|
||||
Merge mappings of packages into a single mapping, throwing an error on
|
||||
conflicts.
|
||||
"""
|
||||
|
||||
all_pkgs = {}
|
||||
|
||||
for pkgs in pkgss:
|
||||
for name, path in pkgs.items():
|
||||
if name in pkgs and pkgs[name] != path:
|
||||
fail("conflict for package {!r}: {} and {}".format(name, path, all_pkgs[name]))
|
||||
all_pkgs[name] = path
|
||||
|
||||
return all_pkgs
|
||||
Loading…
Add table
Add a link
Reference in a new issue