Commit Graph

28 Commits

Author SHA1 Message Date
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
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
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
Derek Cormier 207acb3850
Add copy_directory rule (#366) 2022-06-01 09:58:09 +02: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
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
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 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
Mansur 14f17ae7f7
Windows support for build_test (#302) 2021-09-24 10:43:30 -04:00
Jonathan B Coe 16de038c48
Add missing bzl_library for analysis_test.bzl (#262) 2020-08-10 14:35:04 -04:00
Andrew Z Allen d35e8d7bc6
Create Gazelle language for Starlark (#251) 2020-06-26 17:04:12 +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
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
aiuto 47c6eb15c6
Fix to 1.0.1 - add missing .bzl files (#201) 2019-10-08 15:05:48 -04:00
aiuto ab87410a8b
Use rules_pkg to make the skylib tarball for a release. (#185)
* add empty CHANGELOG.md to try to reuse bazel release.sh

* checkpoint a new distribution method

* Update CHANGELOG.

* checkpoint relnew

* get the tarball working

* fix visibilyt

* whitespace

* punctuation typos

* buildify

* linty fresh
2019-08-23 14:37:16 -04:00
Julie 21ee269a55 Create new stardoc target for common_settings.bzl (#166) 2019-07-03 12:46:14 -04:00
László Csomor bf8a55b668
run_binary: runs an executable as an action (#153)
This rule is an alternative for genrule(): it can
run a binary with the desired arguments,
environment, inputs, and outputs, as a single
build action, without shelling out to Bash.

Fixes https://github.com/bazelbuild/bazel-skylib/issues/149
2019-05-21 14:46:09 +02:00
László Csomor c585222071
New rules: native_binary and native_test (#152)
native_binary() wraps a pre-built binary or script
in a *_binary rule interface. Rules like genrule
can tool-depend on it, and it can be executed with
"bazel run". This rule can also augment the binary
with runfiles.

native_test() is similar, but creates a testable
rule instead of a binary rule.

Fixes https://github.com/bazelbuild/bazel-skylib/issues/148

RELNOTES[NEW]: The new `native_binary()` and `native_test()` rules let you wrap a pre-built binary in a binary and test rule respectively.
2019-05-14 13:33:01 +02:00
László Csomor be3b1fc838 diff_test: add rule and tests (#136)
This new test rule compares two files and passes
if the files match.

On Linux/macOS/non-Windows, the test compares
files using 'diff'.

On Windows, the test compares files using
'fc.exe'. This utility is available on all Windows
versions I tried (Windows 2008 Server, Windows
2016 Datacenter Core).

See https://github.com/bazelbuild/bazel/issues/5508
See https://github.com/bazelbuild/bazel/issues/4319
2019-04-12 13:35:29 -04: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
László Csomor 2d1669ed88
write_file: add rule and tests (#122)
This PR adds two new rules: write_file and
write_xfile.

Both rules solve a common problem: to write a text
file with user-defined contents.

The problem is routinely solved using a genrule.
That however requires Bash, since genrules execute
Bash commands.  Requiring Bash is a problem on
Windows.

The new rules do not require any shell.

The only difference between the rules is that
write_xfile creates an executable file while
write_file doesn't.

See https://github.com/bazelbuild/bazel/issues/4319
2019-03-19 07:52:56 +01:00
László Csomor db27394846 copy_file: add rule and tests (#123)
This PR adds two new rules: copy_file and
copy_xfile.

Both rules solve a common problem: to copy one
file to another location. The problem is routinely
solved using a genrule. That however requires
Bash, since genrules execute Bash commands.
Requiring Bash is a problem on Windows.

The new rules do not require Bash on Windows (only
on other platforms).

The only difference between the rules is that
copy_xfile creates an executable file while
copy_file doesn't.

See https://github.com/bazelbuild/bazel/issues/4319
2019-03-18 13:23:15 +01:00
László Csomor 1b28145983
maprule: use ctx.resolve_tools (#117)
In this PR:

- In the _resolve_locations function: use the
  Bash-less ctx.resolve_tools function to resolve
  the runfiles manifests and inputs of tools,
  instead of using ctx.resolve_command for
  the same purpose.

- In the _custom_envmap function: no longer
  resolve $(location) references when
  creating the envvars from custom_env, because
  those references were already resolved in
  _resolve_locations.

The ctx.resolve_tools() method was added in this
PR: https://github.com/bazelbuild/bazel/pull/7139
See design doc there.
2019-03-04 11:04:01 +01:00
c-parsons 9630853eeb
add documentation pages for rules/ and lib/ (#119) 2019-02-28 17:43:57 -05:00
Thomas Van Lenten 4b67f5ff38 Add rules to the test_deps target. (#102)
* Add rules to the test_deps target.

Likely needed for anyone doing integration tests using skylib.

* Default public visibility and only tag things that are private.
2019-01-28 13:51:57 -05:00
Thomas Van Lenten f5e50bc53c Add a build_test rule. (#97)
* Add a build_test rule.

This rules (marco) provides a 'test' target that can be used to ensure other
targets build.
2019-01-25 14:34:15 -05:00
László Csomor 8d4f7612b2
maprule: an improved version of genrule() (#86)
maprule() is an improved version of
native.genrule(), with the following advantages:

- Maprule can process source files in parallel,
  creating separate actions for each of them.

- Maprule does not require declaring all output
  files. Instead you declare templates for the
  output files yielded for each source. Therefore
  N source files and M templates yield N*M
  outputs.

- Maprule supports both Bash and cmd.exe syntax
  for its commands via the specialized rules
  bash_maprule and cmd_maprule.

- Maprule's cmd attribute does deliberately not
  support $(location) expression nor Make
  Variables, in order to avoid issues and
  challenges with quoting. (In case of cmd.exe
  passing empty arguments is impossible). These
  paths can be passed as envvars instead.

- Maprule's add_env attribute does support
  $(location) expressions (and some extra
  placeholders) and is the idiomatic way to pass
  execpaths of labels in "tools" or "srcs" (the
  shared sources available for all actions) to the
  command.

See https://github.com/bazelbuild/bazel/issues/4319
2019-01-08 09:04:53 +01:00