You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by no...@apache.org on 2021/07/26 16:26:52 UTC

[cordova-android] branch master updated: fix: gradle build tools config (#1293)

This is an automated email from the ASF dual-hosted git repository.

normanbreau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git


The following commit(s) were added to refs/heads/master by this push:
     new c11fcc1  fix: gradle build tools config (#1293)
c11fcc1 is described below

commit c11fcc10e81aa6390a11601d33f615cc3def1a5c
Author: Norman Breau <no...@normanbreau.com>
AuthorDate: Mon Jul 26 13:26:42 2021 -0300

    fix: gradle build tools config (#1293)
---
 framework/cdv-gradle-config-defaults.json |  2 +-
 framework/cordova.gradle                  | 18 ++++++++++++++----
 templates/project/app/build.gradle        |  2 +-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/framework/cdv-gradle-config-defaults.json b/framework/cdv-gradle-config-defaults.json
index 21e6b16..6a84a15 100644
--- a/framework/cdv-gradle-config-defaults.json
+++ b/framework/cdv-gradle-config-defaults.json
@@ -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",
diff --git a/framework/cordova.gradle b/framework/cordova.gradle
index 6e18304..b8225bc 100644
--- a/framework/cordova.gradle
+++ b/framework/cordova.gradle
@@ -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.
diff --git a/templates/project/app/build.gradle b/templates/project/app/build.gradle
index ae034c8..f1b41d7 100644
--- a/templates/project/app/build.gradle
+++ b/templates/project/app/build.gradle
@@ -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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org