// Parse inputs
for (File f : inputs) {
try {
URI fileUri = f.getCanonicalFile().toURI();
ParseTreeNode parsedInput = new ParserContext(mq)
.withInput(new InputSource(fileUri))
.withConfig(meta)
.build();
if (parsedInput == null) {
passed = false;
} else {
compiler.addInput(parsedInput, fileUri);
}
} catch (IOException ex) {
logger.println("Failed to read " + f);
passed = false;
} catch (ParseException ex) {
logger.println("Failed to parse " + f);
ex.toMessageQueue(mq);
passed = false;
} catch (IllegalStateException e) {
logger.println("Failed to configure parser " + e.getMessage());
passed = false;
}
}
// Cajole
passed = passed && compiler.run();
outputJs = passed ? compiler.getJavascript() : null;
outputHtml = passed ? compiler.getStaticHtml() : null;
} else if ("javascript".equals(language)) {
PluginMeta meta = new PluginMeta(fetcher, policy);
passed = true;
JsOptimizer optimizer = new JsOptimizer(mq);
for (File f : inputs) {
try {
if (f.getName().endsWith(".env.json")) {
loadEnvJsonFile(f, optimizer, mq);
} else {
ParseTreeNode parsedInput = new ParserContext(mq)
.withInput(new InputSource(f.getCanonicalFile().toURI()))
.withConfig(meta)
.build();
if (parsedInput != null) {
optimizer.addInput((Statement) parsedInput);