Hi everyone. maybe a bug of kotlin-gradle-plugin f...
# gradle
m
Hi everyone. maybe a bug of kotlin-gradle-plugin found. First compilation after clean build fallback to rebuild when build-cache enabled https://youtrack.jetbrains.com/issue/KT-39656 Steps 1. Enable gradle Build Cache 2. Run 
./gradlew clean assembleDebug
3. Modify .kt files that may cause incremental compilation What I expect: Only out-of-date files will be compiled What I got: All files get compiled Probable cause: see the three screenshots of kotlin-gradle-plugin code below 1. KotlinCompile is a 
@CacheableTask
, so gradle will store it’s 
@Output
 files to make build cache happens. 2.
taskBuildDirectory
 is marked as 
@LocalState
, which will be removed when the task is loaded from cache. 3. when first incremental happens, kotlin check if 
taskBuildDirectory
 exists. If not, 
chagedFiles
 will be assigned to 
ChangedFiles.UnKnown
, which cause kotlin fallback to rebuild. It will waste a plenty of meaningless time.