forked from github/cordova-android
fix: automatic latest build tools finding (#1294)
This commit is contained in:
parent
38ca895459
commit
5e50c1d611
@ -53,10 +53,13 @@ String doFindLatestInstalledBuildTools(String minBuildToolsVersionString) {
|
|||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def minBuildToolsVersion = new Version(minBuildToolsVersionString)
|
||||||
|
def maxVersion = new Version((minBuildToolsVersion.getMajor() + 1) + ".0.0")
|
||||||
|
|
||||||
def highestBuildToolsVersion = buildToolsDirContents
|
def highestBuildToolsVersion = buildToolsDirContents
|
||||||
.collect { new Version(it) }
|
.collect { new Version(it) }
|
||||||
// Invalid inputs will be handled as 0.0.0
|
// Invalid inputs will be handled as 0.0.0
|
||||||
.findAll { it.isHigherThan('0.0.0') }
|
.findAll { it.isHigherThan('0.0.0') && it.isLowerThan(maxVersion) }
|
||||||
.max()
|
.max()
|
||||||
|
|
||||||
if (highestBuildToolsVersion == null) {
|
if (highestBuildToolsVersion == null) {
|
||||||
@ -68,7 +71,7 @@ String doFindLatestInstalledBuildTools(String minBuildToolsVersionString) {
|
|||||||
|
|
||||||
if (highestBuildToolsVersion.isLowerThan(minBuildToolsVersionString)) {
|
if (highestBuildToolsVersion.isLowerThan(minBuildToolsVersionString)) {
|
||||||
throw new RuntimeException("""
|
throw new RuntimeException("""
|
||||||
No usable Android build tools found. Highest installed version is
|
No usable Android build tools found. Highest ${minBuildToolsVersion.getMajor()}.x installed version is
|
||||||
${highestBuildToolsVersion.getOriginalString()}; minimum version
|
${highestBuildToolsVersion.getOriginalString()}; minimum version
|
||||||
required is ${minBuildToolsVersionString}.
|
required is ${minBuildToolsVersionString}.
|
||||||
""".replaceAll(/\s+/, ' ').trim())
|
""".replaceAll(/\s+/, ' ').trim())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user