Skip to content

Instantly share code, notes, and snippets.

@tschaub
Created November 6, 2010 18:50
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 tschaub/665609 to your computer and use it in GitHub Desktop.
Save tschaub/665609 to your computer and use it in GitHub Desktop.
failing compile test
var google = Packages.com.google;
var jscomp = google.javascript.jscomp;
var ImmutableList = google.common.collect.ImmutableList;
var compiler = new jscomp.Compiler();
// assemble compiler options
var options = new jscomp.CompilerOptions();
options.setCodingConvention(new jscomp.ClosureCodingConvention());
// set compilation level
jscomp.CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
// assemble externs
var externs = ImmutableList.of(
jscomp.JSSourceFile.fromCode("extern.js", "")
);
// assemble inputs
var inputs = ImmutableList.of(
jscomp.JSSourceFile.fromCode("input.js", "alert('hello')")
);
// compile
var result = compiler.compile(externs, inputs, options);
var out = compiler.toSource();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment