aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/build_defs
Commit message (Collapse)AuthorAge
* Windows: add //tools/... tests to test suiteGravatar Laszlo Csomor2018-08-09
| | | | | | | | | | | | Add all tests under //tools/... to //src:all_windows_tests, to run them on Bazel CI. See https://github.com/bazelbuild/bazel/issues/4292 Closes #5839. Change-Id: Iae647f561683cc50ef62416c4b834576ae918486 PiperOrigin-RevId: 208167743
* external repos: fix typo confusing workspace_file_content and build_file_contentGravatar Klaus Aehlig2018-08-09
| | | | | | | Fixes #5838 Change-Id: Ic5f730f97b43682b1efc537a02c861d49d3606cc PiperOrigin-RevId: 208044984
* git.bzl: also clone branches with --depth=1Gravatar Klaus Aehlig2018-08-08
| | | | | | | | | Cloning branches as added after the fact to the skylark git rules, once recording the actual commit was implemented. Still support shallow cloning also when following branches. Change-Id: Ib7a84de4ada69152e9e7c27e9d84cff39cfd3582 PiperOrigin-RevId: 207866303
* Add option to specify name for downloaded file to http_file skylark ruleGravatar Nicolas Lopez2018-08-07
| | | | | | | | https://github.com/bazelbuild/bazel/issues/5633 Closes #5647. PiperOrigin-RevId: 207706657
* Replace cd with git -C during in git skylark rulesGravatar Ed Baunton2018-08-07
| | | | | | | | Use `git -C` instead of `cd` in git skylark rules to be more concise. I think it's probably better to use the built-in changedir functionality of git rather than `cd`ing around manually. Happy to be overruled however if it makes readability better. Closes #5668. PiperOrigin-RevId: 207703326
* git_repository could use HTTP_PROXY to clone repositoryGravatar wylazy2018-08-07
| | | | | | | | | | git_repository could use HTTP_PROXY to clone repository Fixes #3893. Closes #5674. PiperOrigin-RevId: 207689348
* Fix the ordering of month and day.Gravatar Ed Schouten2018-08-07
| | | | | | | | | | | | | I got an INFO message from Bazel containing the following date string: "shallow_since": "2018-31-07" The code seems to reveal that the date is intended to be YYYY-MM-DD, so change the requested format passed to Git. Closes #5734. PiperOrigin-RevId: 207683709
* Add the action_names_test_files target to the OSS version of ↵Gravatar kaipi2018-08-01
| | | | | | tools/buils_defs/cc/BUILD. PiperOrigin-RevId: 206939687
* Adding option to change the root directory name in build_tar.py and archive.py.Gravatar Googler2018-07-27
| | | | | | | This is required to support Windows Docker image creation. RELNOTES: None PiperOrigin-RevId: 206326316
* git_repository: remove .git directoryGravatar Klaus Aehlig2018-07-17
| | | | | | | | | | | While we do not expect any targets to actually depend on the contents of the .git subdirectory of an external repository, it is still a non-reproducible part of an external git repository, blocking all attempts to demonstrate reproducibility of that the given rule. Change-Id: Id1e08013a8ca33d4b4c4b053b9423f75d771dfc1 PiperOrigin-RevId: 204872242
* Add --incompatible_disable_deprecated_attr_params to disable some deprecated ↵Gravatar cparsons2018-07-16
| | | | | | | parameters of the skylark attr module. RELNOTES: None. PiperOrigin-RevId: 204797954
* http.bzl: Use allow_single_file for labelsGravatar Ed Baunton2018-07-16
| | | | | | | | | | | To match the label declarations in git.bzl, use `allow_single_file` for workspace and build file labels. Per https://docs.bazel.build/versions/master/skylark/lib/attr.html#label this restricts the labels to specify only a single file. Closes #5561. PiperOrigin-RevId: 204773387
* Rewrite swift_binary_test.bzl using new skylark cc toolchain apiGravatar hlopko2018-07-16
| | | | | | | This is a part of the https://github.com/bazelbuild/bazel/issues/4571 effort. RELNOTES: None PiperOrigin-RevId: 204754855
* Use default shell env for Python sha256 toolGravatar Clint Harrison2018-07-11
| | | | | | | | Until we have more complete support for Python runtime/toolchain configurations, it's useful for the hash tool to support `--action_env`, so the user's PATH can optionally be searched by the `py_binary` wrapper. Closes #5451. PiperOrigin-RevId: 204108228
* Document differences between version and version_fileGravatar katre2018-07-10
| | | | | | | | | Add to the documentation that version_file and release_file cannot be used to generate an output with the N-V-R.A naming scheme. Fixes #5522. Closes #5555. PiperOrigin-RevId: 203946762
* pkg: fix documentation (docker -> archive)Gravatar Klaus Aehlig2018-07-10
| | | | | | | pkg_tar creates an archive, not a docker image. Change-Id: I402bd8fdb67c38cd67a3990b983aa3b6d912da37 PiperOrigin-RevId: 203932291
* python tools: ensure files are closedGravatar laszlocsomor2018-07-05
| | | | | | | | | | | Use the "with" statement to open files in various Python scripts used by Bazel, to ensure these files are closed eagerly. See https://github.com/bazelbuild/bazel/issues/5512 RELNOTES: none PiperOrigin-RevId: 203346678
* git_repository: support branch as wellGravatar Klaus Aehlig2018-07-03
| | | | | | | | | Now that git_repository returns the commit actually checked out (and we have means of recording it), support following an active branch of a git repository. Change-Id: I6e152c59b694bbf562b345ee88282a8c9bd58e4c PiperOrigin-RevId: 203110735
* Delete git_repositories.bzl. The file has been a simple redirect to git.bzl ↵Gravatar dannark2018-07-02
| | | | | | | | for well over a year and a half. RELNOTES[INC]: Loading @bazel_tools//tools/build_defs/repo:git_repositories.bzl no longer works. Load @bazel_tools//tools/build_defs/repo:git.bzl instead. PiperOrigin-RevId: 202923049
* Fix typo in docGravatar dannark2018-07-02
| | | | | RELNOTES: None PiperOrigin-RevId: 202914788
* Remove support for header preprocessingGravatar hlopko2018-06-26
| | | | | | | This was never used. We thought it will be useful, but it's not. RELNOTES: None. PiperOrigin-RevId: 202143524
* http_archive: remove noisy debug printsGravatar Jeremy Nimmer2018-06-25
| | | | | | | | | | | | Commit bd16ab9454e624a26c53a0f3fb892e20fb1c36e6 documents that these statements are no longer required to achieve prefetching (as of commit cdc99afc1a03ff8fbbbae088d358b7c029e0d232). Given that many `http_archive` calls will need at least a `build_file`, these debugging prints generate an incredible amount of spam in projects with many external archives. I looked over the rest of the `build_defs/repo` files and none of them have any tracing debug prints, except for `git.bzl` which guards it with an `attr.verbose`. I could rework this to add a verbosity flag if you wish, but it doesn't seem merited for http fetching (unlike git, which is relatively more expensive and can be flaky). Relates to #2700. Closes #5446. PiperOrigin-RevId: 201947174
* Make @bazel_tools//tools/build_defs/cc/action_names.bzl work for bazel osx testsGravatar hlopko2018-06-25
| | | | | RELNOTES: None. PiperOrigin-RevId: 201941079
* Fix typo in http.bzlGravatar Loo Rong Jie2018-06-25
| | | | | | | | #5407 Closes #5450. PiperOrigin-RevId: 201933209
* Automated rollback of commit 5728af65e8b89b9dd3a5ac2b717c93ec5333ca18.Gravatar hlopko2018-06-21
| | | | | | RELNOTES: None. *** Reason for rollback *** PiperOrigin-RevId: 201573394
* Migrate //devtools/clif/python/legacy_match_clif_rule.bzl to the new C++ ↵Gravatar hlopko2018-06-21
| | | | | | | | | | | | | | toolchain API This is a part of the [] This is an encore of unknown commit which includes fixes for: * //miles ([] * clif tests ([] * exoblaze ([] RELNOTES: None. PiperOrigin-RevId: 201541210
* shell tests, windows: enable more testsGravatar Laszlo Csomor2018-06-21
| | | | | | | | | | | | | | | | | | Enable on Windows: //src/test/shell/bazel:bazel_experimental_ui_test //src/test/shell/bazel:bazel_random_characters_test Also document the (surprising) semantics of http_file() on Windows. See https://github.com/bazelbuild/bazel/issues/4292 Change-Id: Id636b9cf03cc8d12449eed2be493dcfc176146c7 Closes #5409. Change-Id: I15677548f2f3fd6b4822e8e6af4b78d8517f953a PiperOrigin-RevId: 201512812
* git_repository: return actual commitGravatar Klaus Aehlig2018-06-15
| | | | | | | | | | | | | | Using that repository rules now may return a non-None value, make git_repository return the arguments that make the rule reproducible; in particular, return the actual commit (instead of a tag) and the date of the commit, so support shallow clones. The added test also demonstrates how the `bazel sync` command together with `--experimental_repository_resolved_file` can be used to replay an earlier state of external dependencies. Change-Id: Ifa1cfdfdb5eb299a15b9d0ec7d285dc84c0bcdc0 PiperOrigin-RevId: 200705705
* Skylark repos: for failed patch command, also report stdoutGravatar Klaus Aehlig2018-06-13
| | | | | | | | | | The patch(1) utility usually gives error messages on stdout. So it is not useful to report only stderr in case a patch failed. Report both. Fixes #5379. Change-Id: Ief198849e29ca989dfdefe2fadf495a0b0949972 PiperOrigin-RevId: 200377306
* Skylark repositories: support additional arguments for the patch toolGravatar Klaus Aehlig2018-06-13
| | | | | | | | | | | | Instead of hard-coding "-p0", allow the arguments for that patch tool to be overridden. In particular, this supports the use case of patches generated with `git format-patch` which are to be read as `-p1`. Improves on #5379. Closes #4974 as superseded. Change-Id: I809fde14beab21d8a755ba4f1706b602bae3c1bb PiperOrigin-RevId: 200373909
* Add support for aar_import_external and aar_maven_import_externalGravatar Jingwen Chen2018-06-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usage example: ```python # In WORKSPACE load("@bazel_tools//tools/build_defs/repo:android.bzl", "aar_import_external", "aar_maven_import_external") # Specify the URL directly: aar_import_external( name = "com_android_support_preference_v14_25_1_0", # required licenses = ["notice"], # required aar_urls = [ # required "https://dl.google.com/dl/android/maven2/com/android/support/preference-v14/25.1.0/preference-v14-25.1.0.aar" ], aar_sha256 = "442473fe5c395ebef26c14eb01d17ceda33ad207a4cc23a32a2ad95b87edfabb", # optional or empty string deps = [ # optional or empty list "@com_android_support_recyclerview_v7_25_1_0//aar", "@com_android_support_appcompat_v7_25_1_0//aar", "@com_android_support_preference_v7_25_1_0//aar", "@com_android_support_support_v4_25_1_0//aar", ], ) # Or, specify the artifact coordinate: aar_maven_import_external( name = "com_android_support_preference_v14_25_1_0", # required artifact = "com.android.support.test:preference-v14:25.1.0", # required sha256 = "442473fe5c395ebef26c14eb01d17ceda33ad207a4cc23a32a2ad95b87edfabb" # optional or empty string licenses = ["notice"], # required server_urls = ["https://maven.google.com"], # required deps = [ # optional or empty list "@com_android_support_recyclerview_v7_25_1_0//aar", "@com_android_support_appcompat_v7_25_1_0//aar", "@com_android_support_preference_v7_25_1_0//aar", "@com_android_support_support_v4_25_1_0//aar", ], ) # In BUILD.bazel android_library( name = "foo", srcs = [...], deps = [ "@com_android_support_preference_v14_25_1_0//aar", ], ) ``` To test this out with gmaven_rules, change the `load` statement in https://github.com/bazelbuild/gmaven_rules/blob/master/gmaven.bzl to ``` load('@bazel_tools//tools/build_defs/repo:android.bzl', 'aar_import_external') load('@bazel_tools//tools/build_defs/repo:java.bzl', 'java_import_external') ``` Fixes https://github.com/bazelbuild/bazel/issues/4654 RELNOTES: New rules for importing Android dependencies: `aar_import_external` and `aar_maven_import_external`. `aar_import_external` enables specifying external AAR dependencies using a list of HTTP URLs for the artifact. `aar_maven_import_external` enables specifying external AAR dependencies using the artifact coordinate and a list of server URLs. Closes #5319. Change-Id: I9517e68ab78f2e30fb6ceabfe3b35061c585d607 PiperOrigin-RevId: 199839047
* Expose C++ action names to SkylarkGravatar hlopko2018-06-07
| | | | | | | | | | | | | | This cl adds Skylark constants allowing users to specify which C++ action they want for the feature configuration Skylark API. This is done by exposing a Skylark file at @bazel_tools//tools/cpp:action_names.bzl. Skylark api to the C++ toolchain doc: https://docs.google.com/document/d/1g91BWJITcYw_X-VxsDC0VgUn5E9g0kRBGoBSpoO41gA/edit#. Progress on #4571. RELNOTES: None. PiperOrigin-RevId: 199596778
* Use BUILD.bazel instead of BUILD for external projectsGravatar Dmitry Petrashko2018-06-05
| | | | | | | | | | While upgrading an internal project from 0.10 to 0.13 we have found that we no longer were able to build one of external non-basel dependencies that already has a lowercase `build` directory in their repo. As the name `BUILD` is much more common than `BUILD.bazel`, in particular on file systems that are case-insensitive, I propose to generate the latter by default. Closes #5146. PiperOrigin-RevId: 199264025
* Make tools in action inputs an error.Gravatar tomlu2018-06-02
| | | | | | | | | | Supporting tools in inputs introduces a slow linear scan. Such tools should be moved to the 'tools' attribute. If --incompatible_no_support_tools_in_action_inputs is set the inputs are scanned, but a helpful error message is issued to the user. Eventually we will remove the slow scanning. Errors will surface in the execution phase instead of during analysis, and the resulting error messages will be less obvious. RELNOTES: None RELNOTES[INC]: With --incompatible_no_support_tools_in_action_inputs enabled, Skylark action inputs are no longer scanned for tools. Move any such inputs to the newly introduced 'tools' attribute. PiperOrigin-RevId: 198996093
* Format all bzl files with buildifierGravatar vladmos2018-06-01
| | | | | | This CL aslo enables a presubmit check for correct formatting of all bzl files in //third_party/bazel. PiperOrigin-RevId: 198857055
* Add ability to add runfiles to tarGravatar Christian Verkerk2018-05-29
| | | | | | Closes #5044. PiperOrigin-RevId: 198399012
* Generaliaze java_import_external to jvm_import_externalGravatar natans2018-05-29
| | | | | | | | | | | | | | | | | | | | | This PR copies "upstream" a change made to java_import_external in`rules_scala` (see [PR](https://github.com/bazelbuild/rules_scala/pull/473)) This change was originally proposed by @dslomov [here](https://github.com/bazelbuild/bazel/issues/3528) (search for 'jvm_import_external') java_import_external was changed to `jvm_import_external` 'template like' rule + `java_import_external` macro in order to allow for other jvm languages (e.g. scala and kotlin) to utilize the 'import_external' functionality without copying the boiler plate again and again. This has already been used in `rules_scala` with the introduction of `scala_import_external` and `scala_maven_import_external` In addition to the `import rule name`, `jvm_import_external` can also be called with custom attributes needed by the underlying import rules, as well as a custom load statement. `java_import_external` is used as a macro in rules_scala to make sure it's still functioning properly after the change. `jvm_maven_import_external` exposes maven artifact terminology. This will also allow to create a `maven_import_external` macro that will delegate to `jvm_maven_import_external` with a `maven_import` rule which will have `MavenCoordinates` Provider as discussed [here](https://github.com/bazelbuild/bazel/issues/4654) Closes #5068. PiperOrigin-RevId: 198398621
* shallow_since tests and doc improvementsGravatar Ed Baunton2018-05-24
| | | | | | | | | | | | This changeset introduces tests for the `shallow_since` functionality that was introduced in 6496b1d1d25025f33406b1eaf9949cab126f08bd. We test that if the user specifies a tag as well as a `shallow_since` that it fails since they are incompatible. We also verify that specifying a commit before the `shallow_since` date causes the clone to fail (albeit currently with a non-useful error message; perhaps that could be improved at a later date). It also documents more clearly how to use the feature by explaining the format of the 'since' string. Closes #5183. PiperOrigin-RevId: 197875727
* git.bzl: fall back to full clone if shallow options are not supportedGravatar Klaus Aehlig2018-05-24
| | | | | | | | | | The `--shallow-since` option of git was introduced only in version 2.11 of git. However, some widely used distributions ship older versions of git. So fall back to fully cloning or fetching a repository if the respective shallow option is not know to the ambient git command used. Change-Id: I8f0aa0a12e294ff9cc8325975bd9333f6bf50939 PiperOrigin-RevId: 197863797
* http.bzl: add http_jarGravatar Klaus Aehlig2018-05-23
| | | | | | | | http_jar is another version of the native http_archive. So add it to the Skylark-implementation as well. Change-Id: Icbaafe18d4836e14b0f5eb09dc3ab0607f9e391d PiperOrigin-RevId: 197719717
* http_archive: Support workspace_file and workspace_file_contentsGravatar Klaus Aehlig2018-05-16
| | | | | | | ...to be fully compatible with the native rules. Change-Id: Ie340f73ec530ef0c8f50215a331f28f523398db8 PiperOrigin-RevId: 196801227
* http.bzl: drop outdated commentGravatar Klaus Aehlig2018-05-15
| | | | | | | | Since cdc99afc1a03ff8fbbbae088d358b7c029e0d232 label arguments are prefetched. So it is no longer necessary to access them early. Change-Id: I6d30bae3ac655387641ffd98f9b9aa95d2f1ece7 PiperOrigin-RevId: 196632853
* Explicitly assign --buildroot in the rpmbuild invocationGravatar mmikitka2018-05-03
| | | | | | | | | | | | | | | Occasionally, I see the following error messages when running a pkg_rpm target: ` INFO: Analysed target //foo/deploy:pkgs (1 packages loaded). INFO: Found 1 target... INFO: From Executing genrule //foo/deploy:pkgs: error: cannot open Packages database in /home/mmikitka/.rpmdb ` This PR explicitly sets the --buildroot to address this error message. Closes #5102. PiperOrigin-RevId: 195254300
* AddFiles will recursively add files when a directory is encounteredGravatar mmikitka2018-05-03
| | | | | | | | This PR provides support for directories as inputs to pkg_rpm, which is useful for RPMs that contain a lot of files, and one doesn't want to exceed the shell argument buffer size. Files are recursively added from the top-level parent directory. Closes #5097. PiperOrigin-RevId: 195211382
* Expose debug parameter to suppress informative print statementsGravatar mmikitka2018-04-18
| | | | | | | | I like to have clean output on successful builds, and this PR suppresses informative print statements, by default, with the option of exposing them, if desired. Closes #5037. PiperOrigin-RevId: 193375345
* Automatic code cleanup.Gravatar laurentlb2018-04-12
| | | | PiperOrigin-RevId: 192587935
* Support for empty_files and empty_dirs in pkg.Gravatar Pawe? Zuzelski2018-03-27
| | | | | | | | | | | | Backport recent changes to build_tar tool in bazelbuild/rules_docker: https://github.com/bazelbuild/rules_docker/pull/310 - add --empty_file and --empty_dir flags to build_tar.py, allowing creation of empty files and dirs with specified mode. - expose those flags as empty_files and empty_dirs parameters to pkg_tar rule. Closes #4837. PiperOrigin-RevId: 190610460
* pkg.bzl: adapt to upcoming incompatible changesGravatar Klaus Aehlig2018-03-26
| | | | | | | | Prepare pkg.bzl to be compliant with upcoming Skylark changes. With this change, one can use pkg_tar even if using --all_incompatible_changes. Change-Id: Iff0ed50bda1f93d9f606b783295b049bdf15d242 PiperOrigin-RevId: 190443156
* Added release and release_file parameters to pkg_rpmGravatar mmikitka2018-03-12
| | | | | | | | | | | | 1. Added the "rpm_nvra" output which follows the recommended package naming convention of *Name-Version-Release.Arch.rpm* (NVRA). See http://ftp.rpm.org/max-rpm/ch-rpm-file-format.html 2. Expose "release" and "release_file" parameters to support the NVRA naming convention 3. Remove the mandatory constraint on version parameters (version or version_file): I want to auto-generate my SPEC file outside of the pkg_rpm rule, and I don't want pkg_rpm altering the file. Closes #4732. PiperOrigin-RevId: 188744806
* Allow templated expansion of data dependency names in the RPM spec file.Gravatar John Cater2018-03-12
| | | | | | | | | | | Fixes #4810, invalidates #4782, and extends #4747. Change-Id: I19426bb30a151358875e9bae0e0c1d92b3818432 Closes #4816. Change-Id: I5d92cec994103e2136c5ed279780f321a42d1bdd PiperOrigin-RevId: 188722982