Commit Graph

276 Commits

Author SHA1 Message Date
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
Alexandre Rostovtsev b9ec2c2dbb
Allow using python3 for timestamps on macOS and BSD (#362)
Note that macOS 12.3 removed python2.
2022-04-01 10:00:11 -04:00
Geoffrey Martin-Noble 8e2ba6e9df
Fix runfiles in native_binary/native_test (#339)
The current implementation misses the runfiles from the binary itself
since the attribute for it is called `src` not `srcs` and it makes use
of the discouraged `collect_data` and `collect_default` parameters which
depend on hardcoded attribute names.
2022-03-29 17:41:48 -04:00
Alex Eagle bd79f922c9
Add diff_test asserting that docs are up-to-date (#321)
Based on Aspect's stardoc_with_diff_test; see https://github.com/aspect-build/bazel-lib/blob/main/docs/docs.md
2022-03-29 15:14:07 -04:00
Alexandre Rostovtsev b669088a95
Update dicts documentation. (#361) 2022-03-28 12:06:10 -04:00
Barry McNamara 8334f938c1
Implement omit and pick dicts functions. (#304) 2022-03-17 16:49:06 -04:00
Alexandre Rostovtsev ee67264452
Update changelog and version for release 1.2.1 (#360)
Make a point release to unbreak users who set `--incompatible_disallow_empty_glob`. See discussion in https://github.com/bazelbuild/bazel-skylib/pull/359
2022-03-10 11:31:05 -05:00
Alexandre Rostovtsev 898cd6ddff
Remove unused, empty //rules:bins filegroup, allowing us to simplify distribution/BUILD (#359)
//rules:bins has not been used since 14f17ae7f7

Alternative to https://github.com/bazelbuild/bazel-skylib/pull/358
2022-03-10 07:41:11 -05:00
Alexandre Rostovtsev 5bffd04256
Add a maintainer's guide (#356) 2022-02-23 20:06:15 -05:00
Ivo List e30197f379
Extend owners of skylib. (#355) 2022-02-23 09:43:39 -05:00
Alexandre Rostovtsev c4dfec1bf1
Update changelog and version for release 1.2.0 (#350) 2022-02-11 12:02:05 -05:00
UebelAndre cdd0afdfe6
Fixed positional args for unittest targets (#352)
Followup to https://github.com/bazelbuild/bazel-skylib/pull/343
2022-02-10 17:55:11 -05:00
UebelAndre 2bc90bdf7d
Allow unit test rules to be documented (#343)
I find it more ergonomic to add notes or a description about a test to a `doc` attribute, similar to other rules, vs a comment block above it or in the `impl` function docstring. Hopefully this can improve the readability of test rules.
2022-02-10 17:00:29 -05:00
Kevin Kress 7270e3b345
Add support for 'loading' unit tests, which evaluate a LOADING phase. (#347)
This is a relatively simple addition to unittest that statically creates rules
that either explicitly fail or not depending on if the test case is valid during
LOADING phase of bazel.  The test conditions are evaluated entirely in loading
phase, but if we want an actual test to fail rather than just `fail()` killing
the build, we can use this to assert state and report test failures.
2022-02-10 16:03:48 -05:00
Alexandre Rostovtsev 1e1c324391
Fix linter warnings with new buildifier version. (#349) 2022-02-10 14:50:56 -05:00
Geoffrey Martin-Noble ecc11f9a4c
Fix name arg documentation for native_binary (#338) 2022-01-12 11:28:43 -05:00
Alexandre Rostovtsev 6e30a77347
Update internal dependencies to modern versions. Bazel Federation repo is deprecated. (#327)
See https://github.com/bazelbuild/bazel-federation/pull/127

In particular, this allows us to use a modern Stardoc release to fix generated md docs.

And we can remove internal_deps.bzl/internal_setup.bzl - it's unnecessary complexity
needed only for deprecated Federation setup.
2021-10-27 09:13:59 -04:00
Yesudeep Mangalapilly 8e923ca4b9
Use more portable `#!/usr/bin/env bash` shebang instead of hardcoded /bin/bash. (#329) 2021-10-25 09:12:41 -04:00
Samuel Freilich 506c17293e
Improve escaping in unittest failure message (#320) 2021-10-04 12:03:48 -04:00
Alexandre Rostovtsev b2ed61686e
Missing version number bump in version.bzl for the new release (#318)
Implying that the new release will have to be 1.1.1, not 1.1.0
2021-09-27 13:12:59 -04:00
Alexandre Rostovtsev 50d2680f5f
Update changelog for release 1.1.0 (#317) 2021-09-27 12:23:51 -04:00
Alex Eagle eabe5f7fe9
Run regenerate_docs.sh (#297)
Co-authored-by: Alexandre Rostovtsev <arostovtsev@google.com> (merge conflict fixes)
2021-09-24 11:24:43 -04:00
Thaler Benedek 43a545a67e
Make diff_test work on windows with --enable_runfiles (#314) 2021-09-24 10:49:07 -04:00
Mansur 14f17ae7f7
Windows support for build_test (#302) 2021-09-24 10:43:30 -04:00
Daniel Wagner-Hall 08398cdc99
Allow specifying additional aspects to tut (#299) 2021-09-23 16:21:58 -04:00
Alex Eagle df3c9e2735
diff_test: add ability for caller to specify a message printed on fai… (#307)
Useful for the use case of a pair of .test and .update targets for checked-in golden files
2021-08-18 11:23:43 -04:00
Philipp Wollermann 0c57e74606
Remove `$` from grep regexes (#311)
Due to grep having dropped support for handling line-ending matches in a cross-platform way, grepping for `...$` will now fail on Windows, as it no longer ignores the CR part of the CRLF line endings on Windows.

This should turn this project green again on Bazel CI.
2021-08-09 11:15:50 -04:00
dmaclach b053a5ae11
Update partial.bzl to generate better markdown (#309) 2021-07-26 15:26:28 -04:00
dmaclach 775f66fb28
Update partial_doc.md (#308)
Clean up the docs to make them look significantly better.

No semantics changes, just styling.
2021-07-14 21:55:10 -04:00
aiuto fd75066f15
update links to bazel docs (#306) 2021-06-16 13:00:06 -04:00
Alexandre Rostovtsev c6f6b5425b
Fix default branch name in README (#292)
See https://github.com/bazelbuild/bazel-skylib/branches and
https://github.com/bazelbuild/bazel-skylib/issues/281.
2021-05-13 10:22:43 -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
c-parsons 398f312289
lint warning fix (#115) 2021-03-31 16:06:00 -04:00
Olek Wojnar 82c1d0fa3e
Add shebang lines to tests directory shell scripts (#288) 2021-03-31 15:46:21 -04:00
Christopher Sauer b3ce9e70e5
Add write_file and copy_file docs to README (#291) 2021-03-31 15:34:15 -04:00
aiuto f80bc733d4
update owners (#289) 2021-01-29 13:38:17 -05:00
alandonovan e19d391ac9
Explain criteria for contributing (#286)
* Explain criteria for contributing

* Update README.md

* Update README.md
2020-12-17 17:20:24 -05:00
David Sanderson ed7f03cde6
Enable unittest.suite to accept partial calls of test rules (#276)
* Enable unittest.suite to accept partial calls of rules

This permits using `unittest.suite` with test rules that have nondefault
attributes, while retaining compatibility with current usage.

For instance, this permits setting a `timeout` on each test in a
`unittest.suite`.  Previously, all tests in a `unittest.suite` would
have the default timeout, with no good way to alter this.  This
made it hard to eliminate all the warnings produced from using the
`--test_verbose_timeout_warnings` bazel option.

While timeouts were the motivation, the solution here is not specific
to timeouts. It will permit arbitrary additional arguments to the test
rules in a `unittest.suite`.

Fixes #98

* Respond to review feedback.

* Document a breaking change in bazel that this code needs to be aware of.
2020-11-12 21:04:39 -05:00
Andrew Z Allen 182046f090
Handle "internal" directory visibility (#274)
Both "internal" and "private" directories should be treated the same way
and have visibility restrictions be placed upon them.
2020-10-21 23:52:14 -06:00
Andrew Z Allen b2ffc94b17
Gazelle now handles imports from `@bazel_tools` (#273)
`@bazel_tools` is tricky since it is effectively a part of the standard
library that can not have a `bzl_library` attached to it. As a simple
fix for this, `bzl_library` can have a srcs dependency on it so that it
includes the transitive closure of all of its dependencies.

`@bazel_tools` imports are rewritten into the `srcs` attribute since
they are `exports_files`ed from the @bazel_tools.

Co-authored-by: c-parsons <cparsons@google.com>
2020-10-19 12:49:17 -04:00
River a81c2c0efe
Regenerate new_sets.bzl docs. (#280)
Lists are not supported. The code comments were fixed to match this in 2d620ba1f8, but the docs were never updated.
2020-10-15 14:20:00 -04:00
Laurent Le Brun 528e424134
Remove laurentlb from CODEOWNERS (#279) 2020-09-25 22:55:01 +02:00
David Sanderson 56ec790c9b
Address latent buildifier issues. (#278)
In https://buildkite.com/bazel/bazel-skylib/builds/1240#annotation-buildifier
I noticed buildifier issues unrelated to my PR.
This PR attempts to address these latent buildifier issues.
2020-09-25 22:32:06 +02:00
Andrew Z Allen 2a89db4749
Fix CODEOWNERS (#275)
Previously permissions were granted to edit any file that existed in a directory
titled `gazelle`. Now grants have been given recursively.
2020-09-15 19:53:03 -04:00
Samuel Giddins 836f1b2f56
Add support for gazelle handling relative imports (#271) 2020-09-07 15:29:39 -06:00
aiuto 2ec2e6d715
update release notes for 1.0.3 (#270) 2020-08-27 10:01:44 -04:00