File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,3 +176,25 @@ tasks.named("clean") {
176176 delete(new File (projectDir, " .cxx" ))
177177 }
178178}
179+
180+ // This is needed because task "clean" depends on these tasks:
181+ // :app:externalNativeBuildCleanLiteDebug
182+ // :app:externalNativeBuildCleanLiteRelease
183+ // :app:externalNativeBuildCleanProDebug
184+ // :app:externalNativeBuildCleanProRelease
185+ // And these tasks expect to find build/conan/[ABI]/conan_toolchain.cmake files
186+ //
187+ // If build folder is malformed, we can't run `gradle clean` without this workaround.
188+ // This is because we supply our (conan's) CMAKE_TOOLCHAIN_FILE.
189+ // This workaround removes these "clean" task dependencies if conan_toolchain.cmake is not found (malformed build dir)
190+ project. afterEvaluate {
191+ [" armv7" , " armv8" , " x86" , " x86_64" ]. each { String arch ->
192+ if (! new File (projectDir, ' build/conan/' + arch + ' conan_toolchain.cmake' ). exists()) {
193+ def cleanTask = tasks. named(" clean" ). get()
194+ cleanTask. dependsOn - = tasks. named(' externalNativeBuildCleanLiteDebug' )
195+ cleanTask. dependsOn - = tasks. named(' externalNativeBuildCleanLiteRelease' )
196+ cleanTask. dependsOn - = tasks. named(' externalNativeBuildCleanProDebug' )
197+ cleanTask. dependsOn - = tasks. named(' externalNativeBuildCleanProRelease' )
198+ }
199+ }
200+ }
You can’t perform that action at this time.
0 commit comments