Commit Graph

148 Commits

Author SHA1 Message Date
Chris Parsons 451577b188 Remove unnecesssary license BUILD comment 2019-10-21 17:01:57 -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
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
easy 90ea6feaf3 Update "Getting Started" instructions to 0.9.0 release. (#172) 2019-08-23 15:08:42 -04:00
Greg 3f7b196d2a Update selects documentation. (#170) 2019-08-23 14:52:24 -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
aiuto c5bd012f31 add aiuto as code owner. direct changes to distribution/ to them (#187) 2019-08-23 11:57:39 -04:00
c-parsons 6214b31619 Scope buildkite badge to the master branch (#186) 2019-08-22 07:50:41 -04:00
c-parsons 143c602a13
Add jin to codeowners (#175) 2019-08-21 15:24:42 -04:00
Florian Weikert f130d7c388 Comply with the standards of the Bazel federation (#182)
* Comply with the standards of the Bazel federation

This commit allows bazel_skylib to be a member of the Bazel federation, since it adds the required bzl files related to setup and dependencies.
Moreover, it also changes the WORKSPACE to fetch all dependencies through the federation.

* Add copyright and docstring to bzl files
2019-08-13 21:28:45 +02:00
Thomas Van Lenten d2cf1cc2bc
`print`->`fail` and suppress the warning in another case. (#177) 2019-07-22 13:25:00 -04:00
kwasimensah a6c72f2b39 Make config_setting_group visibility aware (#168) 2019-07-16 11:45:12 -04:00
aiuto 2b38b2f8bd
fix formatting problem (#169) 2019-07-12 14:55:22 -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
aiuto c102f5d414 Get docs working again. (#165)
- Update to newer version of stardoc.
- Make lib/selects.bzl stardoc compatible. There must be a block description before Args:

Docs now generate with
    bazel build --incompatible_remap_main_repo docs:*

See https://github.com/bazelbuild/bazel/issues/7130 for reasons.
2019-07-02 12:35:55 -04:00
Julie b113ed5d05 Create common build settings (#154)
Create common simple build settings for people to use so they don't recreate these rules over and over again. 

This fulfills part of the SBC design doc: https://docs.google.com/document/d/1vc8v-kXjvgZOdQdnxPTaV0rrLxtP2XwnD2tAZlYJOqw/edit#bookmark=id.iiumwic0jphr
2019-06-14 15:22:54 -04:00
Greg 6a6a509f36 selects.bzl: Add config_setting_group for config_setting AND/OR-chaining (#89)
* Add config_setting_group for config_setting AND/OR-chaining

Implements https://github.com/bazelbuild/proposals/blob/master/designs/2018-11-09-config-setting-chaining.md.

* buildifier lint fixes

* Add tests

* Add test stub for both match_any and match_all

* Simplify the implementation and make it more correct. :)

* Fix styling issues
2019-06-05 17:39:51 -04:00
Christian Blichmann 446fd595bf README.md: Fix typo in project name (#161)
Signed-off-by: Christian Blichmann <cblichmann@google.com>
2019-06-05 14:29:52 +02:00
c-parsons efd3bfd0f9
Add some comments to unittest_test.sh (#159) 2019-06-04 11:28:45 -04:00
c-parsons 202db59ecc
Make sets.bzl point to new_sets.bzl instead of old_sets.bzl (#158)
* Make sets.bzl point to new_sets.bzl instead of old_sets.bzl

new_sets.bzl and old_sets.bzl should be removed in the following skylib release.

Fixes #155.

* update and rename test suites
2019-05-28 17:54:22 -04:00
Laurent Le Brun 5c80706f70
Fix for --incompatible_no_support_tools_in_action_inputs on Windows (#157)
Error identified with Bazel CI: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/120#4bcecf1f-c7d3-4de2-ba63-1ea125faa54e
2019-05-28 10:03:39 +02:00
Laurent Le Brun 9aa308e1ef
Fix repository for compatibility with --incompatible_no_support_tools_in_action_inputs (#156) 2019-05-23 20:07:27 +02: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 6126842e3d
copy_file: expose the copying logic (#151)
I plan to use these functions in native_binary()
and native_test().

See https://github.com/bazelbuild/bazel-skylib/issues/148
2019-05-13 16:14:33 +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
c-parsons 84a12d1084
Fix a number of misc issues to allow google usage of bazel-skylib (#146)
* Fix a number of misc issues to allow google usage of bazel-skylib

1. Missing copyright header
2. Shell test fixes to use TEST_TMPDIR to have write access to directories
3. diff_test fix to use TEST_SRCDIR

* added a comment as to why diff_test_tests is local

* ran buildifier
2019-05-07 16:25:43 -04:00
c-parsons 67215655bf
Use TEST_SRCDIR for shell tests (#145)
Fixes https://github.com/bazelbuild/bazel-skylib/issues/143
2019-05-06 15:03:55 -04:00
Sergio Campamá ffad33e9bf Pass through an attribute arguments to `analysistest.make`. (#140)
This allows `analysistest.make` rules to be parameterized.
2019-05-03 16:24:20 -04: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
Justin Ko 184c66e563 Fix installation instructions (#135)
The README is referring to the deprecated git_repository() rule, which
causes in Bazel 0.22.
2019-04-05 13:18:40 +02:00
Matt Passell cc6a6c3ed4 Fix broken link to new_sets doc page (#120) 2019-04-03 20:48:46 +02:00
Thomas Van Lenten 2b1c4610c3
Reformat with buildifier --warnings=all (#138)
Fixes some dictionaries to put things in the more common orders. Buildifer
used to default to doing this check and reformatting which is why the
//conditions:default got moved up in these in the first place.
2019-04-02 11:48:08 -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 4c26bf475c
Windows: fix tests for native test wrapper (#129)
All tests work with
`--incompatible_windows_native_test_wrapper`
except for the ones already broken on Windows
(//tests:analysis_test_e2e_test and
//tests:unittest_e2e_test).

See https://github.com/bazelbuild/bazel/issues/6622
2019-03-26 10:52:27 +01:00
László Csomor 98ef48ebb2
maprule: move functionality to maprule_util.bzl (#132)
maprule_util.bzl will benefit planned new rules
(namely a genrule alternative).
2019-03-25 16:48:50 +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