Skip to content

Commit 8b04d23

Browse files
committed
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.
1 parent 5c82646 commit 8b04d23

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

rake-tasks/crazy_fun/mappings/javascript.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,20 +557,25 @@ def handle(fun, dir, args)
557557

558558
flags.push("--js_output_file=#{output}")
559559

560-
cmd = "java -cp third_party/closure/bin/compiler.jar com.google.javascript.jscomp.CommandLineRunner " <<
561-
flags.join(" ") <<
560+
expanded_flags = flags.join(" ") <<
562561
" --js='" <<
563562
all_deps.join("' --js='") << "'"
564563

565564
if (args[:externs])
566565
args[:externs].each do |extern|
567-
cmd << " --externs=#{File.join(dir, extern)} "
566+
expanded_flags << " --externs=#{File.join(dir, extern)} "
568567
end
569568
end
570569

571570
mkdir_p File.dirname(output)
572571

572+
flag_file = File.join(File.dirname(output), "closure_flags.txt")
573+
File.open(flag_file, 'w') {|f| f.write(expanded_flags)}
574+
575+
cmd = "java -cp third_party/closure/bin/compiler.jar com.google.javascript.jscomp.CommandLineRunner --flagfile " << flag_file
573576
sh cmd
577+
578+
rm_rf flag_file
574579
end
575580
end
576581
end

0 commit comments

Comments
 (0)