Commit Graph

287 Commits

Author SHA1 Message Date
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
Ivo List bc97abb33e
Move bzl ext (#265)
* Move Gazelle extension to //gazelle/bzl and change package name

This fixes an issue with importing bazel-skylib into
google3. Currently, Glaze (internal Go build file generator) attempts
to generate a target (//gazelle:gazelle) that conflicts with one
that's already declared here.

I think the right solution is actually to move the package into a
subdirectory. In the future (bazelbuild/bazel-gazelle#5), Gazelle's Go
extension will generate target names similar to what Glaze does, so
the same conflict will happen in open source. I think it's also
logical to have a directory of packages in case more need to be added
in the future, and for the extension to have a package name matching
the language it works with.

This is an incompatible change, but the //gazelle directory isn't part
of a tagged release yet, so hopefully it won't break anyone.

* fix runfiles access in test

* Fix gazelle package names.

Co-authored-by: Jay Conrod <jayconrod@google.com>
2020-08-20 13:14:55 -04:00
c-parsons 68acaa5d6a
Improve inspect_output_dirs_test bin_dir comparison (#267)
This should fix some buildkite CI flows, ensuring success of
this test is no longer tied to the current compilation_mode.
It also improves the error message of the offending evaluation.
2020-08-20 13:06:59 -04:00
Ivo List dc080e9516
Prettify failure message of asserts.set_equals. (#263)
Before, when comparing large sets, the message dumped the whole set. Now it additionally prints missing and unexpected elements.
2020-08-11 14:52:32 +02:00
Jonathan B Coe 16de038c48
Add missing bzl_library for analysis_test.bzl (#262) 2020-08-10 14:35:04 -04:00
Julie d62d6f52d5
rm last usage of --experimental_build_setting_api (#260)
* rm last usage of --experimental_build_setting_api

* Update bazel_federation to new version to get new stardoc
2020-07-31 12:39:19 -04:00
aiuto 07922b040c
Stop depending on rules_pkg through the federation. (#259)
- while the federation code is in flux, this will mean less churn for skylib
- rules_pkg is only needed by developers for making a distribution, so this won't impact users.
- when we develop a new federation model, we can re-depend the right way.
2020-07-24 12:26:13 +02:00
Bocete 2a44ef8ec8
Add `new_sets` as a dep of `sets` bzl_library (#253)
Without this change, evaluating bzl with strict dependencies results in an error.

[`load(":new_sets.bzl", _sets = "sets")`](560d7b2359/lib/sets.bzl (L17)) results in `No such file or directory: 'third_party/bazel_skylib/lib/new_sets.bzl`
2020-07-22 08:51:32 +08: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
Andrew Z Allen d35e8d7bc6
Create Gazelle language for Starlark (#251) 2020-06-26 17:04:12 +02:00
Julie b10f2cb0fc
Remove --experimental_build_setting_api usage (#249)
* Remove --experimental_build_setting_api usage

Deprecating this flag so removing all usage.

* One more rm

* fix ,

* Revert  semantics flags change
2020-06-24 11:31:57 -04:00
Julie ec2170289f
Add myself to codeowners for rules (#256)
...so I can maintain the skylib build settings
2020-06-24 11:28:18 -04:00
Andrew Z Allen 3b666f525d
Address lint errors (#254) 2020-06-19 19:49:52 +02:00
Laurent Le Brun 560d7b2359
Add license and copyright notice (#245) 2020-04-15 12:57:49 +02:00
Robbert van Ginkel feb52960eb
Fix diff_test when filepath includes external (#241)
Resolves https://github.com/bazelbuild/bazel-skylib/issues/240.
2020-04-14 19:04:34 +02:00
Laurent Le Brun 9935e0f820
Depend on bzl_library, not on individual bzl files (#244) 2020-04-03 16:54:55 +02:00
Laurent Le Brun 2d0c651291 Update visibility of files (#243)
Stardoc needs access to a file (with exports_files) in order to
generate its documentation.
2020-04-02 22:20:57 +02:00
Greg dfcfe82500
Fix type parsing errors on "always true" conditions. (#239)
Specifically:

selects.config_setting_group(
    name = "always_true",
    match_any = ["//conditions:default"],
)

and

selects.config_setting_group(
    name = "always_true",
    match_all = ["//conditions:default"],
)

These should, as expected, always evaluate to True.
Their implementation had a bug that failed the build outright.
2020-03-25 14:05:24 -04:00
Thomas Van Lenten 2d620ba1f8
Fix the comment to match the code. (#238)
Looking at the impl, it only accepts sets.
2020-03-19 12:40:56 -04:00
irengrig 6970e21d29
Create a helper rule for selecting a file from outputs of another rul… (#233)
* Create a helper rule for selecting a file from outputs of another rule or a filegroup by subpath

* Add tests

* Address code review comments

* + formatting

Co-authored-by: c-parsons <cparsons@google.com>
2020-02-27 13:29:45 -05:00
Thomas Van Lenten add8e42934
Run buildifier over the directory. (#235)
Using the 1.0 release.

```
buildifier -r .
```
2020-02-18 13:17:37 -05:00
Thomas Van Lenten 0a934a997d
Fix buildifier issue failing on CI. (#234)
```
buildifier -lint=fix distribution/BUILD
```
2020-02-18 13:00:50 -05:00
Bor Kae Hwang 2d4c9528e0
Add absolute path tests for Windows (#230) 2020-02-06 11:54:31 -05:00
Laurent Le Brun 1c5ed0706a
Migrate code for the flag --incompatible_disable_depset_items (#232) 2020-02-03 16:45:44 +01:00
Laurent Le Brun e583e822a0
Remove old_sets.bzl (#231)
It has been deprecated for a while, the code is not really compatible with Bazel depset-related changes.
2020-02-03 16:39:21 +01:00
Laurent Le Brun 4b25373d12
Remove flag --incompatible_remap_main_repo (#227)
It's on by default since Bazel 2.0, and the flag is now going away.

https://github.com/bazelbuild/bazel/issues/7130
2020-01-16 10:34:47 +01:00
Marcel Hlopko 327d61b5ea Migrate for --incompatible_use_platforms_repo_for_constraints (#214) 2019-10-30 14:18:01 +01:00
c-parsons 9f63e1a8d4
make select_tests resilient to default configuration differences (#212) 2019-10-29 11:20:31 -04:00
Marc Plano-Lesay 930b3527b9 Remove links to maprules (#213)
This pair of rules was removed in 58068fe0cc, and the docs removed in 084758ff75 - the links were forgotten.
2019-10-29 08:42:47 -04:00
c-parsons 734652aa5e
Remove unnecesssary license BUILD comment (#209) 2019-10-28 12:20:43 -04:00
aiuto e59b620b39
Fix execute bit on empty_test.sh (#206)
* make the tarball 555

* Split the bins out from the rest of the package and combine the
packages.

This solution is horrible. The better solution is
- We need something like pkgfilegroup in rules_pkg, so we can specify
  exectuable mode next to the file.
- But we do not want rules_pkg to appear in the rules/BUILD file
  because that would make a runtime dependency.

So we need to
- rewrite rules/BUILD when going into the package.
- or provide magic mapping of files names to mode bits
- or something entirely different.
2019-10-09 12:43:21 -04:00
c-parsons cff8af42e9
Remove genfiles_dir retrieval method (#203)
genfiles_dir has been the same as bin_dir for several Bazel releases, and is
being fully removed in upcoming Bazel release.
2019-10-08 15:46:35 -04:00
aiuto 47c6eb15c6
Fix to 1.0.1 - add missing .bzl files (#201) 2019-10-08 15:05:48 -04:00
Samuel Freilich 376680d276 Expose target_under_test's bin and genfiles path (#202)
The output directories for the target under test may differ when the target is under a config transition (config_settings is passed to analysistest.make). Since analysis tests may assert about the command-line of generated actions, and those command-lines may contain paths to output files, this is useful information to expose.
2019-10-08 12:39:11 -04:00
aiuto 0e9da0dd08
fix distribution so that we get the right dependencies load (#200) 2019-10-07 17:48:55 -04:00
aiuto e5cf5398cd
Update version and changelog in prep for 1.0.0 release (#196)
* -Update changelog to get ready for release 1.0
-Change README to point to releases page for WORKSPACE setup. Otherwise
 the readme shipped in the archive can never be in sync with the readme
 that has the correct sha256.

* update incompatible changes

* -Update changelog to get ready for release 1.0
-Change README to point to releases page for WORKSPACE setup. Otherwise
 the readme shipped in the archive can never be in sync with the readme
 that has the correct sha256.

* fix wording of changelog

* remove false file
2019-10-04 14:55:59 -04:00
Samuel Freilich f1475299af Avoid some repetition in _make_analysis_test (#197) 2019-10-04 11:19:43 -04:00
Gabe Giosia 720f59405d Pass `fragments` through to analysis tests rule constructors. (#190)
Passing fragments through to the rule allows rules to access language specific features.
2019-10-02 14:14:17 -04:00
aiuto d8387f7bd0
load rules thorugh maybe so we can simultaneous updates (#195)
* load rules thorugh maybe so we can simultaneous updates

* buildify

* Add keyword to |maybe| calls to pacify buildifier's new strictness.
2019-10-02 11:15:53 -04:00
TechSY730 3154dbbc41 Add types.is_set() to test whether an arbitrary object is a set as defined by new_sets.bzl. (#181)
* Add sets.is_set() to test whether an arbitrary object is a set.

Since using sets requires special API, it can be useful to determine
whether an object is a set so special handling can be used.
For example, if a method wants to be able to take a list or a set.
2019-09-17 10:21:44 -04:00