Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bazel/rules_download
1 result
Show changes
Commits on Source (3)
# [1.0.0-alpha.7](https://git.gitlab.arm.com/bazel/rules_download/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2024-01-23)
### Code Refactoring
- change `symlinks` to `links` ([717151d](https://git.gitlab.arm.com/bazel/rules_download/commit/717151db48f33d87f2e007f3521254952c980dee))
### BREAKING CHANGES
- `symlinks` in the rule is now `links`
```diff
download_archive(
- symlinks = {
+ links = {
"abc.txt": "def.txt",
}
)
```
# [1.0.0-alpha.6](https://git.gitlab.arm.com/bazel/rules_download/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2024-01-23)
### Bug Fixes
......
module(
name = "rules_download",
version = "1.0.0-alpha.6",
version = "1.0.0-alpha.7",
bazel_compatibility = [
">=7.0.0",
],
......
......@@ -37,7 +37,7 @@ download_deb(
"some-script.sh",
],
},
symlinks = {
links = {
"etc/test/fixture.txt": "fixture.txt",
},
tools = [
......@@ -70,9 +70,9 @@ Hermetic commands can be ran against the unpacked repository. Hermetic binaries
By default, the `BUILD.bazel` file exports all files downloaded. This can be controlled with the `srcs` attribute to
customise the files that are exposed to the Bazel build.
### Symlinks
### Links
Symlinks can be created in the download repositories by providing the `symlinks` map of target files to link names.
Symlinks/hardlinks can be created in the download repositories by providing the `links` map of target files to link names.
[sri]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
[commands]: lib/commands.bzl
......
......@@ -2,14 +2,14 @@ load("//lib:commands.bzl", "commands", _COMMANDS = "ATTRS")
load("//lib:download_and_extract.bzl", "download_and_extract", _DOWNLOAD_AND_EXTRACT = "ATTRS")
load("//lib:patch.bzl", "patch", _PATCH = "ATTRS")
load("//lib:build.bzl", "build", _BUILD = "ATTRS")
load("//lib:symlinks.bzl", "symlinks", _SYMLINKS = "ATTRS")
load("//lib:links.bzl", "links", _LINKS = "ATTRS")
visibility("//download/...")
DOC = """
"""
ATTRS = _COMMANDS | _DOWNLOAD_AND_EXTRACT | _PATCH | _BUILD | _SYMLINKS
ATTRS = _COMMANDS | _DOWNLOAD_AND_EXTRACT | _PATCH | _BUILD | _LINKS
def implementation(rctx):
canonical = {a: getattr(rctx.attr, a) for a in ATTRS} | {"name": rctx.name}
......@@ -17,7 +17,7 @@ def implementation(rctx):
canonical |= download_and_extract(rctx)
canonical |= build(rctx)
canonical |= patch(rctx)
canonical |= symlinks(rctx)
canonical |= links(rctx)
canonical |= commands(rctx)
return canonical
......
......@@ -2,14 +2,14 @@ load("//lib:commands.bzl", "commands", _COMMANDS = "ATTRS")
load("//lib:download_and_extract.bzl", "download_and_extract", _DOWNLOAD_AND_EXTRACT = "ATTRS")
load("//lib:patch.bzl", "patch", _PATCH = "ATTRS")
load("//lib:build.bzl", "build", _BUILD = "ATTRS")
load("//lib:symlinks.bzl", "symlinks", _SYMLINKS = "ATTRS")
load("//lib:links.bzl", "links", _LINKS = "ATTRS")
visibility("//download/...")
DOC = """
"""
ATTRS = _COMMANDS | _DOWNLOAD_AND_EXTRACT | _PATCH | _BUILD | _SYMLINKS
ATTRS = _COMMANDS | _DOWNLOAD_AND_EXTRACT | _PATCH | _BUILD | _LINKS
def implementation(rctx):
canonical = {a: getattr(rctx.attr, a) for a in ATTRS} | {"name": rctx.name}
......@@ -17,7 +17,7 @@ def implementation(rctx):
canonical |= download_and_extract(rctx, nested = ("data.tar.xz", "data.tar.zst"))
canonical |= build(rctx)
canonical |= patch(rctx)
canonical |= symlinks(rctx)
canonical |= links(rctx)
canonical |= commands(rctx)
return canonical
......
......@@ -2,14 +2,14 @@ load("//lib:commands.bzl", "commands", _COMMANDS = "ATTRS")
load("//lib:download.bzl", "download", _DOWNLOAD = "ATTRS")
load("//lib:patch.bzl", "patch", _PATCH = "ATTRS")
load("//lib:build.bzl", "build", _BUILD = "ATTRS")
load("//lib:symlinks.bzl", "symlinks", _SYMLINKS = "ATTRS")
load("//lib:links.bzl", "links", _LINKS = "ATTRS")
visibility("//download/...")
DOC = """
"""
ATTRS = _COMMANDS | _DOWNLOAD | _PATCH | _BUILD | _SYMLINKS | {
ATTRS = _COMMANDS | _DOWNLOAD | _PATCH | _BUILD | _LINKS | {
"build": attr.label(
doc = "The template for the `BUILD.bazel` file.",
default = ":BUILD.tmpl.bazel",
......@@ -22,7 +22,7 @@ def implementation(rctx):
canonical |= download(rctx)
canonical |= build(rctx)
canonical |= patch(rctx)
canonical |= symlinks(rctx)
canonical |= links(rctx)
canonical |= commands(rctx)
return canonical
......
......@@ -55,7 +55,7 @@ deb(
patches = [
"//deb:fixture.patch",
],
symlinks = {
links = {
"etc/test/fixture.txt": "symlink.txt",
},
urls = ["file://%workspace%/test_1.0-1_all.deb"],
......@@ -82,7 +82,7 @@ archive(
build = "//coreutils:BUILD.tmpl.bazel",
integrity = "sha256-MnwdLPwZ+S5/cYPRym8lhcyvazAuhzJaZCmBLAW5+80=",
strip_prefix = "coreutils-0.0.21-x86_64-pc-windows-msvc",
symlinks = {
links = {
"coreutils.exe": "coreutils",
},
tools = ["//coreutils:mklink.bat"],
......
{
"lockFileVersion": 3,
"moduleFileHash": "b7f83509950913cf5231555d0a1398de5d5e16b5b1044e783c9f76c756c60a24",
"moduleFileHash": "0533944227c9e78895ffa19d40d3bade33a75627e82a976a1659031e143ffed9",
"flags": {
"cmdRegistries": [
"https://bcr.bazel.build/"
......@@ -103,7 +103,7 @@
"patches": [
"//deb:fixture.patch"
],
"symlinks": {
"links": {
"etc/test/fixture.txt": "symlink.txt"
},
"urls": [
......@@ -160,7 +160,7 @@
"build": "//coreutils:BUILD.tmpl.bazel",
"integrity": "sha256-MnwdLPwZ+S5/cYPRym8lhcyvazAuhzJaZCmBLAW5+80=",
"strip_prefix": "coreutils-0.0.21-x86_64-pc-windows-msvc",
"symlinks": {
"links": {
"coreutils.exe": "coreutils"
},
"tools": [
......@@ -908,7 +908,7 @@
"moduleExtensions": {
"//:MODULE.bazel%_repo_rules": {
"general": {
"bzlTransitiveDigest": "omJnSRpWwkQFbXUOaQ2BelTgvcmUZLFBpBF+aKjZMkg=",
"bzlTransitiveDigest": "Pzj6YSY10JZJ0J1msmGG7xWH4Fz8C3FPmHA67zaqWjw=",
"accumulatedFileDigests": {},
"envVariables": {},
"generatedRepoSpecs": {
......@@ -960,7 +960,7 @@
"patches": [
"@@//deb:fixture.patch"
],
"symlinks": {
"links": {
"etc/test/fixture.txt": "symlink.txt"
},
"urls": [
......@@ -1002,7 +1002,7 @@
"build": "@@//coreutils:BUILD.tmpl.bazel",
"integrity": "sha256-MnwdLPwZ+S5/cYPRym8lhcyvazAuhzJaZCmBLAW5+80=",
"strip_prefix": "coreutils-0.0.21-x86_64-pc-windows-msvc",
"symlinks": {
"links": {
"coreutils.exe": "coreutils"
},
"tools": [
......
visibility("//download/...")
ATTRS = {
"symlinks": attr.string_dict(
doc = 'Creates symlinks in the downloaded repository as `{"<target>": "<link>"}`',
"links": attr.string_dict(
doc = 'Creates links in the downloaded repository as `{"<target>": "<link>"}`',
),
}
def symlinks(rctx):
def links(rctx):
"""
A mixin for `download` repository rules that creates symlinks.
A mixin for `download` repository rules that creates links.
Args:
rctx: The download repository context.
......@@ -16,7 +16,7 @@ def symlinks(rctx):
Returns:
A map of canonical arguments
"""
for target, link in rctx.attr.symlinks.items():
for target, link in rctx.attr.links.items():
rctx.symlink(target, link)
return {}