Skip to content

Commit df582d8

Browse files
committed
Support the new gradle 4.4 flavor dimension configurations
1 parent 40ac2f0 commit df582d8

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

test-app/app/build.gradle

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import groovy.json.JsonSlurper
2020
import java.nio.file.Paths
21+
import java.util.regex.Matcher
22+
import java.util.regex.Pattern
2123

2224
apply plugin: "com.android.application"
2325

@@ -403,12 +405,20 @@ task extractAllJars {
403405
outputs.dir extractedDependenciesDir
404406

405407
doLast {
406-
def iter;
407-
if (project.selectedBuildType == "release") {
408-
iter = configurations.releaseCompileClasspath.resolve()
409-
} else {
410-
iter = configurations.debugCompileClasspath.resolve()
408+
def buildType = project.selectedBuildType == "release" ? "Release" : "Debug"
409+
def iter = []
410+
Pattern pattern = Pattern.compile("^(.+)${buildType}CompileClasspath\$")
411+
configurations.all{ config ->
412+
Matcher matcher = pattern.matcher(config.name)
413+
if (matcher.find() || config.name == "${buildType.toLowerCase()}CompileClasspath") {
414+
config.resolve().each {
415+
if (!iter.contains(it)) {
416+
iter.push(it)
417+
}
418+
}
419+
}
411420
}
421+
412422
def dependencyCounter = 0
413423
iter.each {
414424
def nextDependency = it

0 commit comments

Comments
 (0)