bazelbuild / rules_groovy

Groovy rules for Bazel
Apache License 2.0
11 stars 28 forks source link

Failure building groovy_binary #8

Open mattmoor opened 7 years ago

mattmoor commented 7 years ago

I get the following failure attempting to get a basic groovy_binary rule working:

$ bazel run java/examples:HelloGroovy 
INFO: Found 1 target...
ERROR: /home/mattmoor/bazel-glibc/java/examples/BUILD:34:1: error executing shell command: 'set -e;rm -rf bazel-out/local-fastbuild/bin/java/examples/libHelloGroovy-lib-impl.jar.build_output
mkdir -p bazel-out/local-fastbuild/bin/java/examples/libHelloGroovy-lib-impl.jar.build_output
expo...' failed: I/O error during sandboxed execution: /home/mattmoor/.cache/bazel/_bazel_mattmoor/4c53d6d0ace4750b3e4c72c352abc709/bazel-sandbox/39470475-730a-411a-b7c5-686dcdefa05c-0/execroot/bazel-glibc/external/groovy_sdk_artifact/groovy-2.4.4/indy (Directory not empty).
Target //java/examples:HelloGroovy failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.208s, Critical Path: 0.02s
ERROR: Build failed. Not running target.

The changes to my repo are trivial:

$ git diff --cached
diff --git a/WORKSPACE b/WORKSPACE
index a1d91ea..6399a9c 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -37,6 +37,16 @@ git_repository(
 load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories")
 scala_repositories()

+# Groovy rules
+git_repository(
+    name = "io_bazel_rules_groovy",
+    remote = "https://github.com/bazelbuild/rules_groovy.git",
+    commit = "02029366fa73e417e51c0beef22e46e6a77d9b91", # update this as needed
+)
+
+load("@io_bazel_rules_groovy//groovy:groovy.bzl", "groovy_repositories")
+groovy_repositories()
+
 # For everything.
 http_file(
    name = "glibc",
diff --git a/java/examples/BUILD b/java/examples/BUILD
index 337a0f2..51bcddc 100644
--- a/java/examples/BUILD
+++ b/java/examples/BUILD
@@ -28,3 +28,11 @@ docker_build(
     files = [":HelloScala_deploy.jar"],
     cmd = ["/HelloScala_deploy.jar"]
 )
+
+load("@io_bazel_rules_groovy//groovy:groovy.bzl", "groovy_binary")
+
+groovy_binary(
+    name = "HelloGroovy",
+    srcs = ["HelloGroovy.groovy"],
+    main_class = "examples.HelloGroovy",
+)
\ No newline at end of file
diff --git a/java/examples/HelloGroovy.groovy b/java/examples/HelloGroovy.groovy
new file mode 100644
index 0000000..0c17331
--- /dev/null
+++ b/java/examples/HelloGroovy.groovy
@@ -0,0 +1,7 @@
+package examples
+
+class HelloGroovy {
+   static void main(String[] args) {
+      println "Hello world"
+   }
+}
\ No newline at end of file

I'm currently using the commit at head with:

$ bazel version
Build label: 0.4.3
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Dec 22 12:31:25 2016 (1482409885)
Build timestamp: 1482409885
Build timestamp as int: 1482409885
mattmoor commented 7 years ago

@damienmg @kchodorow FYI

steren commented 7 years ago

@ekuefler you seem the most active in our Groovy rules, can you take a look?

mattmoor commented 7 years ago

@steren it looks like @ekuefler opened an issue against the Bazel repo (see link above) last year (ouch). Any chance we can get someone to TAL?

ekuefler commented 7 years ago

Yeah, just pinged that bug, still waiting for a response on it before I can look into resolving this

ekuefler commented 7 years ago

@philwo looks to have put together a fix for this, so I've drafted an 0.0.2 release of rules_groovy to try it out.

@mattmoor @robbiexperiel, could you try this out? All you should need to do is update the url and strip_prefix fields for Groovy in your WORKSPACE to refer to 0.0.2, along with updating the sha256 hash to whatever it says. If this solves the problem for you I'll make the release official.

robbiexperiel commented 7 years ago

I just tested on bazel 0.4.5 and it worked! Thanks @philwo and @ekuefler!