diff options
author | Erik Kuefler <ekuefler@gmail.com> | 2015-09-02 12:45:35 +0000 |
---|---|---|
committer | Florian Weikert <fwe@google.com> | 2015-09-02 13:36:00 +0000 |
commit | 0ec12165ee8406b4b6382b5779f50e73d8a2693e (patch) | |
tree | b4b9dc0ea32af537223920886f571515e3fb8404 /tools | |
parent | 4202000465878e5252744f7c32cf39fe41393b9c (diff) |
Tweak groovy rules to get their dependencies from //external instead of relying
on @ targets.
This makes them easier to use in third-party repos since the user only has to
define bindings in their WORKSPACE to whatever artifacts they want, rather than
having to provide artifacts with an exact name. Related to #409.
--
Change-Id: Ifc17bc5e7205ce5ce23d2ed1a72dd9ad93e42b97
Reviewed-on: https://bazel-review.googlesource.com/1940
MOS_MIGRATED_REVID=102135202
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build_defs/groovy/README.md | 14 | ||||
-rw-r--r-- | tools/build_defs/groovy/groovy.WORKSPACE | 31 | ||||
-rw-r--r-- | tools/build_defs/groovy/groovy.bzl | 7 |
3 files changed, 28 insertions, 24 deletions
diff --git a/tools/build_defs/groovy/README.md b/tools/build_defs/groovy/README.md index a4d42cef4b..27fb73d31b 100644 --- a/tools/build_defs/groovy/README.md +++ b/tools/build_defs/groovy/README.md @@ -16,11 +16,15 @@ libraries and vice-versa. <a name="setup"></a> ## Setup -To be able to use the Groovy rules, you must make the Groovy libraries and -binaries available to Bazel. Groovy tests also require JUnit and Hamcrest to be -available at a known location. The easiest way to do so is by copying the -content of `groovy.WORKSPACE` to your workspace file and putting `groovy.BUILD` -at the root of your workspace. +To be able to use the Groovy rules, you must provide bindings for the following +targets: + + * `//external:groovy`, pointing at the core Groovy library + * `//external:groovyc`, pointing at the Groovy compiler + * `//external:junit`, pointing at JUnit (only required if using `groovy_test`) + +The easiest way to do so is by copying the content of `groovy.WORKSPACE` to your +workspace file and putting `groovy.BUILD` at the root of your workspace. <a name="basic-example"></a> ## Basic Example diff --git a/tools/build_defs/groovy/groovy.WORKSPACE b/tools/build_defs/groovy/groovy.WORKSPACE index ce196ba013..c1aa147523 100644 --- a/tools/build_defs/groovy/groovy.WORKSPACE +++ b/tools/build_defs/groovy/groovy.WORKSPACE @@ -1,27 +1,28 @@ +bind( + name = "groovyc", + actual = "@groovy-bin//:groovyc", +) new_http_archive( name = "groovy-bin", url = "http://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.4.zip", sha256 = "a7cc1e5315a14ea38db1b2b9ce0792e35174161141a6a3e2ef49b7b2788c258c", - build_file = "tools/build_defs/groovy/groovy.BUILD", + build_file = "groovy.BUILD", ) -maven_jar( +bind( name = "groovy", - group_id = "org.codehaus.groovy", - artifact_id = "groovy-all", - version = "2.3.7", + actual = "@groovy-jar//jar", ) - maven_jar( - name = "hamcrest", - group_id = "org.hamcrest", - artifact_id = "hamcrest-core", - version = "1.3", + name = "groovy-jar", + artifact = "org.codehaus.groovy:groovy-all:2.3.7", ) -maven_jar( +bind ( name = "junit", - group_id = "junit", - artifact_id = "junit", - version = "4.12", -)
\ No newline at end of file + actual = "@junit-jar//jar", +) +maven_jar( + name = "junit-jar", + artifact = "junit:junit:4.12", +) diff --git a/tools/build_defs/groovy/groovy.bzl b/tools/build_defs/groovy/groovy.bzl index 3b65b8d707..c9da7b6ed7 100644 --- a/tools/build_defs/groovy/groovy.bzl +++ b/tools/build_defs/groovy/groovy.bzl @@ -70,7 +70,7 @@ _groovy_jar = rule( mandatory=False, allow_files=FileType([".jar"])), "_groovyc": attr.label( - default=Label("@groovy-bin//:groovyc"), + default=Label("//external:groovyc"), single_file=True), "_jar": attr.label( default=Label("//third_party/ijar:zipper"), @@ -202,9 +202,8 @@ groovy_test = rule( executable=True, single_file=True), "_implicit_deps": attr.label_list(default=[ - Label("@groovy//jar"), - Label("@hamcrest//jar"), - Label("@junit//jar"), + Label("//external:groovy"), + Label("//external:junit"), ]), }, test = True, |