Esempio n. 1
0
  @TaskAction
  protected void compile(IncrementalTaskInputs inputs) {
    if (!compileOptions.isIncremental()) {
      compile();
      return;
    }

    SingleMessageLogger.incubatingFeatureUsed("Incremental java compilation");

    DefaultJavaCompileSpec spec = createSpec();
    final CacheRepository cacheRepository = getCacheRepository();
    final GeneralCompileCaches generalCompileCaches = getGeneralCompileCaches();

    CompileCaches compileCaches =
        new CompileCaches() {
          private final CacheRepository repository = cacheRepository;
          private final JavaCompile javaCompile = JavaCompile.this;
          private final GeneralCompileCaches generalCaches = generalCompileCaches;

          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(
            getFileOperations(),
            getCachingFileSnapshotter().createThreadSafeWrapper(),
            getPath(),
            createCompiler(spec),
            source,
            compileCaches,
            (IncrementalTaskInputsInternal) inputs);
    Compiler<JavaCompileSpec> compiler = factory.createCompiler();
    performCompilation(spec, compiler);
  }
Esempio n. 2
0
  @TaskAction
  protected void compile(IncrementalTaskInputs inputs) {
    if (!compileOptions.isIncremental()) {
      compile();
      return;
    }

    SingleMessageLogger.incubatingFeatureUsed("Incremental java compilation");

    DefaultJavaCompileSpec spec = createSpec();
    CompileCaches compileCaches =
        new DefaultCompileCaches(getCacheRepository(), this, getGeneralCompileCaches());
    IncrementalCompilerFactory factory =
        new IncrementalCompilerFactory(
            (FileOperations) getProject(),
            getPath(),
            createCompiler(spec),
            source,
            compileCaches,
            (IncrementalTaskInputsInternal) inputs);
    Compiler<JavaCompileSpec> compiler = factory.createCompiler();
    performCompilation(spec, compiler);
  }