Skip to content

Instantly share code, notes, and snippets.

@gatapia
Created October 18, 2011 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gatapia/1296502 to your computer and use it in GitHub Desktop.
Save gatapia/1296502 to your computer and use it in GitHub Desktop.
PicNet Closure Compiler - Ignoring the goog namespace and the externs.zip
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