Skip to content

Commit

Permalink
Fix 'Argument list too long' error in :merge_licenses genrule
Browse files Browse the repository at this point in the history
We pass every file in //third_party:srcs to merge_licenses.sh and when
trying to update protobuf that list grew too large and caused errors on
macOS.

With xargs we can split the list of files into smaller chunks.

Change-Id: I402813f14e35ca6dac393112ff4f3c963e789536
PiperOrigin-RevId: 154536807
  • Loading branch information
buchgr authored and vladmos committed Apr 28, 2017
1 parent 6fa1721 commit 6e36984
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/google/devtools/build/lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,9 @@ genrule(
"//third_party:srcs",
],
outs = ["runtime/commands/LICENSE"],
cmd = "$(location merge_licenses.sh) $(SRCS) > \"$@\"",
# Use xargs to avoid the shell script complaining that is has been passed too many arguments.
# xargs calls the script multiple times with at most 1000 arguments per call.
cmd = "echo \"$(SRCS)\" | xargs -n1000 $(location merge_licenses.sh) > \"$@\"",
tools = ["merge_licenses.sh"],
)

Expand Down

0 comments on commit 6e36984

Please sign in to comment.