aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/build_defs/repo
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
* 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
* 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
* 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
* 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
* Fix typo in http.bzlGravatar Loo Rong Jie2018-06-25
| | | | | | | | #5407 Closes #5450. PiperOrigin-RevId: 201933209
* 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
* 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
* 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
* 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
* Support patching of git repositories as wellGravatar Klaus Aehlig2018-03-01
| | | | | | | | | | By simply sharing the utility function. In this way, we get feature parity between git_repository and http_archive. Fixes #4676. Change-Id: I99b300e42b2f267d8d04fd965f09c24f3ae54f10 PiperOrigin-RevId: 187450644
* external repos: add a Skylark library for common tasksGravatar Klaus Aehlig2018-02-28
| | | | | | | | ...thus avoiding having them several times for the various repository rules, each with slightly different behavior and bugs. Change-Id: I6cec0c0dd0901453458903e226ceb2098a93cdd8 PiperOrigin-RevId: 187306904
* Pass tags from java_import_external rule to the generated java_import rule.Gravatar Googler2018-02-26
| | | | | | | | | | The tags attribute is already implicit on every rule. This also will help power https://github.com/bazelbuild/bazel/issues/1372#issuecomment-364001669 RELNOTES[NEW]: Pass `tags` from `java_import_external` rule to the generated `java_import` rule. PiperOrigin-RevId: 187019602
* http_archive: fix doc-stringGravatar Klaus Aehlig2018-02-20
| | | | | | | | | Since the http_archive inherits the native download_and_extract function, the support of plain tar archives introduced in 4c8fa1bab507fa7f0a1cbeac0724751d9b574f89 applies here as well. Fix the doc strings accordingly. Change-Id: Ica4037215abf7498c3a8ec9f21ac32b2e59e8966 PiperOrigin-RevId: 186293816
* http_archive: allow parameter for a single URLGravatar Klaus Aehlig2018-02-20
| | | | | | | | | | | ...to ease transition from the native http_archive rule. In this way, switching from the native http_archive rule to the skylark one literally is only adding load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") Change-Id: I0d3a16ad9ab046b975ea64c97dd201e7a9d70a6a PiperOrigin-RevId: 186285020
* new_git_repository: support date-based shallow clonesGravatar Klaus Aehlig2018-02-13
| | | | | | | | | | | | | | Add an optional 'shallow_since' parameter to new_git_repository to allow more shallow clones. As opposed to a fixed depths, specifying a date does not get outdated if the branch progresses further. Also, use fully shallow clones if no commit is specified. A (floating) branch or tag can always be cloned in a truly shallow fashion. Improves on #4359. Change-Id: I8459c8f55042c98da2e43f57b7960a291004d26b PiperOrigin-RevId: 185504534
* Fix parameter names in docsGravatar Googler2018-02-12
| | | | | RELNOTES: None PiperOrigin-RevId: 185436886
* git_repository: add missing args to doc stringGravatar Klaus Aehlig2018-02-12
| | | | | Change-Id: Id898aafaf1a5dec16e5639f50981c1051caa70eb PiperOrigin-RevId: 185390071
* http_archive: allow top-level BUILD files to be overriddenGravatar Klaus Aehlig2018-02-01
| | | | | | | | | ..by the `build_file` parameter, even if the external repository contains a top-level BUILD file. While there, also add a test verifying that this is also possible via the `build_file_content`. Change-Id: I1b875c147cfcd6f1c70b8efeb10c2b406eeacf6a PiperOrigin-RevId: 184134041
* http_archive: remove outdated commentGravatar Klaus Aehlig2018-02-01
| | | | | | | | http_archive from @bazel_tools does know how to bring its own BUILD file by now. Change-Id: I9bbda6635f4459b77600e9ee6db3284f826d7931 PiperOrigin-RevId: 184129975
* Change git clone to pull all history, so all needed commits can be accessed.Gravatar John Cater2018-01-30
| | | | | | | Fixes #4537. Change-Id: I28afcbc89e230e319788c2426e57d43c1ad5dfee PiperOrigin-RevId: 183827742
* http_archive: work around #2700Gravatar Klaus Aehlig2018-01-25
| | | | | | | | | | Move the print statement about the used BUILD file earlier in the _http_archive_impl function, so that the BUILD file is accessed before we call out to the network for the first time. In this way, we avoid fetching the same file twice in a single build. Change-Id: I2b9be4e6a00da2de0cde56896d84c0ba9721456d PiperOrigin-RevId: 183251555
* http_archive: allow using the shipped BUILD fileGravatar Klaus Aehlig2018-01-23
| | | | | | | | | | Bazel may also depend on external repositories that already contain build files. When using http_archive from @bazel_tools also support that use case, by supporting simply omitting `build_file` and `build_file_contents`. Change-Id: I40a9b85ae0aba850c73104d2e2fe7f7ee814e093 PiperOrigin-RevId: 182893460
* http_archive: support programmatic patchingGravatar Klaus Aehlig2018-01-16
| | | | | | | | | | | Support applying a sequence of commands to an http_archive, after the patch files are applied. In this way, tasks like shebang-fixes can easily be added. Fixes #3395. Change-Id: Ifdad584a852efd425c436d57ef71a0d681488629 PiperOrigin-RevId: 182037265
* Support patches in http_archiveGravatar Klaus Aehlig2018-01-15
| | | | | | | | | | | Support applying a sequence of patches for external repositories imported via http_archive. (Note that we only support the version from @bazel_tools, not the deprecated native rules.) Works towards #3395. Change-Id: I96c746acc04790b051eb686856c04a3ff3c90059 PiperOrigin-RevId: 181975322
* Use BAZEL_SH if available instead of hard-coding bash in git.bzlGravatar Dmitry Lomov2018-01-15
| | | | | | | Fixes #3699. Change-Id: I44028476be96037334a1ae48de450d625925676f PiperOrigin-RevId: 181962926
* Add support for strip_prefix to {new_}git_repository skylark rulesGravatar Ed Baunton2018-01-10
| | | | | | | | | | | | Continuation of https://github.com/bazelbuild/bazel/pull/4356 An approach at supporting strip_prefix with the git skylark rules. This approach unfortunately uses symlinks since you cannot clone a subset of a git repository. It creates a tmp directory which is the 'real' clone and then provides a link in place of the expected location of the repository to the path of the required prefix. Behaviour is only changed if a strip_prefix is provided. Closes #4368. PiperOrigin-RevId: 181438640
* Use --depth=1 on git clone for git_repository skylark rulesGravatar Ed Baunton2018-01-08
| | | | | | | | Fixes https://github.com/bazelbuild/bazel/issues/4359 Closes #4360. PiperOrigin-RevId: 181161619
* fix git.bzl error when outputRoot is in a git repoGravatar kabakaev2018-01-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `_clone_or_update()` should `git clone` external repositories only if repo is absent. Unfortunately, it may happen that the bazel outputRoot (~/.cache/bazel by default) is a subdirectory of some other git working copy. For example, user may track his whole home directory in git and add `.config` to .gitignore. In that case, it is not enough to check if the cache dir is a git repo. One must check that the cache dir holds a root of a git working copy. In other words, the `.git` folder must be in the repo dir, not on any level above. * Steps to reproduce ```bash cd ~/.cache git init cd /some/project/that/uses/bazel-git_repository mv WORKSPACE WORKSPACE.orig (echo "load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository')" ; cat WORKSPACE.orig) > WORKSPACE bazel --batch build :all || echo "Ah, there is a bug" ``` Read on for definitive info. * clone any project that uses `git_repository` ```bash [arch@archlinux bazelbuild]$ git clone https://github.com/bazelbuild/bazel-watcher.git [arch@archlinux bazelbuild]$ cd bazel-watcher ``` * enable Skylark implementation of `git_repository` as documented in https://github.com/bazelbuild/bazel/issues/1408#issuecomment-276815467 ```bash [arch@archlinux bazel-watcher]$ mv WORKSPACE WORKSPACE.orig [arch@archlinux bazel-watcher]$ (echo "load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository')" ; cat WORKSPACE.orig) > WORKSPACE [arch@archlinux bazel-watcher]$ grep -v ^# WORKSPACE |head -n4 load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository') git_repository( name = "com_github_bazelbuild_bazel_integration_testing", ``` * (optionally) define custom Bazel `outputRoot` directory (default is ~/.cache/bazel) ```bash [arch@archlinux bazel-watcher]$ rm -rf /tmp/.cache/ ; mkdir /tmp/.cache/ [arch@archlinux bazel-watcher]$ export TEST_TMPDIR=/tmp/.cache/bazel ``` * try building the project to make sure everything works as expected ```bash [arch@archlinux bazel-watcher]$ bazel --batch build :all INFO: $TEST_TMPDIR defined: output root default is '/tmp/.cache/bazel' and max_idle_secs default is '15'. Extracting Bazel installation... WARNING: /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/com_github_bazelbuild_bazel_integration_testing/WORKSPACE:1: Workspace name in /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/com_github_bazelbuild_bazel_integration_testing/WORKSPACE (@build_bazel_integration_testing) does not match the name given in the repository's definition (@com_github_bazelbuild_bazel_integration_testing); this will cause a build error in future versions INFO: Analysed target //:go_prefix (6 packages loaded). INFO: Found 1 target... Target //:go_prefix up-to-date (nothing to build) INFO: Elapsed time: 15.088s, Critical Path: 0.05s INFO: Build completed successfully, 1 total action [arch@archlinux bazel-watcher]$ echo $? 0 ``` * reproduce the issue by placing the `outputRoot` under a git working copy ```bash [arch@archlinux bazel-watcher]$ rm -rf /tmp/.cache/ ; mkdir /tmp/.cache/ [arch@archlinux bazel-watcher]$ cd /tmp/.cache/ ; git init Initialized empty Git repository in /tmp/.cache/.git/ [arch@archlinux .cache]$ cd - [arch@archlinux bazel-watcher]$ bazel --batch build :all INFO: $TEST_TMPDIR defined: output root default is '/tmp/.cache/bazel' and max_idle_secs default is '15'. Extracting Bazel installation... ERROR: error loading package '': Encountered error while reading extension file 'tools/repositories.bzl': no such package '@com_github_bazelbuild_bazel_integration_testing//tools': Traceback (most recent call last): File "/tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/bazel_tools/tools/build_defs/repo/git.bzl", line 69 _clone_or_update(ctx) File "/tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/bazel_tools/tools/build_defs/repo/git.bzl", line 44, in _clone_or_update fail(("error cloning %s:\n%s" % (ctx....))) error cloning com_github_bazelbuild_bazel_integration_testing: + cd /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external + cd /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/com_github_bazelbuild_bazel_integration_testing + git reset --hard 55a6a70dbcc2cc7699ee715746fb1452788f8d3c fatal: Could not parse object '55a6a70dbcc2cc7699ee715746fb1452788f8d3c'. + git fetch origin 55a6a70dbcc2cc7699ee715746fb1452788f8d3c:55a6a70dbcc2cc7699ee715746fb1452788f8d3c fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ERROR: error loading package '': Encountered error while reading extension file 'tools/repositories.bzl': no such package '@com_github_bazelbuild_bazel_integration_testing//tools': Traceback (most recent call last): File "/tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/bazel_tools/tools/build_defs/repo/git.bzl", line 69 _clone_or_update(ctx) File "/tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/bazel_tools/tools/build_defs/repo/git.bzl", line 44, in _clone_or_update fail(("error cloning %s:\n%s" % (ctx....))) error cloning com_github_bazelbuild_bazel_integration_testing: + cd /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external + cd /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/com_github_bazelbuild_bazel_integration_testing + git reset --hard 55a6a70dbcc2cc7699ee715746fb1452788f8d3c fatal: Could not parse object '55a6a70dbcc2cc7699ee715746fb1452788f8d3c'. + git fetch origin 55a6a70dbcc2cc7699ee715746fb1452788f8d3c:55a6a70dbcc2cc7699ee715746fb1452788f8d3c fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. INFO: Elapsed time: 4.974s FAILED: Build did NOT complete successfully (0 packages loaded) ``` * let's find out why it failed ```bash [arch@archlinux bazel-watcher]$ grep rev-parse /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/bazel_tools/tools/build_defs/repo/git.bzl if ! ( cd '{dir}' && git rev-parse --git-dir ) >/dev/null 2>&1; then [arch@archlinux bazel-watcher]$ cd /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/com_github_bazelbuild_bazel_integration_testing [arch@archlinux com_github_bazelbuild_bazel_integration_testing]$ git rev-parse --git-dir /tmp/.cache/.git [arch@archlinux com_github_bazelbuild_bazel_integration_testing]$ cd - ``` * let's fix git.bzl ```bash [arch@archlinux bazel-watcher]$ sed -i -E 's/git rev-parse --git-dir/[[ "$(git rev-parse --git-dir)" == '.git' ]]/' /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/bazel_tools/tools/build_defs/repo/git.bzl [arch@archlinux bazel-watcher]$ grep rev-parse /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/bazel_tools/tools/build_defs/repo/git.bzl if ! ( cd '{dir}' && [[ "$(git rev-parse --git-dir)" == .git ]] ) >/dev/null 2>&1; then ``` * make sure that Bazel works again ```bash [arch@archlinux bazel-watcher]$ ls -a /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/com_github_bazelbuild_bazel_integration_testing . .. [arch@archlinux bazel-watcher]$ bazel --batch build :all INFO: $TEST_TMPDIR defined: output root default is '/tmp/.cache/bazel' and max_idle_secs default is '15'. Error: corrupt installation: file '/tmp/.cache/bazel/_bazel_arch/install/f20169627a8110e2cc3d005319e97c94/_embedded_binaries/embedded_tools/tools/build_defs/repo/git.bzl' modified. Please remove '/tmp/.cache/bazel/_bazel_arch/install/f20169627a8110e2cc3d005319e97c94' and try again. [arch@archlinux bazel-watcher]$ touch -m -t 202712120101 /tmp/.cache/bazel/_bazel_arch/install/f20169627a8110e2cc3d005319e97c94/_embedded_binaries/embedded_tools/tools/build_defs/repo/git.bzl [arch@archlinux bazel-watcher]$ bazel --batch build :all INFO: $TEST_TMPDIR defined: output root default is '/tmp/.cache/bazel' and max_idle_secs default is '15'. WARNING: /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/com_github_bazelbuild_bazel_integration_testing/WORKSPACE:1: Workspace name in /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/com_github_bazelbuild_bazel_integration_testing/WORKSPACE (@build_bazel_integration_testing) does not match the name given in the repository's definition (@com_github_bazelbuild_bazel_integration_testing); this will cause a build error in future versions INFO: Analysed target //:go_prefix (6 packages loaded). INFO: Found 1 target... Target //:go_prefix up-to-date (nothing to build) INFO: Elapsed time: 13.318s, Critical Path: 0.07s INFO: Build completed successfully, 1 total action [arch@archlinux bazel-watcher]$ ls -a /tmp/.cache/bazel/_bazel_arch/f2207b308c89ea5d32323052637210b1/external/com_github_bazelbuild_bazel_integration_testing . .. AUTHORS bazel_integration_test bazel_integration_test.bzl bazel_version.bzl BUILD .ci CODEOWNERS CONTRIBUTING.md .git .gitignore go java javatests LICENSE README.md tools WORKSPACE ``` Closes #4358. PiperOrigin-RevId: 181151078
* Remove usages of `+` on dictsGravatar vladmos2018-01-03
| | | | | | | | | The `+` operator on dicts is deprecated and will be removed. This change makes Bazel files compatible with the new behavior. Fixes #4346. PiperOrigin-RevId: 180702882
* Expressly fetch remote and ref when using git_repositoryGravatar Ed Baunton2017-11-29
| | | | | | | | | | | | | | | | When I clone from a git repo that doesn't have the default branch the same as the branch that I want ; it doesn't seem to fetch the appropriate branch. I am using a name rather than explicit sha. What happens is: ``` + git reset --hard build-with-bazel fatal: ambiguous argument 'build-with-bazel': unknown revision or path not in the working tree. ``` because it hasn't fetched that ref. Closes #4039. PiperOrigin-RevId: 177298578
* Add deps attributes to the Skylark maven_{a,j}ar rules.Gravatar ajmichael2017-11-14
| | | | | | | | | | | | | | | | | | | | | | | | | | The deps are passed through into the generated java_import and aar_import rules. This is necessary for AARs with resource dependencies since maven_aar ignores transitive dependencies. It's less significant for the Java rules, since typically JARs on Maven are compiled class files and as such only have runtime dependencies. Example usage: ``` # WORKSPACE load("@bazel_tools//tools/build_defs/repo:maven_rules.bzl", "maven_aar") maven_aar( name = "android_image_cropper", artifact = "com.theartofdev.edmodo:android-image-cropper:2.3.1", deps = [ "@androidsdk//com.android.support:appcompat-v7-24.1.1", ], ) ``` Fixes https://github.com/bazelbuild/bazel/issues/2863. Fixes https://github.com/bazelbuild/bazel/issues/3980. Also, cleans up some broken stuff in the tests (sadly, they don't run on jenkins, so nothing caught that they were broken). test_maven_jar_with_classifier_skylark still does not work, so I disabled. RELNOTES: Add deps attribute to Skylark maven_aar and maven_jar workspace rules. PiperOrigin-RevId: 175698282
* Update java.bzl best practices regarding HTTPSGravatar jart2017-11-10
| | | | | | | | | | | While HTTP is faster and SHA256 already guaranteed data hasn't been tampered with, it does give visibility over the wire regarding which jars are being transmitted. The true purpose of this change is to bring these practices into greater consistency with Google's broader vision of using HTTPS as much as possible. PiperOrigin-RevId: 175328286