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
29
vendor/cxx/tools/buck/prelude/user/all.bzl
vendored
Normal file
29
vendor/cxx/tools/buck/prelude/user/all.bzl
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# 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//apple/user:apple_resource_bundle.bzl", _apple_resource_bundle_spec = "registration_spec")
|
||||
load("@prelude//apple/user:apple_toolchain_override.bzl", _apple_toolchain_override_spec = "registration_spec")
|
||||
load("@prelude//apple/user:apple_tools.bzl", _apple_tools_spec = "registration_spec")
|
||||
load("@prelude//apple/user:apple_watchos_bundle.bzl", _apple_watchos_bundle_spec = "registration_spec")
|
||||
load("@prelude//apple/user:resource_group_map.bzl", _resource_group_map_spec = "registration_spec")
|
||||
load("@prelude//cxx/user:link_group_map.bzl", _link_group_map_spec = "registration_spec")
|
||||
load(":extract_archive.bzl", _extract_archive_spec = "registration_spec")
|
||||
|
||||
_all_specs = [
|
||||
_extract_archive_spec,
|
||||
_apple_tools_spec,
|
||||
_apple_resource_bundle_spec,
|
||||
_link_group_map_spec,
|
||||
_resource_group_map_spec,
|
||||
_apple_watchos_bundle_spec,
|
||||
_apple_toolchain_override_spec,
|
||||
]
|
||||
|
||||
rules = {s.name: rule(impl = s.impl, attrs = s.attrs, **{k: v for k, v in {"cfg": s.cfg}.items() if v != None}) for s in _all_specs}
|
||||
|
||||
# The rules are accessed by doing module.name, so we have to put them on the correct module.
|
||||
load_symbols(rules)
|
||||
42
vendor/cxx/tools/buck/prelude/user/extract_archive.bzl
vendored
Normal file
42
vendor/cxx/tools/buck/prelude/user/extract_archive.bzl
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# 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")
|
||||
load(":rule_spec.bzl", "RuleRegistrationSpec")
|
||||
|
||||
# Buck v2 doesn't support directories as source inputs, while v1 allows that.
|
||||
# This rule fills that gap and allows to produce a directory from archive,
|
||||
# which then can be used as an input for other rules.
|
||||
|
||||
def _impl(ctx: "context") -> ["provider"]:
|
||||
output = ctx.actions.declare_output(value_or(ctx.attrs.directory_name, ctx.label.name))
|
||||
archive = ctx.attrs.contents_archive
|
||||
script, _ = ctx.actions.write(
|
||||
"unpack.sh",
|
||||
[
|
||||
cmd_args(output, format = "mkdir -p {}"),
|
||||
cmd_args(output, format = "cd {}"),
|
||||
cmd_args(archive, format = "tar -xzf {}").relative_to(output),
|
||||
],
|
||||
is_executable = True,
|
||||
allow_args = True,
|
||||
)
|
||||
ctx.actions.run(cmd_args(["/bin/sh", script])
|
||||
.hidden([archive, output.as_output()]), category = "extract_archive")
|
||||
|
||||
return [DefaultInfo(default_outputs = [output])]
|
||||
|
||||
registration_spec = RuleRegistrationSpec(
|
||||
name = "extract_archive",
|
||||
impl = _impl,
|
||||
attrs = {
|
||||
# .tar.gz archive with the contents of the result directory
|
||||
"contents_archive": attrs.source(),
|
||||
# name of the result directory, if omitted, `name` attribute will be used instead
|
||||
"directory_name": attrs.option(attrs.string()),
|
||||
},
|
||||
)
|
||||
13
vendor/cxx/tools/buck/prelude/user/rule_spec.bzl
vendored
Normal file
13
vendor/cxx/tools/buck/prelude/user/rule_spec.bzl
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# 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.
|
||||
|
||||
RuleRegistrationSpec = record(
|
||||
name = field(str.type),
|
||||
impl = field("function"),
|
||||
attrs = field({str.type: "attribute"}),
|
||||
cfg = field([None, "transition"], None),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue