-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Since Fuchsia engineers rarely work within this repo, initialize a lightweight fake @fuchsia_sdk repo rather than distributing the Fuchsia SDK here. Tested locally via `bazel query --[no]enable_bzlmod "deps(set(//googletest/test:gtest_all_test))"` (#4472) PiperOrigin-RevId: 610826859 Change-Id: I7d41b1dbe9e7f133fe535d7337dc5bff5bf97d3a
- Loading branch information
1 parent
814ba36
commit 3b6d48e
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Provides a fake @fuchsia_sdk implementation that's used when the real one isn't available. | ||
This is needed since bazel queries on targets that depend on //:gtest (eg: | ||
`bazel query "deps(set(//googletest/test:gtest_all_test))"`) will fail if @fuchsia_sdk is not | ||
defined when bazel is evaluating the transitive closure of the query target. | ||
See https://github.com/google/googletest/issues/4472. | ||
""" | ||
|
||
def _fake_fuchsia_sdk_impl(repo_ctx): | ||
for stub_target in repo_ctx.attr._stub_build_targets: | ||
stub_package = stub_target | ||
stub_target_name = stub_target.split("/")[-1] | ||
repo_ctx.file("%s/BUILD.bazel" % stub_package, """ | ||
filegroup( | ||
name = "%s", | ||
) | ||
""" % stub_target_name) | ||
|
||
fake_fuchsia_sdk = repository_rule( | ||
doc = "Used to create a fake @fuchsia_sdk repository with stub build targets.", | ||
implementation = _fake_fuchsia_sdk_impl, | ||
attrs = { | ||
"_stub_build_targets": attr.string_list( | ||
doc = "The stub build targets to initialize.", | ||
default = [ | ||
"pkg/fdio", | ||
"pkg/syslog", | ||
"pkg/zx", | ||
], | ||
), | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters