Incremental not working

incremental

(cantalou) #1

Hi all,
I used gradle 3.5 and gradle:2.2.0 plugin to compile my android project. I found that compileDebugJavaWithJavac task delete all the class file last compiled and rebuild again although config option incremental was true and only one file changed.

Below is my environment:
Win7, JDK1.8, Gradle3.5, gradle plugin 2.2.0

build.gradle
android{
compileOptions.incremental = true
}
afterEvaluate {
tasks.withType(JavaCompile) {
options.incremental = true // one flag, and things will get MUCH faster
options.fork = true
}
}

The log:
Executing tasks: [:app:assembleGongDebug]

16:54:40.804 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :app:compileGongDebugJavaWithJavac (Thread[Task worker,5,main]) started.
16:54:40.804 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] :app:compileGongDebugJavaWithJavac
16:54:40.804 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':app:compileGongDebugJavaWithJavac’
16:54:40.804 [INFO] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Putting task artifact state for task ‘:app:compileGongDebugJavaWithJavac’ into context took 0.0 secs.
16:54:40.807 [DEBUG] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Determining if task ‘:app:compileGongDebugJavaWithJavac’ is up-to-date
16:54:40.807 [INFO] [org.gradle.api.internal.changedetection.rules.TaskTypeTaskStateChanges] Task :app:compileGongDebugJavaWithJavac class loader hash: 820a57cd9677b8467af4a3c9cff73e36
16:54:40.807 [INFO] [org.gradle.api.internal.changedetection.rules.TaskTypeTaskStateChanges] Task :app:compileGongDebugJavaWithJavac actions class loader hashes: [1f83c133a7c72a7a89ebf834339065be, 820a57cd9677b8467af4a3c9cff73e36, 750e1d72030581ace81f7325929812f4, 41621835a1ddfd325406e64eb3109d65]

16:54:41.018 [INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Executing task ‘:app:compileGongDebugJavaWithJavac’ (up-to-date check took 0.212 secs) due to:

Input property ‘source’ file D:\project_dir\app\build\intermediates\merged\main\java\com\gc\controllers\home\RecommendFragment.java has changed.

16:54:41.019 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ‘:app:compileGongDebugJavaWithJavac’.
16:54:41.021 [INFO] [org.gradle.api.Task] Compiling with source level 1.7 and target level 1.7.
16:54:41.024 [INFO] [org.gradle.cache.internal.DefaultCacheAccess] Creating new cache for classAnalysis, path D:\project_dir.gradle\3.5\javaCompile\classAnalysis.bin, access org.gradle.cache.internal.DefaultCacheAccess@620b0c1d
16:54:41.024 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Acquiring file lock for Java compile cache (D:\project_dir.gradle\3.5\javaCompile)
16:54:41.024 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on Java compile cache (D:\project_dir.gradle\3.5\javaCompile).
16:54:41.025 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on Java compile cache (D:\project_dir.gradle\3.5\javaCompile).
16:54:41.025 [INFO] [org.gradle.cache.internal.DefaultCacheAccess] Creating new cache for jarAnalysis, path D:\project_dir.gradle\3.5\javaCompile\jarAnalysis.bin, access org.gradle.cache.internal.DefaultCacheAccess@620b0c1d
16:54:41.025 [INFO] [org.gradle.cache.internal.DefaultCacheAccess] Creating new cache for taskJars, path D:\project_dir.gradle\3.5\javaCompile\taskJars.bin, access org.gradle.cache.internal.DefaultCacheAccess@620b0c1d
16:54:41.025 [INFO] [org.gradle.cache.internal.DefaultCacheAccess] Creating new cache for taskHistory, path D:\project_dir.gradle\3.5\javaCompile\taskHistory.bin, access org.gradle.cache.internal.DefaultCacheAccess@620b0c1d
16:54:41.029 [INFO] [org.gradle.api.internal.tasks.compile.incremental.jar.JarClasspathSnapshotMaker] Created jar classpath snapshot for incremental compilation in 0.003 secs.
16:54:41.029 [DEBUG] [org.gradle.api.internal.tasks.compile.incremental.jar.JarClasspathSnapshotMaker] While calculating jar classpath snapshot 0 duplicate classes were found: [].

16:54:41.122 [DEBUG] [org.gradle.api.internal.file.delete.Deleter] Deleting D:\project_dir\app\build\intermediates\classes\Gong\debug\com\gc\adapters\Adapter.class
16:54:41.124 [DEBUG] [org.gradle.api.internal.file.delete.Deleter] Deleting D:\project_dir\app\build\intermediates\classes\Gong\debug\com\gc\adapters\ListAdapter.class
about 2000+ files
16:54:44.045 [DEBUG] [org.gradle.api.internal.file.delete.Deleter] Deleting D:\project_dir\app\build\intermediates\classes\Gong\debug\com\gc\widget\web\WebView.class

16:54:44.140 [DEBUG] [org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler] Compiler arguments: -source 1.7 -target 1.7 -d D:\project_dir\app\build\intermediates\classes\Gong\debug -encoding UTF-8

-bootclasspath D:\android\platforms\android-23\android.jar -g -sourcepath -proc:none -XDuseUnsharedTable=true

-classpath D:\Program Files (x86)\gradle\caches\modules-2\files-2.1\de.javakaffee\kryo-serializers\0.33\e9639b86ee1ea66c3fcb92a339be71483d75856d\kryo-serializers-0.33.jar;…;

-s D:\project_dir\app\build\generated\source\apt\Gong\debug

D:\project_dir\app\build\intermediates\merged\main\java\com\gc\adapters\Adapter.java

D:\project_dir\app\build\intermediates\merged\main\java\com\gc\adapters\ListAdapter.java

about 2000+ files

D:\project_dir\app\build\intermediates\merged\main\java\com\gc\widget\web\WebView.java

16:54:44.141 [DEBUG] [org.gradle.workers.internal.WorkerDaemonStarter] Starting Gradle worker daemon with fork options DaemonForkOptions{minHeapSize=null, maxHeapSize=null, jvmArgs=[], classpath=[]}.
16:54:44.143 [DEBUG] [org.gradle.internal.remote.internal.inet.TcpIncomingConnector] Listening on [4fe744b3-8da9-4004-8963-7a64adb552c0 port:58507, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]].
16:54:44.144 [DEBUG] [org.gradle.process.internal.worker.DefaultWorkerProcessBuilder] Creating Gradle Worker Daemon 1
16:54:44.144 [DEBUG] [org.gradle.process.internal.worker.DefaultWorkerProcessBuilder] Using application classpath []
16:54:44.145 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on cache directory workerMain (D:\Program Files (x86)\gradle\caches\3.5\workerMain).
16:54:44.146 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on cache directory workerMain (D:\Program Files (x86)\gradle\caches\3.5\workerMain).
16:54:44.146 [DEBUG] [org.gradle.process.internal.worker.child.WorkerProcessClassPathProvider] Using worker process classpath: [D:\Program Files (x86)\gradle\caches\3.5\workerMain\gradle-worker.jar]
16:54:44.147 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
16:54:44.147 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: Gradle Worker Daemon 1.
16:54:44.162 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
16:54:44.162 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'Gradle Worker Daemon 1’
16:54:44.162 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled…
16:54:44.552 [DEBUG] [org.gradle.process.internal.worker.DefaultWorkerProcess] Received connection org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection@25db517b from Gradle Worker Daemon
16:54:44.558 [INFO] [org.gradle.workers.internal.WorkerDaemonStarter] Started Gradle worker daemon (0.416 secs) with fork options DaemonForkOptions{minHeapSize=null, maxHeapSize=null, jvmArgs=[], classpath=[]}.
16:54:44.558 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationWorkerRegistry] Worker root.89.90 started (1 in use).
16:54:44.592 [DEBUG] [org.gradle.process.internal.worker.child.ActionExecutionWorker] Starting Gradle Worker Daemon 1.
16:54:44.616 [INFO] [org.gradle.internal.nativeintegration.services.NativeServices] Initialized native services in: D:\Program Files (x86)\gradle\native
16:54:44.706 [INFO] [org.gradle.workers.internal.WorkerDaemonServer] Executing org.gradle.api.internal.tasks.compile.JdkJavaCompiler in worker daemon.
16:54:44.706 [INFO] [org.gradle.api.internal.tasks.compile.JdkJavaCompiler] Compiling with JDK Java compiler API.
16:54:51.788 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
16:54:53.899 [INFO] [org.gradle.workers.internal.WorkerDaemonServer] Successfully executed org.gradle.api.internal.tasks.compile.JdkJavaCompiler in worker daemon.
16:54:53.901 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 15621: dispatching class org.gradle.launcher.daemon.protocol.BuildEvent
16:54:53.901 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationWorkerRegistry] Worker root.89.90 completed (1 in use)

16:54:53.901 [INFO] [org.gradle.api.internal.tasks.compile.incremental.SelectiveCompiler] Incremental compilation of 971 classes completed in 12.876 secs.

16:54:53.902 [DEBUG] [org.gradle.api.internal.tasks.compile.incremental.SelectiveCompiler] Recompiled classes [com.gc.controllers.home.RecommendFragment …] all classes

16:54:54.224 [INFO] [org.gradle.api.internal.tasks.compile.incremental.ClassSetAnalysisUpdater] Class dependency analysis for incremental compilation took 0.321 secs.
16:54:54.224 [INFO] [org.gradle.api.internal.tasks.compile.incremental.jar.JarClasspathSnapshotMaker] Written jar classpath snapshot for incremental compilation in 0.0 secs.
16:54:54.224 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache taskHistory.bin (D:\project_dir.gradle\3.5\javaCompile\taskHistory.bin)
16:54:54.224 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 15621: dispatching class org.gradle.launcher.daemon.protocol.BuildEvent
16:54:54.224 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 15621: dispatching class org.gradle.launcher.daemon.protocol.BuildEvent
16:54:54.246 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache taskJars.bin (D:\project_dir.gradle\3.5\javaCompile\taskJars.bin)
16:54:54.273 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 15621: dispatching class org.gradle.launcher.daemon.protocol.BuildEvent
16:54:54.370 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
16:54:54.370 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':app:compileGongDebugJavaWithJavac’
16:54:54.371 [DEBUG] [org.gradle.launcher.daemon.server.SynchronizedDispatchConnection] thread 15621: dispatching class org.gradle.launcher.daemon.protocol.BuildEvent
16:54:54.371 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :app:compileGongDebugJavaWithJavac (Thread[Task worker,5,main]) completed. Took 13.567 secs.
16:54:54.371 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationWorkerRegistry] Worker root.89 completed (0 in use)
16:54:54.371 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationWorkerRegistry] Worker root.91 started (1 in use).