Skip to content

Commit e0855cc

Browse files
committed
1、完善逻辑
1 parent fe13482 commit e0855cc

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

module-communication-plugin/src/main/kotlin/com/flyjingfish/module_communication_plugin/ExportTask.kt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,21 @@ abstract class ExportTask : DefaultTask() {
3434
val buildFile = File(dir, path)
3535

3636
val moduleKey = curProject.buildDir.absolutePath
37-
PackageRecordUtils.clear(moduleKey,buildFile)
37+
val isClear = PackageRecordUtils.clear(moduleKey,buildFile)
38+
if (isClear){
39+
val recordPackageSet = mutableSetOf<String>()
40+
for (file in collection.files) {
41+
val packageName = getPackageName(file)
42+
packageName?.let {
43+
recordPackageSet.add(it)
44+
}
45+
}
46+
47+
for (packageName in recordPackageSet) {
48+
val packageFile = File(buildFile.absolutePath +"/"+ packageName.replace(".","/"))
49+
packageFile.deleteRecursively()
50+
}
51+
}
3852

3953
for (file in collection.files) {
4054
val packageName = getPackageName(file)

module-communication-plugin/src/main/kotlin/com/flyjingfish/module_communication_plugin/PackageRecordUtils.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object PackageRecordUtils {
1414
lastRecordPackageSet.add(packageName)
1515
}
1616

17-
fun clear(moduleKey :String,buildFile : File){
17+
fun clear(moduleKey :String,buildFile : File):Boolean{
1818
val lastRecordPackageSet = lastRecordPackageMap[moduleKey]
1919
lastRecordPackageSet?.let {
2020
// println("lastRecordPackageSet-size="+it.size);
@@ -26,6 +26,7 @@ object PackageRecordUtils {
2626

2727
it.clear()
2828
}
29+
return lastRecordPackageSet.isNullOrEmpty()
2930
}
3031

3132
}

0 commit comments

Comments
 (0)