aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Erik Kuefler <ekuefler@gmail.com>2016-02-05 21:54:28 +0000
committerGravatar David Chen <dzc@google.com>2016-02-07 11:32:59 +0000
commit26152a6fc8db13f82553770b675e1a355a8e17ae (patch)
tree68769e39f8962df7a8efcaa60cc2d4eae63b98cb /tools
parentd65e97a5a771be2e7bfd0de313fd0d1226b36298 (diff)
When building Groovy jars, read the list of classes from a file instead of passing them on the command line.
This helps avoid problems when the OS rejects the command line for getting too long, which is particularly likely on OS X. -- Change-Id: I84c7102f15b0162291664df4869f92232d010c8d Reviewed-on: https://bazel-review.googlesource.com/2820 MOS_MIGRATED_REVID=113982499
Diffstat (limited to 'tools')
-rw-r--r--tools/build_defs/groovy/groovy.bzl15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/build_defs/groovy/groovy.bzl b/tools/build_defs/groovy/groovy.bzl
index af3a8e5f98..e503b6b1d6 100644
--- a/tools/build_defs/groovy/groovy.bzl
+++ b/tools/build_defs/groovy/groovy.bzl
@@ -45,12 +45,17 @@ def _groovy_jar_impl(ctx):
" ".join([src.path for src in ctx.files.srcs]),
)
- # Jar them together to produce a single output. To make this work we have
- # to cd into the output directory, run find to locate all of the generated
- # class files, pass the result to cut to trim the leading "./", then pass
- # the resulting paths to the zipper.
+ # Discover all of the generated class files and write their paths to a file.
+ # Run the paths through sed to trim out everything before the package root so
+ # that the paths match how they should look in the jar file.
+ cmd += "find . -name '*.class' | sed 's:^./%s/::' > %s/class_list\n" % (
+ build_output,
+ build_output,
+ )
+
+ # Create a jar file using the discovered paths
cmd += "root=`pwd`\n"
- cmd += "cd %s; $root/%s Cc ../%s `find . -name '*.class' | cut -c 3-`\n" % (
+ cmd += "cd %s; $root/%s Cc ../%s @class_list\n" % (
build_output,
ctx.executable._zipper.path,
class_jar.basename,