@@ -153,17 +153,21 @@ class AndroidCacheFixPlugin implements Plugin<Project> {
153153 @Override
154154 void apply (Project project ) {
155155 project. tasks. withType(AndroidJavaCompile ) { AndroidJavaCompile task ->
156- def originalValue = task. processorListFile
157- if (originalValue != null ) {
158- task. processorListFile = project. files()
159- task. inputs. files(originalValue)
160- .withPathSensitivity(PathSensitivity . NONE )
161- .withPropertyName(" processorListFile.workaround" )
156+ def originalValue
162157
163- task. doFirst {
164- task. processorListFile = originalValue
158+ project. gradle. taskGraph. beforeTask {
159+ if (task == it) {
160+ originalValue = task. processorListFile
161+ task. processorListFile = project. files()
162+ task. inputs. files(originalValue)
163+ .withPathSensitivity(PathSensitivity . NONE )
164+ .withPropertyName(" processorListFile.workaround" )
165165 }
166166 }
167+
168+ task. doFirst {
169+ task. processorListFile = originalValue
170+ }
167171 }
168172 }
169173 }
@@ -176,12 +180,18 @@ class AndroidCacheFixPlugin implements Plugin<Project> {
176180 @Override
177181 void apply (Project project ) {
178182 project. tasks. withType(ExtractAnnotations ) { ExtractAnnotations task ->
179- def originalValue = task. source
180- task. source = []
181- task. inputs. files(originalValue)
182- .withPathSensitivity(PathSensitivity . RELATIVE )
183- .withPropertyName(" source.workaround" )
184- .skipWhenEmpty(true )
183+ def originalValue
184+
185+ project. gradle. taskGraph. beforeTask {
186+ if (task == it) {
187+ originalValue = task. source
188+ task. source = []
189+ task. inputs. files(originalValue)
190+ .withPathSensitivity(PathSensitivity . RELATIVE )
191+ .withPropertyName(" source.workaround" )
192+ .skipWhenEmpty(true )
193+ }
194+ }
185195
186196 task. doFirst {
187197 task. source = originalValue
0 commit comments