From 3f0d3b68a273250b1bf70c278d0700a1ed30058c Mon Sep 17 00:00:00 2001 From: Jingwen Chen Date: Thu, 22 Sep 2016 17:46:49 +0000 Subject: Implementation of maven_jar rule in Skylark. **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 --- WORKSPACE | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'WORKSPACE') diff --git a/WORKSPACE b/WORKSPACE index ec8dff751f..b06d57f180 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -52,3 +52,8 @@ bind(name = "xcrunwrapper", actual = "@bazel_tools//tools/objc:xcrunwrapper") bind(name = "protobuf/java_runtime", actual = "//third_party/protobuf:protobuf") bind(name = "protobuf/javalite_runtime", actual = "//third_party/protobuf:protobuf-lite") + +# For Skylark tests at //src/test/shell/bazel:maven_skylark_test +# Uncomment the following lines, and the test in src/test/shell/bazel/BUILD to run it. +# load("//tools/build_defs/repo:maven_rules.bzl", "maven_dependency_plugin") +# maven_dependency_plugin() -- cgit v1.2.3