-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hermetic `git` rules. `.git` object are fetched and all other actions are performed at execution time.
- Loading branch information
1 parent
8c4240e
commit cebcbfd
Showing
4 changed files
with
121 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
module( | ||
name = "rules_git", | ||
version = "1.0.0-alpha.2", | ||
bazel_compatibility = [ | ||
">=7.1.0", | ||
], | ||
compatibility_level = 1, | ||
) | ||
|
||
bazel_dep(name = "bazel_skylib", version = "1.5.0") | ||
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.9") | ||
bazel_dep(name = "download_utils", version = "1.0.0-beta.2") | ||
bazel_dep(name = "rules_coreutils", version = "1.0.0-beta.1") | ||
|
||
download_file = use_repo_rule("@download_utils//download/file:defs.bzl", "download_file") | ||
|
||
[ | ||
download_file( | ||
name = binary.removesuffix(".exe"), | ||
build = "//bazel-git:BUILD.tmpl.bazel", | ||
executable = True, | ||
integrity = integrity, | ||
links = { | ||
binary: "entrypoint", | ||
"entrypoint": "git", | ||
}, | ||
output = binary, | ||
urls = ["https://gitlab.arm.com/api/v4/projects/bazel%2Fgit/packages/generic/release/1.0.0-alpha.8/{}".format(binary)], | ||
) | ||
for binary, integrity in ( | ||
("amd64-linux-bazel-git", "sha256-krzgELhKTt+I/Wg6Vi9T+gfF1vQnRHtx61tlNmXgUAw="), | ||
("arm64-linux-bazel-git", "sha256-JgRhWkcfh72AaR0aBV/M+Bf8CL/cYrtzwcObkqx4hEs="), | ||
("amd64-darwin-bazel-git", "sha256-6audwdUyig0itmhkawBROxLdFYMog6nCkjFhPZSOTFg="), | ||
("arm64-darwin-bazel-git", "sha256-nb3pJ+ZD8xMBjUCgJ5WP52ZqtKhcuUh1kDXvHnrqBL0="), | ||
("amd64-windows-bazel-git.exe", "sha256-MI9lEjEg0kKbJhMidX9nbQY/xEmVdQ2KVnsyrR7ifbY="), | ||
("arm64-windows-bazel-git.exe", "sha256-rPFzGUiXlO2SHnw5k4/CR+sFJQt3xptUOAKIlVuh24Q="), | ||
) | ||
] | ||
|
||
which = use_repo_rule("@toolchain_utils//toolchain/local/which:defs.bzl", "toolchain_local_which") | ||
|
||
[ | ||
which( | ||
name = "which-{}".format(tool), | ||
basename = "git", | ||
) | ||
for tool in ("git", "bazel-git") | ||
] | ||
|
||
resolved = use_repo_rule("@toolchain_utils//toolchain/resolved:defs.bzl", "toolchain_resolved") | ||
|
||
resolved( | ||
name = "resolved-git", | ||
toolchain_type = "//git/toolchain/git:type", | ||
) | ||
|
||
register_toolchains("//git/toolchain/...") | ||
|
||
select = use_repo_rule("@toolchain_utils//toolchain/local/select:defs.bzl", "toolchain_local_select") | ||
|
||
select( | ||
name = "git", | ||
map = { | ||
couplet: "@{}-bazel-git".format(couplet) | ||
for couplet in ( | ||
"amd64-linux", | ||
"arm64-linux", | ||
"amd64-darwin", | ||
"arm64-darwin", | ||
"amd64-windows", | ||
"arm64-windows", | ||
) | ||
} | { | ||
"//conditions:default": "@which-bazel-git", | ||
}, | ||
) |
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,24 @@ | ||
bcr_test_module: | ||
module_path: e2e | ||
matrix: | ||
bazel: | ||
# TODO: need https://github.com/bazelbuild/bazel/issues/22151#issuecomment-2183467522 | ||
- 7.2.1rc2 | ||
platform: | ||
- centos7_java11_devtoolset10 | ||
- debian10 | ||
- debian11 | ||
- ubuntu2004 | ||
- ubuntu2204 | ||
- fedora39 | ||
- macos | ||
- macos_arm64 | ||
# TODO: no support, yet | ||
# - windows | ||
tasks: | ||
e2e_tests: | ||
name: Run end-to-end Tests | ||
bazel: ${{ bazel }} | ||
platform: ${{ platform }} | ||
test_targets: | ||
- "//..." |
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 @@ | ||
{ | ||
"url": "https://gitlab.arm.com/bazel/rules_git/-/releases/v1.0.0-alpha.2/downloads/src.tar.gz", | ||
"integrity": "sha512-iP/3l8Nh+02H/hRNppxoM/egm/sOAwhQ35hhrWJ1owxcC+Lk407DtR8isVwuKKwi0xSQyf8Xr+41TxN4wGx8qw==", | ||
"strip_prefix": "rules_git-v1.0.0-alpha.2" | ||
} |
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,16 @@ | ||
{ | ||
"homepage": "https://gitlab.arm.com/bazel/rules_git", | ||
"repository": [ | ||
"https://gitlab.arm.com/bazel/rules_git" | ||
], | ||
"versions": [ | ||
"1.0.0-alpha.2" | ||
], | ||
"maintainers": [ | ||
{ | ||
"email": "[email protected]", | ||
"name": "Matt Clarkson", | ||
"github": "mattyclarkson" | ||
} | ||
] | ||
} |