Skip to content

Commit 5f51406

Browse files
committed
support buildType
1 parent b72690d commit 5f51406

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

plugin/src/main/groovy/top/niunaijun/blackobfuscator/ObfPlugin.groovy

+9-3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class ObfPlugin implements Plugin<Project> {
5151
addTask("minifyDebugWithR8", tasks)
5252

5353
List<String> buildTypes = new ArrayList<>()
54+
List<String> productFlavors = new ArrayList<>()
5455
if (android != null) {
5556
android.applicationVariants.all(new Action<ApplicationVariant>() {
5657
@Override
@@ -63,13 +64,18 @@ public class ObfPlugin implements Plugin<Project> {
6364
@Override
6465
void execute(ProductFlavor productFlavor) {
6566
def name = upperCaseFirst(productFlavor.name)
66-
for (String buildType : buildTypes) {
67-
addOtherTask(tasks, name, buildType)
68-
}
67+
productFlavors.add(name)
6968
}
7069
})
7170
}
7271

72+
for (String buildType : buildTypes) {
73+
for (String product : productFlavors) {
74+
addOtherTask(tasks, product, buildType)
75+
}
76+
addOtherTask(tasks, "", buildType)
77+
}
78+
7379
for (Task task : tasks) {
7480
task.doLast(action)
7581
}

0 commit comments

Comments
 (0)