diff options
author | 2015-11-12 16:45:43 +0000 | |
---|---|---|
committer | 2015-11-13 10:18:40 +0000 | |
commit | 3f6599b7039a1686a41bdc6c051713a0d3ca032d (patch) | |
tree | 2c1b93c8d42642115f76cb39aae195fdd104dc95 | |
parent | bfae536431e6b689403703e5af465b074f04b340 (diff) |
Make groovy_binary implicitly depend on the groovy core language jar.
It's not obvious that this is necessary when writing a simple Groovy class that
doesn't directly reference anything from the Groovy runtime, but failure to
include it will result in a mysterious failure to find the main class. This
can trip people up who are writing simple Hello World apps.
--
Change-Id: I8064e537293fa9218efa3ce351dbd693868d0242
Reviewed-on: https://bazel-review.googlesource.com/#/c/2264/
MOS_MIGRATED_REVID=107687283
-rw-r--r-- | tools/build_defs/groovy/README.md | 1 | ||||
-rw-r--r-- | tools/build_defs/groovy/groovy.BUILD | 5 | ||||
-rw-r--r-- | tools/build_defs/groovy/groovy.WORKSPACE | 4 | ||||
-rw-r--r-- | tools/build_defs/groovy/groovy.bzl | 2 |
4 files changed, 11 insertions, 1 deletions
diff --git a/tools/build_defs/groovy/README.md b/tools/build_defs/groovy/README.md index 35275d0e00..0f64d25250 100644 --- a/tools/build_defs/groovy/README.md +++ b/tools/build_defs/groovy/README.md @@ -24,6 +24,7 @@ targets: * `//external:groovy-sdk`, pointing at the [Groovy SDK binaries](http://www.groovy-lang.org/download.html) + * `//external:groovy`, pointing at the Groovy core language jar * `//external:junit`, pointing at JUnit (only required if using `groovy_test`) * `//external:spock`, pointing at Spock (only required if using `spock_test`) diff --git a/tools/build_defs/groovy/groovy.BUILD b/tools/build_defs/groovy/groovy.BUILD index 4f65877a3f..96de6cfdb9 100644 --- a/tools/build_defs/groovy/groovy.BUILD +++ b/tools/build_defs/groovy/groovy.BUILD @@ -3,3 +3,8 @@ filegroup( srcs = glob(["groovy-2.4.4/**"], exclude_directories=0), visibility = ["//visibility:public"], ) +java_import( + name = "groovy", + jars = ["groovy-2.4.4/lib/groovy-2.4.4.jar"], + visibility = ["//visibility:public"], +) diff --git a/tools/build_defs/groovy/groovy.WORKSPACE b/tools/build_defs/groovy/groovy.WORKSPACE index 8868d50a96..1bdf6ed480 100644 --- a/tools/build_defs/groovy/groovy.WORKSPACE +++ b/tools/build_defs/groovy/groovy.WORKSPACE @@ -8,6 +8,10 @@ bind( name = "groovy-sdk", actual = "@groovy-sdk-artifact//:sdk", ) +bind( + name = "groovy", + actual = "@groovy-sdk-artifact//:groovy", +) maven_jar( name = "junit-artifact", diff --git a/tools/build_defs/groovy/groovy.bzl b/tools/build_defs/groovy/groovy.bzl index ddfdea6e28..945f905e1e 100644 --- a/tools/build_defs/groovy/groovy.bzl +++ b/tools/build_defs/groovy/groovy.bzl @@ -155,7 +155,7 @@ def groovy_binary(name, main_class, srcs=[], deps=[], **kwargs): """Rule analagous to java_binary that accepts .groovy sources instead of .java sources. """ - all_deps = deps + all_deps = deps + ["//external:groovy"] if srcs: groovy_library( name = name + "-lib", |