From 8b04d234d4233bab989292af8bdc2184f5881a74 Mon Sep 17 00:00:00 2001 From: Jim Evans Date: Mon, 21 Nov 2016 12:33:46 -0800 Subject: [PATCH] Modifying crazyfun Closure compilation to read command-line flags from file Because of the large number of JavaScript files we pass through the Closure compiler for some targets, we are running over the 8192 character limit of the command line in Windows. The workaround is to have the Closure compiler read its command-line flags from a file instead. --- rake-tasks/crazy_fun/mappings/javascript.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rake-tasks/crazy_fun/mappings/javascript.rb b/rake-tasks/crazy_fun/mappings/javascript.rb index 332459358b89b..51bc6442995b4 100644 --- a/rake-tasks/crazy_fun/mappings/javascript.rb +++ b/rake-tasks/crazy_fun/mappings/javascript.rb @@ -557,20 +557,25 @@ def handle(fun, dir, args) flags.push("--js_output_file=#{output}") - cmd = "java -cp third_party/closure/bin/compiler.jar com.google.javascript.jscomp.CommandLineRunner " << - flags.join(" ") << + expanded_flags = flags.join(" ") << " --js='" << all_deps.join("' --js='") << "'" if (args[:externs]) args[:externs].each do |extern| - cmd << " --externs=#{File.join(dir, extern)} " + expanded_flags << " --externs=#{File.join(dir, extern)} " end end mkdir_p File.dirname(output) + flag_file = File.join(File.dirname(output), "closure_flags.txt") + File.open(flag_file, 'w') {|f| f.write(expanded_flags)} + + cmd = "java -cp third_party/closure/bin/compiler.jar com.google.javascript.jscomp.CommandLineRunner --flagfile " << flag_file sh cmd + + rm_rf flag_file end end end