Commit Graph

29 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
László Csomor 58068fe0cc
Delete maprule. Fix Buildifier lint errors. (#192)
* Delete maprule. Fix Buildifier lint errors.

Delete maprule and its tests: I wrote this rule,
and I no longer plan to release it. Alternative
rules exist that serve users' needs better.

Fix also Buildifier lint errors that were making
BuildKite red: https://buildkite.com/bazel/bazel-skylib/builds/659#ab98ac31-6e1c-415e-b8a8-5f8868340c7d
2019-09-17 14:03:22 +02:00
Greg 3f7b196d2a Update selects documentation. (#170) 2019-08-23 14:52:24 -04:00
Julie 10851c2c5b Give BuildSettingInfo's value field a description (#167) 2019-07-03 14:42:40 -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 6bf6443975
write_file: support different line endings (#150)
The user can specify which line endings they want
write_file to use. This helps avoiding line ending
mismatches with diff_test.

Example: diff_test verifies that a rule generates
correct output by comparing it to a checked-in
"golden" file. Both files are text files, and the
user builds on Windows but the golden file was
written on Linux and git checkout preserved
original line endings.

Without explicitly specifying which line endings
to use, this diff_test would fail on an otherwise
good output.

With explicit line endings we don't need to check
in the golden file to git, we can just generate it
with "auto" line endings.
2019-05-09 15:29:44 +02:00
c-parsons 67ecd63273 Minor formatting changes plus doc updates (#147) 2019-05-08 16:34:47 +02:00
Thomas Van Lenten f80abf6578 Fix typo (#142) 2019-05-01 13:38:59 -04:00
Thomas Van Lenten 31b8ea5ea1
Add licenses() to all BUILD files. (#141) 2019-05-01 11:33:25 -04: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 084758ff75
Regenerate docs + remove maprule.md (#137)
Maprule is hidden, see 3721d32c14
2019-03-26 12:38:49 +01: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
c-parsons b2b4471332
run buildifier 0.22.0 (#125) 2019-03-07 17:22:04 -05:00
c-parsons 9630853eeb
add documentation pages for rules/ and lib/ (#119) 2019-02-28 17:43:57 -05:00