File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
lib_bcu_plugin/src/main/java/com/ysj/lib/bytecodeutil/plugin Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -147,17 +147,19 @@ abstract class TransformTask : DefaultTask() {
147147
148148 private fun cleanNotNeedOutput (executor : Executor , allNotNeedFileSet : Set <File >): Worker ? {
149149 val notNeedOutputDir = notNeedOutput.get().asFile
150- val list = notNeedOutputDir
151- .list()
152- ?.mapNotNull {
153- val dir = File (notNeedOutputDir, it)
154- if (dir.isDirectory) dir else null
150+ val list = notNeedOutputDir.listFiles() ? : return null
151+ val workCounter: (File ) -> Int = { if (it.isDirectory) 1 else 0 }
152+ val worker = Worker (list.sumOf(workCounter), executor)
153+ list.forEach { file ->
154+ if (file.isFile) {
155+ if (file !in allNotNeedFileSet) {
156+ file.delete()
157+ logger.lifecycle(" >>> incremental removed: ${file.name} " )
158+ }
159+ return @forEach
155160 }
156- ? : return null
157- val worker = Worker (list.size, executor)
158- list.forEach { dir ->
159161 worker.submit {
160- dir .walkBottomUp().forEach {
162+ file .walkBottomUp().forEach {
161163 if (it.isDirectory) {
162164 if (it.list().isNullOrEmpty()) {
163165 it.delete()
You can’t perform that action at this time.
0 commit comments