forked from bazel-contrib/rules_bazel_integration_test
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: implement hub-and-spoke for bazel binary downloads (bazel-cont…
…rib#128) - Add `.bcr` folder with requisite files. - Generate hub repository to aid in the resolution of the Bazel binary repositories. - Add `workspace_bazel_binaries` rule to allow repositories that use `rules_bazel_integration_test` to work with and without bzlmod enabled. Inspired by bazel-contrib/bazel-gazelle#1423. Related to bazel-contrib#125.
- Loading branch information
Showing
18 changed files
with
251 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fixedReleaser: | ||
login: cgrindel | ||
email: [email protected] |
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,15 @@ | ||
{ | ||
"homepage": "https://github.com/bazel-contrib/rules_bazel_integration_test", | ||
"maintainers": [ | ||
{ | ||
"email": "[email protected]", | ||
"github": "cgrindel", | ||
"name": "Chuck Grindel" | ||
} | ||
], | ||
"repository": [ | ||
"github:bazel-contrib/rules_bazel_integration_test" | ||
], | ||
"versions": [], | ||
"yanked_versions": {} | ||
} |
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,10 @@ | ||
bcr_test_module: | ||
module_path: "" | ||
matrix: | ||
platform: ["macos", "ubuntu2004"] | ||
tasks: | ||
run_tests: | ||
name: "Run test module" | ||
platform: ${{ platform }} | ||
test_targets: | ||
- "//examples:simple_test" |
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,5 @@ | ||
{ | ||
"integrity": "", | ||
"strip_prefix": "", | ||
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_bazel_integration_test.{TAG}.tar.gz" | ||
} |
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
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,31 @@ | ||
"""Module for resolving repository names for Bazel binaries.""" | ||
|
||
load("//bazel_integration_test/private:no_deps_utils.bzl", "no_deps_utils") | ||
|
||
def _repo_name(version_to_repo_name, version): | ||
if len(version_to_repo_name) == 0: | ||
# Fallback to original behavior. | ||
return no_deps_utils.bazel_binary_repo_name(version) | ||
if no_deps_utils.is_version_file(version): | ||
if not version.startswith("@"): | ||
version = "@@{}".format(version) | ||
version_str = str(Label(version)) | ||
else: | ||
version_str = version | ||
repo_name = version_to_repo_name.get(version_str, None) | ||
if repo_name == None: | ||
fail("""\ | ||
Failed to find a Bazel binary registered for version '{version}' ({version_str}).\ | ||
""".format( | ||
version = version, | ||
version_str = version_str, | ||
)) | ||
return repo_name | ||
|
||
def _label(version_to_repo_name, version, canonicalize): | ||
repo_name = _repo_name(version_to_repo_name, version) | ||
return canonicalize(no_deps_utils.bazel_binary_label(repo_name)) | ||
|
||
bazel_binary_utils = struct( | ||
label = _label, | ||
) |
30 changes: 30 additions & 0 deletions
30
bazel_integration_test/bzlmod/workspace_bazel_binaries.bzl
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,30 @@ | ||
"""Implementation for `workspace_bazel_binaries`.""" | ||
|
||
_BAZEL_BINARIES_HELPER_DEFS_BZL = """load("@{rbt_repo_name}//bazel_integration_test/private:integration_test_utils.bzl", "integration_test_utils") | ||
bazel_binaries = struct( | ||
label = integration_test_utils.bazel_binary_label, | ||
) | ||
""" | ||
|
||
def _workspace_bazel_binaries_impl(repository_ctx): | ||
repository_ctx.file("defs.bzl", _BAZEL_BINARIES_HELPER_DEFS_BZL.format( | ||
rbt_repo_name = repository_ctx.attr.rbt_repo_name, | ||
)) | ||
repository_ctx.file("WORKSPACE") | ||
repository_ctx.file("BUILD.bazel") | ||
|
||
workspace_bazel_binaries = repository_rule( | ||
implementation = _workspace_bazel_binaries_impl, | ||
attrs = { | ||
"rbt_repo_name": attr.string( | ||
doc = "The name of the rules_bazel_integration_test repo.", | ||
default = "rules_bazel_integration_test", | ||
), | ||
}, | ||
doc = """\ | ||
Provides a default implementation for a `bazel_binaries` repository. This is \ | ||
only necessary for repositories that switch back and forth between WORKSPACE \ | ||
repositories and bzlmod repositories.\ | ||
""", | ||
) |
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
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
Oops, something went wrong.