Commit Graph

317 Commits

Author SHA1 Message Date
Bocete eba66dc475
Update unittest_tests.bzl to not have a dormant deps test if the current blaze version doesn't support dormant deps yet 2024-11-19 16:03:42 -08:00
Bocete 00f982a375
Rename "unused_ctx" to "_unused_ctx", maybe buildifier will like that more? 2024-11-15 15:17:06 -08:00
Bocete 2b6af3a889
Fix typos unittest_tests.bzl 2024-11-15 15:10:47 -08:00
Bocete e9c4e3415e
Update unittest_tests.bzl with tests for "for_dependency_resolution" 2024-11-15 14:56:35 -08:00
Bocete 1ce64e44e3
Update unittest.bzl to support `for_dependency_resolution` for `target_under_test` 2024-11-15 14:19:54 -08:00
Ara Nguyen 505e1bc3aa
Update common_settings.bzl (#552)
add scope attr to string_setting
2024-11-06 17:52:21 -05:00
Ara Nguyen e853fd4ed6
adding scope attributes for starlark flags (#546)
Working towards docs.google.com/document/d/1wIMpW1DsA0CEOs0bo9-maWbNEz4eAAyoIH59lJlZt_o/edit?tab=t.0#heading=h.epjv6353d2y8
2024-10-30 17:40:10 -04:00
Alexandre Rostovtsev 6edf03b195
Remove sh_binary usage for Bazel 8 friendliness (#550)
We can use our own native_binary instead
2024-10-28 12:46:15 -04:00
Lukas 56b235e700
README.md: fix broken directory rule links (#544) 2024-10-10 10:34:42 -04:00
Yun Peng e8e9d218ff
Explicitly enable workspace for some tasks (#540) 2024-09-13 15:18:19 +02:00
Yun Peng 01244de9b0
Fix bazel_skylib with Bazel@HEAD (#538) 2024-09-11 15:16:25 +00:00
aiuto 5c071b5006
Add test_deps to rules/private (#534)
This pattern was missed when rules/private was added.
2024-08-09 08:40:50 -04:00
Boleyn Su fa66e6b15b
Update README.md (#380)
* Update README.md

If we will remove new_sets, then we should deprecate it instead of sets.

* Update README.md

---------

Co-authored-by: Ivo List <ilist@google.com>
2024-07-15 18:03:44 +00:00
Alexandre Rostovtsev 43c6185e7e
Make only root test_deps externally visible (#508)
All other test_deps targets implicitly require the root BUILD file
for the `license` target for their default_applicable_licenses;
therefore, users should only depend on the root test_deps target.
2024-07-15 17:57:10 +00:00
aiuto da7ba2d23c
Strip compatible_with from bzl_library rules (#522)
* Wrap bzl_library in a macro so that we can force off some
global attribures that are never appropriate for BUILD files.

Removes:
- *_compatible_with
- features

* cdate

* linty

* linty

* more lint
2024-07-15 19:50:23 +02:00
Kilian Funk 32bbb52730
fix: subpackages.all works for root packages (#530) (#531) 2024-07-12 23:36:14 +02:00
Ivo List 27d429d8d0
Bump version to 1.7.1 (#521) 2024-06-03 15:22:42 +02:00
Matt 1e594dc4a6
Fix distribution tarballs to include directory rules. (#520) 2024-06-03 10:03:48 +02:00
Ivo List ab604c1cd8
Add bcr setup for gazelle (#519) 2024-05-31 11:45:14 +02:00
Ivo List 2395011a0d
Add Publish to BCR setup (#518)
* Add Publish to BCR setup

* Update maintainers guide

* Add maintainers
2024-05-31 08:30:10 +00:00
Ivo List 12f1a046c6
Update Changelog and bump version to 1.7.0 (#517)
* Update changelog for 1.6.2

* Bump version to 1.6.2

* Fix changelog

* Bump to 1.7.0
2024-05-31 08:04:57 +00:00
Matt 28d6034185
fix: Fix a bug in globs when middle is non-empty, but right is empty. (#516)
For example, if you try to match `*a*` against `ab`, then we check:
```
left = ""
middle = "a"
right = ""
middle in name[len(left):len(name)-len(right)]:
"a" in "ab"[len(""):len(name)-len("")]:
"a" in "ab"[0:-0]
"a" in "" => False
```

The problem here is that negative numbers in python index from the back, but -0 is not a negative number, so it always results in the empty string.
2024-05-31 07:30:03 +00:00
Matt 9b26156bbb
fix: Ensure directories work when the package is empty (#515)
Previously, I was getting the error
`Expected external/_main~toolchains~toolchain_sdk/usr/bin/clang++ to start with one of ["external/_main~toolchains~toolchain_sdk//", "bazel-out/k8-dbg/bin/external/_main~toolchains~toolchain_sdk/"]`
2024-05-31 09:26:49 +02:00
Ivo List 0e485c80b7
Add is_normalized and starts_with to paths module (#514)
* Add is_normalized and starts_with to paths module.

* Update docs
2024-05-29 15:40:38 +02:00
Matt f351bedd9a
Remove empty file that was accidentally not deleted. (#513) 2024-05-29 08:28:31 +02:00
Matt 4d37916e68
Minor cleanup of directory rules. (#512)
They were previously missing default_applicable_licenses.
2024-05-29 08:09:09 +02:00
Matt f3c0026ec6
Copy rules_directory's globs to bazel-skylib. (#511)
Original implementation is at https://github.com/matts1/rules_directory
2024-05-29 07:29:32 +02:00
Matt a464f69faa
Copy rules_directory to bazel-skylib. (#510)
Original implementation is at https://github.com/matts1/rules_directory
2024-05-29 07:24:27 +02:00
Matt b459822483
Add MODULE.bazel.lock to gitignore. (#509)
I would add --lockfile_mode=off to .bazelrc, but this should support older versions of bazel before the lockfile_mode flag was released.
2024-05-15 12:28:42 -04:00
Alexandre Rostovtsev 0d43695bd5
Re-add `licenses()` - internal license checker still requires it :/ (#506)
And take the opportunity to fix default_applicable_licenses in the gazelle plugin
2024-05-02 14:38:05 -04:00
Alexandre Rostovtsev a16ebb4dca
Add `default_applicable_license` and remove obsolete `licenses()` in all BUILD files (#504) 2024-05-01 17:24:18 -04:00
UebelAndre 16bf90d4ae
Support modern location expansions for run_binary (#490)
A common point of confusion I see around `run_binary` is that it's hard coded to only expand `$(location` values which in codebases I work in are otherwise completely eliminated due to it being described as "legacy"

> location: A synonym for either execpath or rootpath, depending on the attribute being expanded. This is legacy pre-Starlark behavior and not recommended unless you really know what it does for a particular rule. See [#2475](https://github.com/bazelbuild/bazel/issues/2475#issuecomment-339318016) for details.

If `execpath` is used instead as the appropriate alternative, the rule does no do any expansion and fails the action. This change adds support for expanding all available patterns whenever they're provided.
2024-04-30 17:19:34 -04:00
Philipp Stephani 2b546aff9e
Add missing comma (#505) 2024-04-25 18:06:33 -04:00
Alexandre Rostovtsev 908387347d
Add license blurb to bzl_library_test.bzl and move blurb-less test data files to testdata subdir (#503)
Required by internal license checker.
2024-04-25 17:15:11 -04:00
Alexandre Rostovtsev eff2e58cf3
Mention new contributor in changelog (#502) 2024-04-25 11:53:26 -04:00
Alexandre Rostovtsev e864c2223e
Prepare release 1.6.1 (#501) 2024-04-25 11:37:37 -04:00
Alexandre Rostovtsev 18e70d2105
Improve CI setup: add tests for Bazel 5.x and 6.x (with and without bzlmod); use Ubuntu 20.04 as main platform 2024-04-25 10:59:42 -04:00
Philipp Stephani 700c9ec92b
Improve compatibility with Bazel 6. (#499)
In Bazel 6, the doc parameter of the module_extension function doesn’t accept
None; cf. https://bazel.build/versions/6.5.0/rules/lib/globals#module_extension
vs. https://bazel.build/versions/7.0.0/rules/lib/globals/bzl#module_extension.
Instead of passing None in that case, just don’t pass the argument at all and
use the respective default.
2024-04-25 15:45:04 +02:00
Alexandre Rostovtsev f9c2d9e719
Bump gazelle submodule version in sync with the main skylib module (#498) 2024-04-24 21:47:56 +00:00
Alexandre Rostovtsev 99ffbbf8a4
Prepare release 1.6.0 (#496)
And take the opportunity to reformat docs using a more modern Stardoc release
2024-04-24 17:40:06 -04:00
Fabian Meumertzheim 1969278310
Mark `modules.as_extension` as `reproducible` (#497)
WORKSPACE macros are fully deterministic and thus a prime example of a `reproducible` module extension. This reduces clutter in `MODULE.bazel.lock`.
2024-04-24 23:26:33 +02:00
Ted Pudlik 09b1079228
Make `out` on `native_binary` optional (#474)
Fixes: #399
2024-04-24 15:40:31 -04:00
Fabian Meumertzheim 553c08dc60
Add helper functions for module extensions as `modules` (#456)
Adds a new module `modules` with two helper functions for module
extensions:

* `use_all_repos` makes it easy to return an appropriate
  `extension_metadata` from a module extension (if supported) to
  indicate that all repositories generated by the extension should be
  imported via `use_repo`.
* `as_extension` turns a WORKSPACE macro into a module extension that
  uses `use_all_repos` to automate the generation of `use_repo` calls.
2024-04-24 14:53:32 -04:00
Chris Sauer 15007f24e2
Remove outdated rules_cc dependency (#476)
Fixes #475
2024-04-24 14:23:39 -04:00
Xùdōng Yáng 80b51b36d6
Allow `bzl_library` to depend on non-`bzl_library` targets (#495)
Allow `bzl_library` to depend on non-`bzl_library` targets

Notably, `filegroup`. `bzl_library` doesn't actually read anything from the `StarlarkLibraryInfo` provider, and requiring all deps to be other `bzl_library` targets is really painful for anyone loading .bzls from `@bazel_tools` or `@platforms` because those core modules/repos don't want a dependency on Skylib just for access to `bzl_library`.

The medium-term plan will be to move `bzl_library` into `@bazel_tools`; but before then, this can serve as a stop-gap.

Co-authored-by: Alexandre Rostovtsev <arostovtsev@google.com>
2024-04-24 14:16:57 -04:00
Alexandre Rostovtsev 054ebf58f0
expand_template: do not output_to_genfiles (#493)
output_to_genfiles is deprecated unless needed for backwards compatibility
with legacy rules (see https://bazel.build/rules/lib/globals/bzl#rule)
2024-03-20 17:56:10 -04:00
Alexandre Rostovtsev e60cf0001f
Add licenses spec to new BUILD file (#485)
Internal linter complains about lack of license info.
2024-01-19 15:14:08 -05:00
JY Lin 60241d2e06
Add toolchains argument to unittests.make (#483)
* Add toolchains argument to unittests.make

Make unittests.make bypass toolchains arguments to target rule's constructor.

* update doc

---------

Co-authored-by: JiaYan Lin <jiayanl@google.com>
2024-01-08 09:37:19 +01:00
kotlaja 1a1ee6c230
Modify actions in order not to need toolchain param (#478) 2023-11-16 15:04:55 +01:00
Xùdōng Yáng 9c9beee741
prepare for release 1.5.0 (#472) 2023-11-05 11:16:45 -05:00