2
0
Fork 0
mirror of https://github.com/bazelbuild/bazel-skylib synced 2024-11-25 00:39:47 +00:00
Commit graph

17 commits

Author SHA1 Message Date
Alexandre Rostovtsev 908bf1431d
Allow sandboxing for copy_* and fix copy_directory tests (#392)
After some thought, I have to say that forcing a local strategy for
copy_file/copy_directory is inappropriate. The point of a sandbox is to
catch hermeticity bugs; disabling the sandbox may be useful for
performance, but it's up to the user to do it if they trust us - and
they can do it via flag. The default should be paranoia and safety.

And on the subject of strategies - using a genrule to create an empty
directory fails in environments where genrules run remote by default
(and thus, copy_directory tests fail). We could, of course, set local=1,
but that disables the sandbox and causes scary warnings. Instead, add a
proper empty_directory rule to test with.
2022-09-02 10:42:43 -04:00
Alexandre Rostovtsev 42abf5cbf2
Documentation fixes (#391) 2022-09-01 15:29:04 -04:00
Derek Cormier a501641dae
Use stricter execution requirements for copy actions (#372) 2022-06-10 16:23:43 +02:00
Derek Cormier 207acb3850
Add copy_directory rule (#366) 2022-06-01 09:58:09 +02:00
Fabian Meumertzheim a832b8d717
copy_file: Do not add non-executables to default_runfiles (#326)
copy_file currently includes the copied file in its runfiles even if it is not executable, which makes every rule depending on it have the file as a runfile (e.g. a `cc_library` depending on a copied header file via the hdrs attribute).

In an ideal world, according to https://docs.bazel.build/versions/main/skylark/rules.html#runfiles-features-to-avoid, `copy_file` would not need to specify any runfiles in the `DefaultInfo` it returns - specifying `files` should suffice. However, due to the existence of rules with legacy behavior, this would break compatibility (actually, already with `sh_test` in skylib's unit tests).

As a compromise that preserves compatibility with legacy rules but nevertheless cleans up the runfiles tree of depending rules, use the `data_runfiles` attribute of `DefaultInfo` if the copied file is not executable.
2022-05-16 17:27:25 -04:00
Alexandre Rostovtsev 7b859037a6
to_json/to_proto methods on structs are deprecated and will be removed (#295) 2021-05-03 12:27:40 -04:00
Yannic 8f3151fb4a
copy_file: Add parameter to allow symlinks (#252)
* copy_file: Add parameter to allow symlinks

This change adds a new parameter `allow_symlinks` to `copy_file` that
allows the action to create a symlink instead of doing an expensive
copy if the execution platform (host) allows it.

Updates #248

* Update docs

* Refactor `is_executable` into attribute

* Fix typo

* s/_impl/_copy_file_impl/
2020-07-10 14:08:02 -04:00
aiuto 47c6eb15c6
Fix to 1.0.1 - add missing .bzl files (#201) 2019-10-08 15:05:48 -04:00
László Csomor 58068fe0cc
Delete maprule. Fix Buildifier lint errors. (#192)
* Delete maprule. Fix Buildifier lint errors.

Delete maprule and its tests: I wrote this rule,
and I no longer plan to release it. Alternative
rules exist that serve users' needs better.

Fix also Buildifier lint errors that were making
BuildKite red: https://buildkite.com/bazel/bazel-skylib/builds/659#ab98ac31-6e1c-415e-b8a8-5f8868340c7d
2019-09-17 14:03:22 +02:00
Laurent Le Brun 5c80706f70
Fix for --incompatible_no_support_tools_in_action_inputs on Windows (#157)
Error identified with Bazel CI: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/120#4bcecf1f-c7d3-4de2-ba63-1ea125faa54e
2019-05-28 10:03:39 +02:00
Laurent Le Brun 9aa308e1ef
Fix repository for compatibility with --incompatible_no_support_tools_in_action_inputs (#156) 2019-05-23 20:07:27 +02:00
László Csomor 6126842e3d
copy_file: expose the copying logic (#151)
I plan to use these functions in native_binary()
and native_test().

See https://github.com/bazelbuild/bazel-skylib/issues/148
2019-05-13 16:14:33 +02:00
László Csomor 6bf6443975
write_file: support different line endings (#150)
The user can specify which line endings they want
write_file to use. This helps avoiding line ending
mismatches with diff_test.

Example: diff_test verifies that a rule generates
correct output by comparing it to a checked-in
"golden" file. Both files are text files, and the
user builds on Windows but the golden file was
written on Linux and git checkout preserved
original line endings.

Without explicitly specifying which line endings
to use, this diff_test would fail on an otherwise
good output.

With explicit line endings we don't need to check
in the golden file to git, we can just generate it
with "auto" line endings.
2019-05-09 15:29:44 +02:00
Thomas Van Lenten 31b8ea5ea1
Add licenses() to all BUILD files. (#141) 2019-05-01 11:33:25 -04:00
Thomas Van Lenten 2b1c4610c3
Reformat with buildifier --warnings=all (#138)
Fixes some dictionaries to put things in the more common orders. Buildifer
used to default to doing this check and reformatting which is why the
//conditions:default got moved up in these in the first place.
2019-04-02 11:48:08 -04:00
László Csomor 98ef48ebb2
maprule: move functionality to maprule_util.bzl (#132)
maprule_util.bzl will benefit planned new rules
(namely a genrule alternative).
2019-03-25 16:48:50 +01:00
László Csomor 3721d32c14
maprule: hide it, not ready for public use. (#133)
Move maprule() to a private directory, to
discourage use of it. I (@laszlocsomor) am
planning breaking changes to it.

Also move private files (rule implementations) to
a subdirectory "rules/private/", to clean up the
"rules/" directory.
2019-03-20 18:13:32 +01:00