org.gradle.api.internal.tasks.compile.JavaCompilerArgumentsBuilder Java Examples

The following examples show how to use org.gradle.api.internal.tasks.compile.JavaCompilerArgumentsBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZincScalaCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
static WorkResult execute(ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = createCompiler(spec.getScalaClasspath(), spec.getZincClasspath(), logger);
    List<String> scalacOptions = new ScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
 
Example #2
Source File: NormalizingScalaCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void logCompilerArguments(ScalaJavaJointCompileSpec spec) {
    if (!LOGGER.isDebugEnabled()) { return; }

    List<String> compilerArgs = new JavaCompilerArgumentsBuilder(spec).includeLauncherOptions(true).includeSourceFiles(true).build();
    String joinedArgs = Joiner.on(' ').join(compilerArgs);
    LOGGER.debug("Java compiler arguments: {}", joinedArgs);
}
 
Example #3
Source File: ZincScalaCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
static WorkResult execute(ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = createCompiler(spec.getScalaClasspath(), spec.getZincClasspath(), logger);
    List<String> scalacOptions = new ScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
 
Example #4
Source File: NormalizingScalaCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void logCompilerArguments(ScalaJavaJointCompileSpec spec) {
    if (!LOGGER.isDebugEnabled()) { return; }

    List<String> compilerArgs = new JavaCompilerArgumentsBuilder(spec).includeLauncherOptions(true).includeSourceFiles(true).build();
    String joinedArgs = Joiner.on(' ').join(compilerArgs);
    LOGGER.debug("Java compiler arguments: {}", joinedArgs);
}
 
Example #5
Source File: Jdk6JavaCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private JavaCompiler.CompilationTask createCompileTask(JavaCompileSpec spec) {
    List<String> options = new JavaCompilerArgumentsBuilder(spec).build();
    JavaCompiler compiler = findCompiler();
    if(compiler==null){
        throw new RuntimeException("Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.");
    }
    CompileOptions compileOptions = spec.getCompileOptions();
    StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, compileOptions.getEncoding() != null ? Charset.forName(compileOptions.getEncoding()) : null);
    Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(spec.getSource());
    return compiler.getTask(null, null, null, options, null, compilationUnits);
}
 
Example #6
Source File: ZincScalaCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
static WorkResult execute(ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = createCompiler(spec.getScalaClasspath(), spec.getZincClasspath(), logger);
    List<String> scalacOptions = new ScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
 
Example #7
Source File: NormalizingScalaCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void logCompilerArguments(ScalaJavaJointCompileSpec spec) {
    if (!LOGGER.isDebugEnabled()) { return; }

    List<String> compilerArgs = new JavaCompilerArgumentsBuilder(spec).includeLauncherOptions(true).includeSourceFiles(true).build();
    String joinedArgs = Joiner.on(' ').join(compilerArgs);
    LOGGER.debug("Java compiler arguments: {}", joinedArgs);
}
 
Example #8
Source File: ZincScalaCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
static WorkResult execute(ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = createCompiler(spec.getScalaClasspath(), spec.getZincClasspath(), logger);
    List<String> scalacOptions = new ScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
 
Example #9
Source File: NormalizingScalaCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void logCompilerArguments(ScalaJavaJointCompileSpec spec) {
    if (!LOGGER.isDebugEnabled()) { return; }

    List<String> compilerArgs = new JavaCompilerArgumentsBuilder(spec).includeLauncherOptions(true).includeSourceFiles(true).build();
    String joinedArgs = Joiner.on(' ').join(compilerArgs);
    LOGGER.debug("Java compiler arguments: {}", joinedArgs);
}
 
Example #10
Source File: Jdk6JavaCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private JavaCompiler.CompilationTask createCompileTask(JavaCompileSpec spec) {
    List<String> options = new JavaCompilerArgumentsBuilder(spec).build();
    JavaCompiler compiler = findCompiler();
    if(compiler==null){
        throw new RuntimeException("Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.");
    }
    CompileOptions compileOptions = spec.getCompileOptions();
    StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, compileOptions.getEncoding() != null ? Charset.forName(compileOptions.getEncoding()) : null);
    Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(spec.getSource());
    return compiler.getTask(null, null, null, options, null, compilationUnits);
}