aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/build_defs/repo
Commit message (Collapse)AuthorAge
* 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
* Add tests for the Skylark-based implementation of git repository rules.Gravatar John Cater2017-10-11
| | | | | | | Fixes #3825. Change-Id: I59cb0edb50af30991153a1a684e613853df22dd2 PiperOrigin-RevId: 171687620
* Introduce java_import_externalGravatar jart2017-08-09
| | | | | | | | This Skylark rule is a replacement for maven_jar. See also #1410 PiperOrigin-RevId: 164642813
* Fix lint errors in git.bzl and change ctx.fail to the correct fail.Gravatar jcater2017-06-09
| | | | PiperOrigin-RevId: 158397972
* Name generated BUILD files `BUILD.bazel` to avoid name conflicts.Gravatar John Millikin2017-06-08
| | | | | | | | | | | | This allows `new_git_repository` to depend on codebases with pre-existing `BUILD` files from other tools, or `build/` directories in case-insensitive file systems. Fixes #3127 Closes #3142. PiperOrigin-RevId: 158392078
* Fix skylark syntax error in Bazel git_repositories.bzl.Gravatar Adam Michael2017-02-02
| | | | | | | | Identified in https://github.com/bazelbuild/bazel/issues/1408. -- PiperOrigin-RevId: 146308540 MOS_MIGRATED_REVID=146308540
* maven_rules.bzl: Fix maven coordinates order mismatch Gravatar David Ostrovsky2017-01-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Classifier should be provided in the form: "groupId:artifactId:version[:packaging][:classifier]" because that's what maven-dependency-plugin expects and not in the form: "groupId:artifactId[:packaging][:classifier]:version" as documented here: [1]. Also it was missed to reflect the classifier in the output artifact name. TEST PLAN: WORKSPACE: load("//tools:maven_rules.bzl", "maven_jar", "maven_dependency_plugin") maven_dependency_plugin() maven_jar( name = "jetty_server_sources", artifact = "org.eclipse.jetty:jetty-server:9.3.11.v20160721:jar:sources", sha1 = "b23cac190808baed928260b2c9beca3b1ed232b4", ) BUILD: java_library( name = "jetty-server-sources", exports = ["@jetty_server_sources//jar"], ) $ bazel build :jetty-server-sources [...] Target //:jetty-server-sources up-to-date: bazel-bin/libjetty-server-sources.jar [1] https://maven.apache.org/pom.html#Maven_Coordinates Fixes #2049. -- Change-Id: I3297fb3676324cc6b4bb6ff6b2b6e18ce33f633c Reviewed-on: https://cr.bazel.build/7213 PiperOrigin-RevId: 144972944 MOS_MIGRATED_REVID=144972944
* Rollback of commit b9f914fa56a00530d38b597dc853aad50d1decfb.Gravatar Kristina Chodorow2016-12-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks CI "Parameter 'url' has no default value", see http://ci.bazel.io/view/Bazel%20bootstrap%20and%20maintenance/job/Bazel/JAVA_VERSION=1.7,PLATFORM_NAME=linux-x86_64/1104/console. *** Original change description *** Make Bazel build dot This change has several parts, it: * Adds a "make" repository rule, which runs ./configure && make on a repository. * Modifies the tar.gz decompressor to restore timestamps. This was an issue with dot, as make examines the timestamp to determine if files need to be rebuilt. Because Bazel was not preserving the archive's timestamp, it was rebuilding things that it did not need to (and, I think, exposed some bugs in dot's Makefile). * Actually add dot as an externa... *** -- PiperOrigin-RevId: 142469299 MOS_MIGRATED_REVID=142469299
* Make Bazel build dotGravatar Kristina Chodorow2016-12-19
| | | | | | | | | | | | | | | | | | | | | | This change has several parts, it: * Adds a "make" repository rule, which runs ./configure && make on a repository. * Modifies the tar.gz decompressor to restore timestamps. This was an issue with dot, as make examines the timestamp to determine if files need to be rebuilt. Because Bazel was not preserving the archive's timestamp, it was rebuilding things that it did not need to (and, I think, exposed some bugs in dot's Makefile). * Actually add dot as an external repository. I made the dot-graph target manual, so it won't be downloaded/built by the default //... target. * Remove dot scrubbing from the Bazel export process. * Added some names to download_and_extract params, because it's really annoying to only be able to reference them positionally. -- PiperOrigin-RevId: 142452055 MOS_MIGRATED_REVID=142452055
* Make the settings attribute of Skylark maven_jar and maven_aar a label.Gravatar Adam Michael2016-12-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes https://github.com/bazelbuild/bazel/issues/2117. The settings attribute allows you to optional specify a custom Maven settings.xml file as a label. Previously, this attribute was an absolute path. As an absolute path it cannot really be used to specify a file in the workspace because each developer may install the workspace in a different location. And if the settings.xml cannot be included in the workspace, the developers may as well use one of Maven's default locations for settings.xml. Now the attribute is a label. An example use case is: $ cat WORKSPACE load("@bazel_tools//tools/build_defs/repo:maven_rules.bzl") maven_jar( name = "guava", artifact = "com.google.guava:guava:19.0", settings = "//:my_custom_settings.xml", ) $ cat BUILD java_library( srcs = glob(["**/*.java"]), deps = ["@guava//jar"], ) $ cat my_custom_settings.xml <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <mirrors> <mirror> <id>planetmirror.com</id> <name>PlanetMirror Australia</name> <url>http://downloads.planetmirror.com/pub/maven2</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors> </settings> Note that `settings = "my_custom_settings.xml"` will not work as the workspace rule will not know to look in the main workspace. RELNOTES[INC]: Skylark maven_jar and maven_aar settings attribute is now a label so it can be checked into your workspace. -- PiperOrigin-RevId: 140861633 MOS_MIGRATED_REVID=140861633
* Enable fallback URLs in Skylark http rules.Gravatar David Chen2016-12-01
| | | | | | | RELNOTES: Enable fallback URLs in Skylark http rules. -- MOS_MIGRATED_REVID=140630438
* Skylark implementations of http_archive, new_http_archive, and http_file rules.Gravatar David Chen2016-11-21
| | | | | | | RELNOTES: Skylark implementations of http_archive, new_http_archive, and http_file. -- MOS_MIGRATED_REVID=139633771
* Creates maven_aar rule to generate aar_import for AARs from Maven.Gravatar Adam Michael2016-11-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/bazelbuild/bazel/issues/561. To use this rule, you will need to include the following line in your WORKSPACE file: load("@bazel_tools//tools/build_defs/repo:maven_rules.bzl", "maven_aar") After that, you can use the maven_aar repository rule in your WORKSPACE file as such: maven_aar( name = "facebook_android_sdk", artifact = "com.facebook.android:facebook-android-sdk:3.19.0", ) Then in your BUILD files, your android_library and android_binary targets can depend on the AAR with the following syntax: android_binary( name = "my_app", ... deps = [ "@facebook_android_sdk//aar", ... ], ) The resources, classes and native libs from the AAR will be provided. Note however that some features of AAR files are not yet supported, including assets, Proguard maps and lint jars. -- MOS_MIGRATED_REVID=138575421
* Implementation of maven_jar rule in Skylark.Gravatar Jingwen Chen2016-09-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | **Experimental** This is an initial implementation of the maven_jar rule in Skylark, targeted at the FRs in issue #1410. Implemented a wrapper around the maven binary to pull dependencies from remote repositories into a directory under {output_base}/external. Attributes `name`, `artifact`, `repository`, `sha1` have been implemented, but not `server`. Caveat: this rule assumes that the Maven dependency is installed in the system. Hence, the maven_skylark_test integration tests are tagged with "manual" and commented out because the Bazel CI isn't configured with the Maven binary yet. Added a serve_not_found helper for 404 response tests. Usage: ``` load("@bazel_tools//tools/build_defs/repo:maven_rules.bzl", "maven_jar") maven_jar( name = "com_google_guava_guava", artifact = "com.google.guava:guava:18.0", sha1 = "cce0823396aa693798f8882e64213b1772032b09", repository = "http://uk.maven.org/maven2", ) ``` With regards to server, there are some limitations with retrieving a maven_server's attribute at Loading Phase without the use of hacky macros (issue #1704), and even if macros are used, the maven_server is not treated as an actual dependency by maven_jar. There is a test (`test_unimplemented_server_attr`) to ensure that the error message to shown to users if they use the server attribute with this rule. -- Change-Id: I167f9d13835c30be971928b4cc60167a8e396893 Reviewed-on: https://bazel-review.googlesource.com/c/5770 MOS_MIGRATED_REVID=133971809
* Move Skylark git_repository rules to git.bzl.Gravatar David Chen2016-09-14
| | | | | | | | | | | | | | The main motivations for this are: * This makes the load label for the Skylark git rules cleaner. * I am planning to add similar rules, such as hg.bzl, in the future. Tagging #1408 for FYI RELNOTES: Move Skylark git_repository rules to git.bzl -- MOS_MIGRATED_REVID=133094634
* Add Skylark definitions of {new_,}git_repository.Gravatar Nelson Elhage2016-07-27
-- Change-Id: I2c5f09b10430963a1668ec7c842992bc89bfd7b4 Reviewed-on: https://bazel-review.googlesource.com/#/c/3982 MOS_MIGRATED_REVID=128453417