Commit Graph

273 Commits

Author SHA1 Message Date
Philipp Schrader d27b58d319 delete PATH manipulation 2022-09-18 14:53:22 -07:00
Philipp Schrader 9eb896ec83 Switch everything to @platforms//:incompatible 2022-09-18 14:43:00 -07:00
Philipp Schrader 0d87298560 Rename to incompatible_in_* 2022-09-13 20:16:55 -07:00
Philipp Schrader 76a22f4e81 Incorporate feedback 2022-09-13 20:00:14 -07:00
Philipp Schrader 6765506092 Merge remote-tracking branch 'origin/main' into HEAD 2022-09-13 19:57:26 -07:00
Xùdōng Yáng 61d9c62833
Make settings error message more friendly (#394)
By stripping leading '@'s from labels in the main repo. So it talks about the flag '//foo:bar' instead of the flag '@//foo:bar'.
2022-09-05 16:17:20 -04:00
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
Alexandre Rostovtsev c5ededc7e8
Fix stardoc_with_diff_test linter warnings (#390)
Google internal linters are flagging skylib 1.3.0 because the stardoc_with_diff_test
macro lack a copyright notice and does not use a `name` parameter.
2022-09-01 11:25:42 -04:00
Alexandre Rostovtsev 6a17363a3c
Update changelog and version for release 1.3.0 (#388) 2022-09-01 10:12:35 -04:00
Alexandre Rostovtsev d7e9dbb31f
Add missing docs and doc links; update bazel.build links (#387) 2022-09-01 08:19:43 -04:00
nickgooding 31ab4c8bd2
feat: bzlmod setup (#385)
Creates MODULE.bazel and WORKSPACE.bzlmod files to enable bazel-skylib
to work with the `--experimental_enable_bzlmod` flag.

rules_go has been updated as the previously used version is not
available in the BCR.

stardoc has been updated due to a strange issue with Bzlmod enabled that
caused the `diff_test` and `unittest` docs to be generated without any
contents that was magically fixed upon updating.

bazelbuild/bazel-central-registry#124

Co-authored-by: Alexandre Rostovtsev <arostovtsev@google.com>
2022-08-30 14:57:34 -04:00
Philipp Schrader 04caadf22f Fix lint issues 2022-08-29 23:03:20 -07:00
Philipp Schrader 0ee8b41cf1 update docs 2022-08-29 23:00:01 -07:00
Philipp Schrader 8d07e16678 Switch to predetermined `constraint_value` targets 2022-08-29 22:58:56 -07:00
Philipp Schrader ded484cd0a Merge remote-tracking branch 'origin/main' into HEAD 2022-08-29 22:25:49 -07:00
Vinh Tran 1bbb388780
Update unittest_doc.md with analysistest and loadingtest modules (#370)
Co-authored-by: Alexandre Rostovtsev <arostovtsev@google.com>
2022-08-26 09:21:43 -04:00
Vinh Tran 69b4636956
Fix doc error for analystest.begin (#369)
Co-authored-by: Alexandre Rostovtsev <arostovtsev@google.com>
2022-08-25 17:47:50 -04:00
Philipp Schrader d935d67a5b Switch to *settings 2022-08-24 23:28:31 -07:00
Philipp Schrader c333bc4a74 Remove `bazel shutdown` which is causing segfault on Windows 2022-08-17 00:46:59 -07:00
Philipp Schrader 7939c78f88 Merge remote-tracking branch 'origin/main' into HEAD 2022-08-17 00:41:50 -07:00
hchsiao c1dfc324fb
Fixing typo: allocate slice with the correct size (#383) 2022-08-16 12:00:42 -04:00
Philipp Schrader ee916b0140 Fix test 2022-08-09 22:31:01 -07:00
Philipp Schrader bf4a2cd7be Run buildifier 2022-08-09 19:58:19 -07:00
Philipp Schrader 756846674f Add composed incompatibility to test 2022-08-09 19:56:51 -07:00
Philipp Schrader b77d66e1b6 Clean up some more 2022-08-09 19:30:49 -07:00
Philipp Schrader 5b4c97c9fa clean up some more 2022-08-09 19:29:56 -07:00
Philipp Schrader 73b0ed8997 Incorporate feedback 2022-08-09 19:11:35 -07:00
Philipp Schrader dc846a002e regenerate docs 2022-08-08 21:48:08 -07:00
Philipp Schrader 6abd9ad9c2 Fix some syntax highlighting issues 2022-08-08 21:47:24 -07:00
Philipp Schrader 4b34b67ccd Expand docs a bit 2022-08-08 21:43:43 -07:00
Philipp Schrader e202c2b484 Get started on docs 2022-08-08 20:02:23 -07:00
Philipp Schrader 63d9712b75 Clean up some more 2022-08-08 19:53:24 -07:00
Philipp Schrader 977a0704b6 Simplify some more 2022-08-08 19:41:47 -07:00
Philipp Schrader b3d4463885 Consolidate tests 2022-08-08 19:35:57 -07:00
Philipp Schrader 8190b2ea3a simplify some 2022-08-08 19:30:49 -07:00
Philipp Schrader 52b2e6223f Tweak stuff a bit 2022-08-07 22:46:42 -07:00
Philipp Schrader b6a5584f99 Merge remote-tracking branch 'origin/main' into HEAD 2022-08-07 20:49:29 -07:00
Alexandre Rostovtsev 872e9b06e1
Fix diff_test on Windows with --enable_runfiles --nolegacy_external_runfiles (#378)
And make sure our test suite exercises both manifest-based and runfiles-based
code paths for diff_test.

Fixes #376.
2022-07-15 13:07:09 -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
Alexandre Rostovtsev 312bccd83b
Update doc review section of maintainer guide (#368)
https://github.com/bazelbuild/bazel-skylib/pull/321 has been merged.
2022-05-17 07:31:01 -04:00
Geoffrey Martin-Noble a6f17ab1fe
Switch native_binary/test to use symlinks (#340)
A copy should not be necessary here. The symlink action falls back to
copying when symlinks are not enabled on windows, which I think would 
be the only problem with using symlinks:
https://docs.bazel.build/versions/4.2.2/command-line-reference.html#flag--windows_enable_symlinks
2022-05-17 07:26:16 -04: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 67bfa0ce4d
Switch run_binary to cfg = "exec" to fix buildifier failure (#367) 2022-04-29 13:44:59 -04:00
Alexandre Rostovtsev d54e8a70ce
Remove unnecessary wrapper macro for expand_template rule (#365)
Followup to #330: remove the wrapper macro and export the rule directly; the macro
does not serve any useful function. As a side effect, this fixes the inability to
set tags etc., since the macro did not support **kwargs.
2022-04-06 15:21:13 -04:00
Alexandre Rostovtsev de3035d605
Properly shell-quote diff_test's failure_message in bash (and document the failure_message attribute) (#364)
Addresses #344 for Unix; #363 is needed as prerequisite for the corresponding Windows fix.
2022-04-06 15:16:14 -04:00
Geoffrey Martin-Noble 6abad3de5f
Build native_binary/test src in correct configuration (#341)
This attribute is incorrectly being built in the host configuration when
(like any test) it will run in the target configuration. This means that
cross compilation will be broken and options that differ between host
and target (e.g. `NDEBUG`) will not be as set by the user.

I confirmed that without this fix, a test binary with `assert(false)`
passes when run under `native_test`.

Additionally, the use of `allow_single_file` precludes rules that return
multiple files in their DefaultInfo (like `py_binary`). Instead, we can
use `allow_files` and access via `ctx.executable`.
2022-04-05 17:09:55 -04:00
Kevin Kress cc51024fc2
Add subpackages module to skylib to support new bazel native.subpackages (#348) 2022-04-04 17:56:21 -04:00
Vertexwahn 2a87d4a62a
Add expand_template rule (#330)
Resolves: https://github.com/bazelbuild/bazel-skylib/issues/191

An example of how this can be useful can be found here: https://github.com/catchorg/Catch2/pull/2387/files

Could be also helpful here: 8587f4eed1/BUILD.bazel (L21)
2022-04-01 18:07:48 -04:00