Commit Graph

291 Commits

Author SHA1 Message Date
Peter Lobsinger 0db9fbe519
feat: support bzlmod runfiles lookups (#953)
* feat: support bzlmod repo name aliases in tarred runfiles

Under bzlmod, repos have aliases in addition to their canonical names;
in order for lookups using these canonical names to function properly,
a file name `_repo_mapping` is located in the root of the runfiles tree
and consulted to perform repo-name translation.

See: https://github.com/bazelbuild/proposals/blob/main/designs/2022-07-21-locating-runfiles-with-bzlmod.md

* pre-commit formatting

* Enable runfiles test under bzlmod

It works now.
2024-09-30 21:10:06 -07:00
Alex Eagle c5f65e8890
fix: pick up bsdtar windows fix (#942)
see https://github.com/aspect-build/bsdtar-prebuilt/pull/10
2024-09-18 18:29:33 -07:00
Derek Cormier 716af223c2
feat: add an option to not include copy_to_directory output in runfiles (#886)
* feat: add an option to not include copy_to_directory output in runfiles

* chore: docs update

* chore: don't repeat default

---------

Co-authored-by: Alex Eagle <alex@aspect.dev>
2024-09-19 01:16:14 +00:00
Justin Pinkul ad48c0d855
fix: moving the preserve mtime test logic to Go for portability (#908)
* Fix: Moving the preserve mtiem test logic to Go for portability

* add tags to disable remote caching, execution and force the test to always re-run

* include docs

* use the runfiles library for windows compatability

* mark the test as manual

* remove duplicate word in comment

* chore: reduce duplication of the long caveats text

---------

Co-authored-by: Alex Eagle <alex@aspect.dev>
2024-09-17 17:25:26 -07:00
Alex Eagle 2f65c8c0c7
chore: update git urls (#926)
This repository was donated to the Linux Foundation and is now in the bazel-contrib GH org
2024-09-17 17:05:35 -07:00
Sahin Yort 8f0b38004e
fix: add empty files to tar (#939) 2024-09-17 17:05:20 -07:00
Alex Eagle 3b6a3d50b1
chore(deps): upgrade to newest bsdtar (#940) 2024-09-17 17:00:54 -07:00
David Zbarsky 4c1267fc27
perf: improve copy_file.bzl progress_message (#931) 2024-09-10 10:08:34 -07:00
Peter Lobsinger de9fd596fd
chore(deps): update coreutils to v0.0.27 (#905)
* chore(deps): update coreutils to v0.0.27

This release has an `aarch64-apple-darwin` binary, eliminating the need
for a `version_override` hack to support that platform.

* chore: restore previous coreutils

Users should be able to pin and not have us break them

---------

Co-authored-by: Alex Eagle <alex@aspect.dev>
2024-09-02 15:39:32 -07:00
Greg Magolan 0870fadf4c
chore: remove non-bzlmod dep on @internal_platforms_do_not_use//host:constraints.bzl now that root workspace is bzlmod-only (#916) 2024-08-20 16:14:37 -04:00
Greg Magolan 0e1f1e82c9
chore: bump to Bazel 7.3.1 (#914) 2024-08-20 13:37:52 -04:00
Greg Magolan 73d021fb36
fix: correctly split quoted args (#909) 2024-08-19 16:36:41 -04:00
Greg Magolan eb55a3c03f
refactor: deprecated expand_locations which is just pass-through to ctx.expand_location() (#910) 2024-08-19 15:28:45 -04:00
Justin Pinkul 74ac451d8a
Adding a preserve time feature to copy_to_directory and copy_directory (#898) 2024-08-10 22:08:56 -07:00
Alex Eagle 0f5e1dcafd
chore(deps): upgrade stardoc (#894)
* chore(deps): upgrade stardoc

This uses the Bazel 7 'starlark_doc_extract' rule which our docsite expects for slurping data.

* chore: stardoc setup in WORKSPACE too

* chore: skip stardoc on bazel 6 in cases where the legacy extractor produces different docstrings
2024-08-08 12:56:11 -07:00
Markus Hofbauer cdbfe4190c
fix(typos): Fix almost all typos with hook (#884)
* Fix almost all typos with hook

* align docs
2024-07-31 10:09:17 -04:00
Matt 59453e5c50
fix: Set size to a default value as well as timeout. (#839)
* fix: Set size to a default value as well as timeout.

Currently, we are unable to run our `write_source_files` tests in our pre-upload checks, because we have `--test_size_filter=small`, and setting `size` will attempt to set it on both the run rule and the test rule, the former being invalid.

* code review feedback

* chore: fix one more test that should use size for defaulting

---------

Co-authored-by: Alex Eagle <alex@aspect.dev>
2024-07-19 12:50:50 -07:00
Alex Eagle db5556df6f
chore(deps): update bsdtar prebuilt (#882)
This fixes the dynamic lookup of zstd from the PATH.
Fixes #877
2024-07-19 12:16:27 -07:00
Synchronization Acknowledgement cc956d8589
fix(tar): append slash to top-level directory mtree entries (#852)
* fix(tar): append slash to top-level directory mtree entries

bsdtar's mtree format has a quirk wherein entries without "/" in their
first word are treated as "relative" entries, and "relative" directories
will cause tar to "change directory" into the declared directory entry.
If such a directory is followed by a "relative" entry, then the file
will be created within the directory, instead of at top-level as
expected. To mitigate, we append a slash to top-level directory entries.

Fixes #851.

* chore: golden files have BINDIR placeholder

---------

Co-authored-by: Alex Eagle <alex@aspect.dev>
2024-07-02 09:27:06 -07:00
Jason Bedard 31b4bb68f6 perf: reduce concatenation in relative_path 2024-06-21 20:05:45 -07:00
Greg Magolan 18ae5a89a6
fix: allow copy_to_directory to have an empty srcs list (#871) 2024-06-21 11:33:00 -06:00
Alex Eagle 3330c38904
chore: upgrade bsdtar to 3.7.4 (#866) 2024-06-17 07:49:35 -07:00
Josh Giles 3c0dbd5895
fix: Directory hidden files in write_source_file. (#860)
* Fix #667: Dir hidden files in write_source_file.

Copy and manage hidden files starting with "." in write_source_files.

Previously these files were not supported if they were in the top level
of the directory to copy.

* Add test and fix error messages from cp, chmod.

* Also fix executable dir case.

* Fix issue with copying directory rather than contents.
2024-06-11 00:30:53 -07:00
Alex Eagle 22c33dfc51
fix: integrity hashes are now sha256 since #854 (#855) 2024-05-23 16:26:14 -07:00
Alex Eagle 4ad02b7795
refactor(release): switch release integrity to be dynamic (#854)
* refactor(release): switch release integrity to be dynamic

This matches rules_py as documented by
https://blog.aspect.build/releasing-bazel-rulesets-rust

It has the benefit that developers no longer get yelled at to vendor some updated integrity hashes into bazel-lib every time they touch the Go sources.

* refactor: echo should produce trailing newline

* chore: bump action-gh-release to avoid Node 16 warning

* chore: update test that is sensitive to compilation mode

We now only use --compilation_mode=opt when cutting a release
2024-05-23 16:08:35 -07:00
mrmeku 6959b3f807
fix: coreutils download path for darwin_amd64 (#853)
* fix: coreutils download path for darwin_amd64

* fixup

---------

Co-authored-by: Greg Magolan <greg@aspect.dev>
2024-05-23 13:12:36 -07:00
Greg Magolan a704c2608b
chore: run buildifier to green up main (#841) 2024-05-13 20:00:42 -07:00
Malte Poll 1697a3275b
fix: coreutils toolchain: Use statically linked linux amd64 variant (#706)
* coreutils toolchain: Use statically linked linux amd64 variant

Uutils has a musl release artifact for linux amd64.
In the future, it should probably also be possible to add a
aarch64 musl toolchain. At the moment, this is not an upstream release
artifact.

* coreutils toolchain: temporarily add back old darwin variant

On release 0.0.26 of uutils/coreutils, the darwin x86_64 binary is missing.
Also, any releases between 0.0.23 and 0.0.26 are missing binary artifacts.
Downgrade coreutils toolchain on darwin x86_64 for now.

https://github.com/uutils/coreutils/releases/tag/0.0.26
2024-05-08 07:06:12 -07:00
Alex Eagle b15dc31a81
fix(tar): handle spaces in input filenames (#835) 2024-05-07 17:52:35 -07:00
Sahin Yort d1d063f3e5
feat: introduce zstd toolchain (#831) 2024-05-03 16:12:56 -07:00
Alex Eagle 977f27f7a0
feat(tar): add ergonomic way to strip_prefix (#829) 2024-05-01 12:36:39 -07:00
Greg Magolan 5cc1a3a1be
chore: bump to bsdtar-prebuilt 3.7.2-1 binaries for linux and darwin (#819) 2024-04-20 15:34:39 -07:00
Greg Magolan abf56a6454
feat: add get_home_directory to repo_utils (#809) 2024-04-03 13:53:18 -07:00
Alex Eagle f4f588f4ea
Use statically-linked bsdtar on all platforms (#804)
* [tar] Switch to statically linked binaries

* chore: don't use bsdtar for extract yet

* chore: add dzbarsky integrity hashes

* Upgrade to 3.7.2.bcr.2 (#806)

* chore: replace URLs with aspect-build fork

---------

Co-authored-by: David Zbarsky <dzbarsky@gmail.com>
2024-03-29 11:35:56 -07:00
Joy Gao 624e8acac5
clean rm of copied dirs and files (#799) 2024-03-27 10:02:47 -04:00
Alex Eagle fea9515087
feat: don't require 'out' on expand_template (#798)
In a lot of cases the name of the generated file is unimportant.
For example in https://github.com/bazel-contrib/rules_oci/pull/534 I wanted to remove 'out' in a bunch of these calls.
2024-03-26 16:57:16 -07:00
Alex Eagle 0fc838839c
feat: add a helper for rules to work with resource_sets (#792)
* feat: add a helper for rules to work with resource_sets

This API is poorly designed and needs some help to let rule users pick a value in cases that they aren't also the rule author

* chore: add some cpu resource_set values as well
2024-03-18 15:38:24 -07:00
Sahin Yort a29dd93c0b
fix: srcs is not mandatory (#786) 2024-03-08 10:47:38 -08:00
Greg Magolan fdb7bf3a56
docs: add warning about using use_default_shell_env (#779) 2024-03-05 10:33:05 -08:00
Greg Magolan 73e620161a
docs: add use_default_shell_env to docstring of run_binary (#778) 2024-03-05 10:27:02 -08:00
Matt Mackay aa6a58f73c
chore: bump libxml2 deb to USN-6658-1 (#768) 2024-02-27 13:10:08 -05:00
Marc Redemske a3d7efe298
feat(list): add `unique` function (#716)
* feat(list): add `unique` function

* Update lists.bzl

* Update lists.bzl

* Update lists.bzl

* Update lists.bzl

---------

Co-authored-by: Alex Eagle <alex@aspect.dev>
2024-02-27 08:25:00 -08:00
Mike Lundy dfcffca8f5
jq: add data file and location expansion support (#757)
This teaches the jq rule about a `data` attribute and adds conditional
support to do bazel location expansion. The expansion is disabled by
default because it likely would cause compat concerns (since jq can take
arbitrary text as input args).
2024-02-26 17:43:56 -08:00
Tiago Quelhas e514283dd8 Remove unnecessary ctx.resolve_tools.
`ctx.actions.run(executable = ...)` is sufficient to include the runfiles in the action inputs. (More generally, ctx.resolve_tools is discouraged in favor of `ctx.actions.run(tools = ...)`.)
2024-02-25 17:43:38 -08:00
Alex Eagle 1c98ca9f34
chore: make it possible to override run_binary#use_default_shell_env (#762)
Still not documented as public API. We think this leads to non-hermeticity and could cause cache misses, so it must be used with care.

Part of https://github.com/aspect-build/rules_js/issues/1303
2024-02-21 13:37:47 -08:00
Greg Magolan 71a8052589
fix: merge user tags in stardoc_with_diff_test (#746) 2024-02-05 17:43:58 -08:00
Matt Mackay 59cc7058de
perf: remove unnecessary calls to 'to_list' (#737) 2024-01-29 12:43:32 -05:00
Greg Magolan 5b3b7d7794
feat: allow write_source_file(s) to write source files to bazel packages outside of the target's package (#717) 2024-01-10 15:07:03 -08:00
Greg Magolan 516a5fe725
feat: add is_bazel_7_or_greater utility (#714) 2024-01-07 16:42:57 -08:00
Greg Magolan 5aaa785b96
chore: test against bazel 7.0.0 (#713) 2024-01-07 16:12:05 -08:00