You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2021/04/18 22:30:17 UTC
[cordova-android] branch master updated: feat: allow appcompat
version to be configurable (#1208)
This is an automated email from the ASF dual-hosted git repository.
erisu 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 8d40770 feat: allow appcompat version to be configurable (#1208)
8d40770 is described below
commit 8d407708d421ca07d986bdf75a8e04dbe5ba997a
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Mon Apr 19 07:30:06 2021 +0900
feat: allow appcompat version to be configurable (#1208)
---
bin/templates/cordova/lib/prepare.js | 5 +++++
bin/templates/project/app/build.gradle | 10 +++++++++-
bin/templates/project/build.gradle | 1 +
framework/build.gradle | 9 ++++++++-
4 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/bin/templates/cordova/lib/prepare.js b/bin/templates/cordova/lib/prepare.js
index c4e9acb..27e952e 100644
--- a/bin/templates/cordova/lib/prepare.js
+++ b/bin/templates/cordova/lib/prepare.js
@@ -61,6 +61,7 @@ module.exports.prepare = function (cordovaProject, options) {
const targetSdkVersion = this._config.getPreference('android-targetSdkVersion', 'android');
const isGradlePluginKotlinEnabled = this._config.getPreference('GradlePluginKotlinEnabled', 'android');
const gradlePluginKotlinCodeStyle = this._config.getPreference('GradlePluginKotlinCodeStyle', 'android');
+ const androidXAppCompatVersion = this._config.getPreference('AndroidXAppCompatVersion', 'android');
const gradlePropertiesUserConfig = {};
if (minSdkVersion) gradlePropertiesUserConfig.cdvMinSdkVersion = minSdkVersion;
@@ -71,6 +72,10 @@ module.exports.prepare = function (cordovaProject, options) {
gradlePropertiesUserConfig['kotlin.code.style'] = gradlePluginKotlinCodeStyle || 'official';
}
+ if (androidXAppCompatVersion) {
+ gradlePropertiesUserConfig.cdvAndroidXAppCompatVersion = androidXAppCompatVersion;
+ }
+
const gradlePropertiesParser = new GradlePropertiesParser(this.locations.root);
gradlePropertiesParser.configure(gradlePropertiesUserConfig);
diff --git a/bin/templates/project/app/build.gradle b/bin/templates/project/app/build.gradle
index 4ff458b..74996e2 100644
--- a/bin/templates/project/app/build.gradle
+++ b/bin/templates/project/app/build.gradle
@@ -137,6 +137,11 @@ ext {
cdvBuildArch = null
}
+ // Sets the default cdvAndroidXAppCompatVersion to the given value.
+ if (!project.hasProperty('cdvAndroidXAppCompatVersion')) {
+ cdvAndroidXAppCompatVersion = null
+ }
+
// Plugin gradle extensions can append to this to have code run at the end.
cdvPluginPostBuildExtras = []
}
@@ -185,6 +190,8 @@ ext.cdvTargetSdkVersion = cdvTargetSdkVersion == null ? defaultTargetSdkVersion
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)
+ext.cdvAndroidXAppCompatVersion = cdvAndroidXAppCompatVersion == null ? defaultAndroidXAppCompatVersion : cdvAndroidXAppCompatVersion
+
def computeBuildTargetName(debugBuild) {
def ret = 'assemble'
if (cdvBuildMultipleApks && cdvBuildArch) {
@@ -219,6 +226,7 @@ task cdvPrintProps {
println('cdvDebugSigningPropertiesFile=' + cdvDebugSigningPropertiesFile)
println('cdvBuildArch=' + cdvBuildArch)
println('computedVersionCode=' + android.defaultConfig.versionCode)
+ println('cdvAndroidXAppCompatVersion=' + cdvAndroidXAppCompatVersion)
android.productFlavors.each { flavor ->
println('computed' + flavor.name.capitalize() + 'VersionCode=' + flavor.versionCode)
}
@@ -339,7 +347,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
- implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation "androidx.appcompat:appcompat:$cdvAndroidXAppCompatVersion"
if (cdvHelpers.getConfigPreference('GradlePluginKotlinEnabled', 'false').toBoolean()) {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle
index 88bfc7f..a95a109 100644
--- a/bin/templates/project/build.gradle
+++ b/bin/templates/project/build.gradle
@@ -40,6 +40,7 @@ allprojects {
defaultMinSdkVersion=22 //Integer - Minimum requirement is Android 5.1
defaultTargetSdkVersion=30 //Integer - We ALWAYS target the latest by default
defaultCompileSdkVersion=30 //Integer - We ALWAYS compile with the latest by default
+ defaultAndroidXAppCompatVersion="1.2.0" //String - We ALWAYS compile with the latest stable by default
}
}
diff --git a/framework/build.gradle b/framework/build.gradle
index 5970f62..2bb483b 100644
--- a/framework/build.gradle
+++ b/framework/build.gradle
@@ -26,6 +26,13 @@ ext {
} else {
cdvMinSdkVersion = 22; // current Cordova's default
}
+
+ if (project.hasProperty('cdvAndroidXAppCompatVersion')) {
+ cdvAndroidXAppCompatVersion = cdvAndroidXAppCompatVersion
+ println '[Cordova] cdvAndroidXAppCompatVersion is overridden, try it at your own risk.'
+ } else {
+ cdvAndroidXAppCompatVersion = "1.2.0"; // current Cordova's default
+ }
}
buildscript {
@@ -123,7 +130,7 @@ task sourcesJar(type: Jar) {
}
dependencies {
- implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation "androidx.appcompat:appcompat:$cdvAndroidXAppCompatVersion"
}
artifacts {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org