Created
October 18, 2011 19:54
-
-
Save gatapia/1296502 to your computer and use it in GitHub Desktop.
PicNet Closure Compiler - Ignoring the goog namespace and the externs.zip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package picnet.closurecompiler; | |
import java.util.Collection; | |
import java.util.Map; | |
import java.util.Set; | |
import java.util.Map.Entry; | |
import picnet.closurecompiler.pass.*; | |
import com.google.common.collect.HashMultimap; | |
import com.google.common.collect.ImmutableSet; | |
import com.google.common.collect.Multimap; | |
import com.google.common.collect.Multiset; | |
import com.google.javascript.jscomp.*; | |
public class PicNetCommandLineRunner extends CommandLineRunner { | |
protected PicNetCommandLineRunner(String[] args) { super(args); } | |
@Override | |
protected CompilerOptions createOptions() { | |
CompilerOptions options = super.createOptions(); | |
options.setCodingConvention(new GoogleCodingConvention()); | |
options.addWarningsGuard(new ShowByPathWarningsGuard("goog", ShowByPathWarningsGuard.ShowType.EXCLUDE)); | |
options.addWarningsGuard(new ShowByPathWarningsGuard("externs.zip", ShowByPathWarningsGuard.ShowType.EXCLUDE)); | |
/* | |
options.checkFunctions = CheckLevel.WARNING; | |
options.checkMethods = CheckLevel.WARNING; | |
options.checkDuplicateMessages = true; | |
options.checkSuspiciousCode = true; | |
options.checkControlStructures = true; | |
options.checkTypes = true; | |
options.checkTypedPropertyCalls = true; | |
options.reportMissingOverride = CheckLevel.WARNING; | |
options.checkRequires = CheckLevel.WARNING; | |
options.checkProvides = CheckLevel.WARNING; | |
options.brokenClosureRequiresLevel = CheckLevel.WARNING; | |
options.checkUnreachableCode = CheckLevel.WARNING; | |
options.checkMissingReturn = CheckLevel.WARNING; | |
options.setCodingConvention(new GoogleCodingConvention()); | |
*/ | |
options.customPasses = HashMultimap.create(); | |
options.customPasses.put(CustomPassExecutionTime.BEFORE_CHECKS, new BolinsDoubleEqualsPass(getCompiler())); | |
return options; | |
} | |
/** Runs the Compiler */ | |
public static void main(String[] args) { | |
PicNetCommandLineRunner runner = new PicNetCommandLineRunner(args); | |
if (runner.shouldRunCompiler()) { runner.run(); } | |
else { System.exit(-1); } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment