Package javax.tools.JavaCompiler

Examples of javax.tools.JavaCompiler.CompilationTask.call()


   
    CompilationTask cTask = compiler.getTask(null, fileManager, null, null,
        null,
        fileManager.getJavaFileObjects(
            javaFiles.toArray(new File[javaFiles.size()])));
    assertTrue(cTask.call());
  }
}
View Full Code Here


   
    CompilationTask cTask = compiler.getTask(null, fileManager, null, null,
        null,
        fileManager.getJavaFileObjects(
            javaFiles.toArray(new File[javaFiles.size()])));
    assertTrue(cTask.call());
  }
}
View Full Code Here

      }
      files.putAll(findFiles(additionalSourcesDir,".java"));
      if (files.size() > 0) {
        final Iterable<? extends JavaFileObject> compilationUnits1 = fileManager.getJavaFileObjectsFromFiles(files.values());
        final CompilationTask task = compiler.getTask(sw, fileManager, null, options, null, compilationUnits1);
        if (!task.call()) {
          logger.error(sw.toString());
          throw new CopperRuntimeException("Compilation failed, see logfile for details");
        }
      }
    }
View Full Code Here

      String classPath = buildClassPath(classPaths);
      options.add(classPath);
    }

    CompilationTask task = compiler.getTask(null, manager, null, options, null, javaObjects);
    if (!task.call()) { // compile error
      log.error("Compilation error");
      throw new RuntimeException("Compilation error");
    }

    long duration = System.currentTimeMillis() - startMillis;
View Full Code Here

    //logger.debug("Compiling the following source code\n{}", sourcecode);
    // Run the compiler.
    try {
      CompilationTask task = compiler.getTask(null, fileManager, listener, getOptions(), null, Collections.singleton(compilationUnit));
      long n0 = System.nanoTime();
      if(!task.call()){
        throw new CompileException("Compilation failed", null);
      }
      long n1 = (System.nanoTime() - n0)/1000/1000;
     
    } catch (RuntimeException rte) {
View Full Code Here

      options.add(classpath);

      CompilationTask compilerTask = compiler.getTask(compilerTaskOut,
          fileManager, diagnosticListener, options, classes,
          compilationUnits);
      Boolean compilerTaskResult = compilerTask.call();
      fileManager.close();
      if (!compilerTaskResult) {
        throw new IwantException("Compilation failed.");
      }
      return dest;
View Full Code Here

    JavaCompiler compiler= ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
    Iterable<? extends JavaFileObject> compilationUnits= fileManager.getJavaFileObjectsFromFiles(Arrays.asList(files));
    DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
        CompilationTask task = compiler.getTask(null, null, diagnostics, null, null, compilationUnits);
        success = task.call();
        if (!success) {
            for (Diagnostic<? extends JavaFileObject> diag : diagnostics.getDiagnostics()) {
              Output.conerr.println(diag.toString());
            }
            return success;
View Full Code Here

    // compiling it
    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
    StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
    Iterable<? extends JavaFileObject> compilationUnits1 = fileManager.getJavaFileObjects(javaFile);
    CompilationTask task = compiler.getTask(null, fileManager, null, null, null, compilationUnits1);
    task.call();

    // here is the compiled file
    File classFile = new File(javaFile.getParentFile(), className+".class");
    Assert.assertTrue(classFile.exists());
View Full Code Here

   
    CompilationTask cTask = compiler.getTask(null, fileManager, null, null,
        null,
        fileManager.getJavaFileObjects(
            javaFiles.toArray(new File[javaFiles.size()])));
    assertTrue(cTask.call());
  }
}
View Full Code Here

                                           DiagnosticListener<JavaFileObject> listener,
                                           Iterable<? extends JavaFileObject> fileList) {
        List<String> args = new ArrayList<String>();
        addArgs(args);
        CompilationTask task = compiler.getTask(null, fileManager, listener, args, null, fileList);
        Boolean ret = task.call();
        try {
            fileManager.close();
        } catch (IOException e) {
            System.err.print("[ERROR] IOException during compiling.");
            e.printStackTrace();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.