Example usage for java.lang Compiler Compiler

List of usage examples for java.lang Compiler Compiler

Introduction

In this page you can find the example usage for java.lang Compiler Compiler.

Prototype

private Compiler() 

Source Link

Usage

From source file:com.google.javascript.jscomp.JSModuleGraphTest.java

@Override
public void setUp() throws Exception {
    super.setUp();
    B.addDependency(A); //     __A__
    C.addDependency(A); //    /  |  \
    D.addDependency(B); //   B   C  |
    E.addDependency(B); //  / \ /|  |
    E.addDependency(C); // D   E | /
    F.addDependency(A); //      \|/
    F.addDependency(C); //       F
    F.addDependency(E);/*from ww  w.j a  v a 2s  . c om*/
    graph = new JSModuleGraph(new JSModule[] { A, B, C, D, E, F });
    compiler = new Compiler();
}

From source file:com.impetus.kundera.query.KunderaQueryParser.java

/**
 * Method to parse the Single-String query.
 */
public final void parse() {
    new Compiler().compile();
}

From source file:com.googlecode.jsonschema2pojo.integration.util.CodeGenerationHelper.java

public static ClassLoader compile(File sourceDirectory, List<String> classpath) {

    List<String> fullClasspath = new ArrayList<String>();
    fullClasspath.addAll(classpath);//ww w . ja  v a 2s .co  m
    fullClasspath.add(System.getProperty("java.class.path"));

    new Compiler().compile(sourceDirectory, join(fullClasspath, File.pathSeparatorChar));

    try {
        return URLClassLoader.newInstance(new URL[] { sourceDirectory.toURI().toURL() },
                Thread.currentThread().getContextClassLoader());
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }

}

From source file:de.ailis.microblinks.blinks.compiler.Main.java

/**
 * Runs the program.// w ww . j  a  va2  s .c om
 *
 * @param args
 *            The command-line arguments.
 * @throws IOException
 *             When an IO exception occures.
 */
public void run(final String[] args) throws IOException {
    setupLogging();
    final String[] params = processOptions(args);

    if (params.length > 2) {
        wrongUsage("Too many arguments");
    }
    final boolean hasInputFile = params.length > 0 && !"-".equals(params[0]);
    final boolean hasOutputFile = params.length > 1 && !"-".equals(params[1]);
    try (final InputStream input = hasInputFile ? new FileInputStream(params[0]) : System.in;
            final OutputStream output = hasOutputFile ? new FileOutputStream(params[1]) : System.out) {
        output.write(new Compiler().compile(input));
    }
}

From source file:com.vectorcast.plugins.vectorcastexecution.job.ManageProject.java

/**
 * Parse the project file/*from  w  w  w  .ja va  2 s.c om*/
 * @throws IOException exception
 * @throws InvalidProjectFileException exception
 */
public void parse() throws IOException, InvalidProjectFileException {
    Integer version = 14;
    try {
        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dbBuilder = dbFactory.newDocumentBuilder();
        InputStream is = IOUtils.toInputStream(manageFile);
        Document doc = dbBuilder.parse(is);

        NodeList nList = doc.getElementsByTagName("project");
        Node projectNode = nList.item(0);
        String verStr = ((Element) projectNode).getAttribute("version");
        version = Integer.valueOf(verStr);
        for (int pos = 0; pos < nList.getLength(); pos++) {
            Node node = nList.item(pos);
            NodeList innerList = node.getChildNodes();
            for (int inner = 0; inner < innerList.getLength(); inner++) {
                Node innerNode = innerList.item(inner);
                if (innerNode.getNodeName().equals("group") && node.getNodeType() == Node.ELEMENT_NODE) {
                    Element element = (Element) innerNode;
                    String name = element.getAttribute("name");
                    Group group = new Group(name);
                    groups.add(group);
                    group.parse(innerNode);
                } else if (version < 17 && innerNode.getNodeName().equals("source-collection")
                        && node.getNodeType() == Node.ELEMENT_NODE) {
                    Element element = (Element) innerNode;
                    String name = element.getAttribute("name");
                    Source source = new Source(name);
                    sources.add(source);
                    source.parse(innerNode);
                } else if (version >= 17 && innerNode.getNodeName().equals("compiler")
                        && node.getNodeType() == Node.ELEMENT_NODE) {
                    Element element = (Element) innerNode;
                    Compiler compiler = new Compiler();
                    compilers.add(compiler);
                    compiler.parse(innerNode);
                }
            }
        }
    } catch (ParserConfigurationException ex) {
        Logger.getLogger(NewSingleJob.class.getName()).log(Level.SEVERE, null, ex);
        throw new InvalidProjectFileException();
    } catch (SAXException ex) {
        //            Logger.getLogger(NewSingleJob.class.getName()).log(Level.SEVERE, null, ex);
        throw new InvalidProjectFileException();
    }
    if (version < 17) {
        for (Source source : sources) {
            for (Platform platform : source.platforms) {
                for (Compiler compiler : platform.compilers) {
                    for (TestSuite testSuite : compiler.testsuites) {
                        for (Group group : testSuite.groups) {
                            for (Environment env : group.getEnvs()) {
                                MultiJobDetail job = new MultiJobDetail(source.getName(), platform.getName(),
                                        compiler.getName(), testSuite.getName(), env.getName());
                                jobs.add(job);
                            }
                        }
                    }
                }
            }
        }
    } else if (version >= 17) {
        for (Compiler compiler : compilers) {
            for (TestSuite testSuite : compiler.testsuites) {
                for (Group group : testSuite.groups) {
                    for (Environment env : group.getEnvs()) {
                        MultiJobDetail job = new MultiJobDetail(/*source*/null, /*platform*/null,
                                compiler.getName(), testSuite.getName(), env.getName());
                        jobs.add(job);
                    }
                }
            }
        }
    }
}