mirror of
https://github.com/apache/cordova-android.git
synced 2026-01-30 00:05:28 +08:00
feat!: API 34 Support (#1678)
* feat!: Upgrade to Gradle and AGP 8 * java 17 * feat!: API 34 Support API 34: Upgrade AGP from 8.2.0-rc01 to 8.2.0-rc02 API 34: Upgrade AGP from 8.2.0-rc02 to 8.2.0-rc03 API 34: Upgrade AGP from 8.2.0-rc03 to 8.2.0 feat: add AndroidKotlinJVMTarget preference to set the kotlin JVM target This is in addition to the java source / target compatibility preferences. AndroidKotlinJVMTarget is only affective if Kotlin is enabled. chore: Upgrade Gradle from 8.4 to 8.5 AGP 8.2.0 -> 8.2.1 Gradle 8.5 -> 8.7 fix: Add --validate-url to gradle wrapper commands AGP 8.4.0 * fix(test): ProjectBuilder using Gradle 8.3, no longer supported version * API 34: Change Kotlin JVM Target default. The new default value is null. When null, it will by default to the Java Target compatibility. Updating AndroidJavaTargetCompatibility will also influence the Kotlin JVM target, unless if AndroidKotlinJVMTarget is also explicitly defined. * removed leftover debug prints * API 34: Gradle Wrapper * API 34: ratignore generated gradle wrapper files * fix gradle wrapper jar via git attributes * fix(test): normalise gradle paths * fix(windows): Gradle paths * fix(windows): Keep CRLF endings for bat files * chore: Updated license for Gradle Wrapper 8.7 pointer * API 34 Support Gradle Tools project * API 34: omit --validate-url on installing the wrapper * revert: LICENSE notice on bundling the gradle wrapper jar * Revert: AGP 8.4 -> 8.3 * test(ci): Added NodeJS 22 to the test matrix --------- Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
This commit is contained in:
@@ -181,6 +181,10 @@ task cdvPrintProps {
|
||||
android {
|
||||
namespace cordovaConfig.PACKAGE_NAMESPACE
|
||||
|
||||
buildFeatures {
|
||||
buildConfig true
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
versionCode cdvVersionCode ?: new BigInteger("" + privateHelpers.extractIntFromManifest("versionCode"))
|
||||
applicationId cordovaConfig.PACKAGE_NAMESPACE
|
||||
@@ -248,8 +252,39 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaLanguageVersion.of(cordovaConfig.JAVA_SOURCE_COMPATIBILITY)
|
||||
targetCompatibility JavaLanguageVersion.of(cordovaConfig.JAVA_TARGET_COMPATIBILITY)
|
||||
}
|
||||
|
||||
if (cordovaConfig.IS_GRADLE_PLUGIN_KOTLIN_ENABLED) {
|
||||
if (cordovaConfig.KOTLIN_JVM_TARGET == null) {
|
||||
// If the value is null, fallback to JAVA_TARGET_COMPATIBILITY,
|
||||
// as they generally should be equal
|
||||
def javaTarget = JavaLanguageVersion.of(cordovaConfig.JAVA_TARGET_COMPATIBILITY)
|
||||
|
||||
// check if javaTarget is <= 8; if so, we need to prefix it with "1."
|
||||
// Starting with 9 and later, the value can be used as is.
|
||||
if (javaTarget.compareTo(JavaLanguageVersion.of(8)) <= 0) {
|
||||
javaTarget = "1." + javaTarget
|
||||
}
|
||||
|
||||
cordovaConfig.KOTLIN_JVM_TARGET = javaTarget
|
||||
}
|
||||
|
||||
// Similar to above, check if kotlin target is <= 8, if so prefix it.
|
||||
// This allows the user to use consistent set of values in config.xml
|
||||
// Rather than having to be aware whether the "1."" prefix is needed.
|
||||
// This check is only done if the value isn't already prefixed with 1.
|
||||
if (
|
||||
!cordovaConfig.KOTLIN_JVM_TARGET.startsWith("1.") &&
|
||||
JavaLanguageVersion.of(cordovaConfig.KOTLIN_JVM_TARGET).compareTo(JavaLanguageVersion.of(8)) <= 0
|
||||
) {
|
||||
cordovaConfig.KOTLIN_JVM_TARGET = "1." + cordovaConfig.KOTLIN_JVM_TARGET
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = cordovaConfig.KOTLIN_JVM_TARGET
|
||||
}
|
||||
}
|
||||
|
||||
if (cdvReleaseSigningPropertiesFile) {
|
||||
|
||||
29
templates/project/tools/settings.gradle
Normal file
29
templates/project/tools/settings.gradle
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
// This is an empty project used to provide Gradle Tooling
|
||||
// Using the main project which loads AGP will enforce a minimum version
|
||||
// requirement on the end-user, requiring a gradle install that satisfies AGP
|
||||
// version requirements.
|
||||
// To avoid that, we utilise this empty project of which we can
|
||||
// freely run the gradle wrapper task against to obtain the
|
||||
// wrapper at the desired version, without being restricted by AGP's version
|
||||
// requirements.
|
||||
// Of course, the installed wrapper must still be of at least the minimum
|
||||
// required version of AGP for the build to work correctly.
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
//This file is intentionally just a comment
|
||||
Reference in New Issue
Block a user