com.google.caja.plugin
Class BuildServiceImplementation

java.lang.Object
  extended by com.google.caja.plugin.BuildServiceImplementation
All Implemented Interfaces:
BuildService

public class BuildServiceImplementation
extends java.lang.Object
implements BuildService

Build integration to PluginCompiler and Minify.

Author:
mikesamuel@gmail.com

Field Summary
private  java.util.Map<InputSource,java.lang.String> originalSources
           
 
Constructor Summary
BuildServiceImplementation()
           
 
Method Summary
 boolean cajole(java.io.PrintWriter logger, java.util.List<java.io.File> dependees, java.util.List<java.io.File> inputs, java.io.File output, java.util.Map<java.lang.String,java.lang.Object> options)
          Cajoles inputs to output writing any messages to logger, returning true iff the task passes.
private  java.lang.String getSourceContent(InputSource is)
           
private static boolean hasErrors(MessageQueue mq)
           
private static void loadEnvJsonFile(java.io.File f, JsOptimizer op, MessageQueue mq)
           
 boolean minify(java.io.PrintWriter logger, java.util.List<java.io.File> dependees, java.util.List<java.io.File> inputs, java.io.File output, java.util.Map<java.lang.String,java.lang.Object> options)
          Minifies inputs to output writing any messages to logger, returning true iff the task passes.
private  ParseTreeNode parseInput(InputSource is, MessageQueue mq)
           
private static Parser parser(CharProducer cp, MessageQueue errs)
           
private static CharProducer read(java.io.File f)
           
 boolean transfInnocent(java.io.PrintWriter logger, java.util.List<java.io.File> dependees, java.util.List<java.io.File> inputs, java.io.File output, java.util.Map<java.lang.String,java.lang.Object> options)
          Applies the innocent code transformer to inputs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

originalSources

private final java.util.Map<InputSource,java.lang.String> originalSources
Constructor Detail

BuildServiceImplementation

public BuildServiceImplementation()
Method Detail

cajole

public boolean cajole(java.io.PrintWriter logger,
                      java.util.List<java.io.File> dependees,
                      java.util.List<java.io.File> inputs,
                      java.io.File output,
                      java.util.Map<java.lang.String,java.lang.Object> options)
Cajoles inputs to output writing any messages to logger, returning true iff the task passes.

Specified by:
cajole in interface BuildService
Parameters:
logger - receives messages that should be included in the build log.
dependees - files which may be referenced from inputs.
inputs - files to cajole.
output - file to write cajoled output to.
options - a key/value map supplying optional parameters that may differ depending on the version of the client. Unrecognized options should be ignored.
Returns:
true iff output contains the successfully cajoled inputs.

getSourceContent

private java.lang.String getSourceContent(InputSource is)
                                   throws java.io.IOException
Throws:
java.io.IOException

parseInput

private ParseTreeNode parseInput(InputSource is,
                                 MessageQueue mq)
                          throws java.io.IOException
Throws:
java.io.IOException

minify

public boolean minify(java.io.PrintWriter logger,
                      java.util.List<java.io.File> dependees,
                      java.util.List<java.io.File> inputs,
                      java.io.File output,
                      java.util.Map<java.lang.String,java.lang.Object> options)
Minifies inputs to output writing any messages to logger, returning true iff the task passes.

Specified by:
minify in interface BuildService
Parameters:
logger - receives messages that should be included in the build log.
dependees - files which may be referenced from inputs.
inputs - files to minify.
output - file to write minified output to.
options - a key/value map supplying optional parameters that may differ depending on the version of the client. Unrecognized options should be ignored.
Returns:
true iff output contains the successfully cajoled inputs.

transfInnocent

public boolean transfInnocent(java.io.PrintWriter logger,
                              java.util.List<java.io.File> dependees,
                              java.util.List<java.io.File> inputs,
                              java.io.File output,
                              java.util.Map<java.lang.String,java.lang.Object> options)
Applies the innocent code transformer to inputs. Writes any messages to logger and returns true iff the task passes.

Specified by:
transfInnocent in interface BuildService
Parameters:
logger - receives messages that should be included in the build log.
dependees - files which may be referenced from inputs.
inputs - innocent code to transform
output - files to write transformed output to.
options - a key/value map supplying optional parameters that may differ depending on the version of the client. Unrecognized options should be ignored.
Returns:
true iff output contains the successfully transformed inputs.
See Also:
InnocentCodeRewriter

loadEnvJsonFile

private static void loadEnvJsonFile(java.io.File f,
                                    JsOptimizer op,
                                    MessageQueue mq)

read

private static CharProducer read(java.io.File f)
                          throws java.io.IOException
Throws:
java.io.IOException

parser

private static Parser parser(CharProducer cp,
                             MessageQueue errs)

hasErrors

private static boolean hasErrors(MessageQueue mq)


Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0