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

The following examples show how to use org.gradle.api.internal.tasks.compile.DefaultJavaCompileSpec. 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: JavaCompile.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@TaskAction
protected void compile(IncrementalTaskInputs inputs) {
    if (!compileOptions.isIncremental()) {
        compile();
        return;
    }

    DefaultJavaCompileSpec spec = createSpec();
    Compiler<JavaCompileSpec> incrementalCompiler = getIncrementalCompilerFactory().makeIncremental(
            createCompiler(spec),
            getPath(),
            inputs,
            getSource()
    );
    performCompilation(spec, incrementalCompiler);
}
 
Example #2
Source File: JavaCompile.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@TaskAction
protected void compile(IncrementalTaskInputs inputs) {
    if (!compileOptions.isIncremental()) {
        compile();
        return;
    }

    SingleMessageLogger.incubatingFeatureUsed("Incremental java compilation");

    DefaultJavaCompileSpec spec = createSpec();
    final CacheRepository repository1 = getCacheRepository();
    final JavaCompile javaCompile1 = this;
    final GeneralCompileCaches generalCaches1 = getGeneralCompileCaches();
    CompileCaches compileCaches = new CompileCaches() {
        private final CacheRepository repository = repository1;
        private final JavaCompile javaCompile = javaCompile1;
        private final GeneralCompileCaches generalCaches = generalCaches1;

        public ClassAnalysisCache getClassAnalysisCache() {
            return generalCaches.getClassAnalysisCache();
        }

        public JarSnapshotCache getJarSnapshotCache() {
            return generalCaches.getJarSnapshotCache();
        }

        public LocalJarClasspathSnapshotStore getLocalJarClasspathSnapshotStore() {
            return new LocalJarClasspathSnapshotStore(repository, javaCompile);
        }

        public LocalClassSetAnalysisStore getLocalClassSetAnalysisStore() {
            return new LocalClassSetAnalysisStore(repository, javaCompile);
        }
    };
    IncrementalCompilerFactory factory = new IncrementalCompilerFactory(
            (FileOperations) getProject(), getPath(), createCompiler(spec), source, compileCaches, (IncrementalTaskInputsInternal) inputs);
    Compiler<JavaCompileSpec> compiler = factory.createCompiler();
    performCompilation(spec, compiler);
}
 
Example #3
Source File: JavaCompile.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private DefaultJavaCompileSpec createSpec() {
    DefaultJavaCompileSpec spec = new DefaultJavaCompileSpec();
    spec.setSource(getSource());
    spec.setDestinationDir(getDestinationDir());
    spec.setWorkingDir(getProject().getProjectDir());
    spec.setTempDir(getTemporaryDir());
    spec.setClasspath(getClasspath());
    spec.setDependencyCacheDir(getDependencyCacheDir());
    spec.setTargetCompatibility(getTargetCompatibility());
    spec.setSourceCompatibility(getSourceCompatibility());
    spec.setCompileOptions(compileOptions);
    return spec;
}
 
Example #4
Source File: JavaCompile.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private DefaultJavaCompileSpec createSpec() {
    final DefaultJavaCompileSpec spec = new DefaultJavaCompileSpecFactory(compileOptions).create();
    spec.setDestinationDir(getDestinationDir());
    spec.setWorkingDir(getProject().getProjectDir());
    spec.setTempDir(getTemporaryDir());
    spec.setCompileClasspath(ImmutableList.copyOf(getClasspath()));
    spec.setAnnotationProcessorPath(ImmutableList.copyOf(getEffectiveAnnotationProcessorPath()));
    spec.setTargetCompatibility(getTargetCompatibility());
    spec.setSourceCompatibility(getSourceCompatibility());
    spec.setCompileOptions(compileOptions);
    return spec;
}
 
Example #5
Source File: JavaCompile.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@TaskAction
protected void compile(IncrementalTaskInputs inputs) {
    if (!compileOptions.isIncremental()) {
        compile();
        return;
    }

    SingleMessageLogger.incubatingFeatureUsed("Incremental java compilation");

    DefaultJavaCompileSpec spec = createSpec();
    final CacheRepository repository1 = getCacheRepository();
    final JavaCompile javaCompile1 = this;
    final GeneralCompileCaches generalCaches1 = getGeneralCompileCaches();
    CompileCaches compileCaches = new CompileCaches() {
        private final CacheRepository repository = repository1;
        private final JavaCompile javaCompile = javaCompile1;
        private final GeneralCompileCaches generalCaches = generalCaches1;

        public ClassAnalysisCache getClassAnalysisCache() {
            return generalCaches.getClassAnalysisCache();
        }

        public JarSnapshotCache getJarSnapshotCache() {
            return generalCaches.getJarSnapshotCache();
        }

        public LocalJarClasspathSnapshotStore getLocalJarClasspathSnapshotStore() {
            return new LocalJarClasspathSnapshotStore(repository, javaCompile);
        }

        public LocalClassSetAnalysisStore getLocalClassSetAnalysisStore() {
            return new LocalClassSetAnalysisStore(repository, javaCompile);
        }
    };
    IncrementalCompilerFactory factory = new IncrementalCompilerFactory(
            (FileOperations) getProject(), getPath(), createCompiler(spec), source, compileCaches, (IncrementalTaskInputsInternal) inputs);
    Compiler<JavaCompileSpec> compiler = factory.createCompiler();
    performCompilation(spec, compiler);
}
 
Example #6
Source File: JavaCompile.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private DefaultJavaCompileSpec createSpec() {
    DefaultJavaCompileSpec spec = new DefaultJavaCompileSpec();
    spec.setSource(getSource());
    spec.setDestinationDir(getDestinationDir());
    spec.setWorkingDir(getProject().getProjectDir());
    spec.setTempDir(getTemporaryDir());
    spec.setClasspath(getClasspath());
    spec.setDependencyCacheDir(getDependencyCacheDir());
    spec.setTargetCompatibility(getTargetCompatibility());
    spec.setSourceCompatibility(getSourceCompatibility());
    spec.setCompileOptions(compileOptions);
    return spec;
}
 
Example #7
Source File: JavaCompile.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected void compile() {
    DefaultJavaCompileSpec spec = createSpec();
    performCompilation(spec, createCompiler(spec));
}
 
Example #8
Source File: JavaCompile.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void compile() {
    DefaultJavaCompileSpec spec = createSpec();
    spec.setSourceFiles(getSource());
    performCompilation(spec, createCompiler(spec));
}
 
Example #9
Source File: JavaCompile.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected void compile() {
    DefaultJavaCompileSpec spec = createSpec();
    performCompilation(spec, createCompiler(spec));
}