Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gradle build tools config #1293

Merged
merged 1 commit into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion framework/cdv-gradle-config-defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"MIN_SDK_VERSION": 22,
"SDK_VERSION": 30,
"GRADLE_VERSION": "7.1.1",
"BUILD_TOOLS_VERSION": "30.0.3",
"MIN_BUILD_TOOLS_VERSION": "30.0.3",
"AGP_VERSION": "4.2.2",
"KOTLIN_VERSION": "1.5.20",
"ANDROIDX_APP_COMPAT_VERSION": "1.3.0",
Expand Down
18 changes: 14 additions & 4 deletions framework/cordova.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,20 @@ def doApplyCordovaConfigCustomization() {
cordovaConfig.ANDROIDX_WEBKIT_VERSION = cdvAndroidXWebKitVersion
}

// Ensure the latest installed build tools is selected, with or without defined override
cordovaConfig.LATEST_INSTALLED_BUILD_TOOLS = doFindLatestInstalledBuildTools(
cordovaConfig.BUILD_TOOLS_VERSION
)
if (!cordovaConfig.BUILD_TOOLS_VERSION) {
cordovaConfig.BUILD_TOOLS_VERSION = doFindLatestInstalledBuildTools(
cordovaConfig.MIN_BUILD_TOOLS_VERSION
)
}

// Ensure the configured build tools version is at least our declared minimum
def buildToolsVersion = new Version(cordovaConfig.BUILD_TOOLS_VERSION)
if (buildToolsVersion.isLowerThan(cordovaConfig.MIN_BUILD_TOOLS_VERSION)) {
throw new RuntimeException("""
Expected Android Build Tools version >= ${cordovaConfig.MIN_BUILD_TOOLS_VERSION},
but got Android Build Tools version ${cordovaConfig.BUILD_TOOLS_VERSION}. Please use version ${cordovaConfig.MIN_BUILD_TOOLS_VERSION} or later.
""".replaceAll(/\s+/, ' ').trim())
}
}

// Properties exported here are visible to all plugins.
Expand Down
2 changes: 1 addition & 1 deletion templates/project/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ android {
abortOnError false
}

buildToolsVersion cordovaConfig.LATEST_INSTALLED_BUILD_TOOLS
buildToolsVersion cordovaConfig.BUILD_TOOLS_VERSION

// This code exists for Crosswalk and other Native APIs.
// By default, we multiply the existing version code in the
Expand Down