Upgrade Kotlin to 2.0.20

This upgrade allows us to use https://developer.android.com/develop/ui/compose/compiler as specified in https://developer.android.com/jetpack/androidx/releases/compose-kotlin#pre-release_kotlin_compatibility

kotlinOptions is considered deprecated in preference of kotlin.compilerOptions (https://kotlinlang.org/docs/gradle-compiler-options.html#how-to-define-options)

PiperOrigin-RevId: 725266131
This commit is contained in:
jbibik 2025-02-10 10:30:56 -08:00 committed by Copybara-Service
parent 1a996d87ca
commit d022b570f2
7 changed files with 22 additions and 19 deletions

View File

@ -3,6 +3,8 @@
### Unreleased changes ### Unreleased changes
* Common Library: * Common Library:
* Upgrade Kotlin from 1.9.20 to 2.0.20 and use Compose Compiler Gradle
plugin. Upgrade KotlinX Coroutines library from 1.8.1 to 1.9.0.
* ExoPlayer: * ExoPlayer:
* Transformer: * Transformer:
* Add `MediaProjectionAssetLoader`, which provides media from a * Add `MediaProjectionAssetLoader`, which provides media from a

View File

@ -19,7 +19,8 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:8.3.2' classpath 'com.android.tools.build:gradle:8.3.2'
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.4' classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.4'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20'
classpath 'org.jetbrains.kotlin:compose-compiler-gradle-plugin:2.0.20'
} }
} }
allprojects { allprojects {

View File

@ -30,7 +30,8 @@ project.ext {
// https://cs.android.com/android/platform/superproject/main/+/main:external/guava/METADATA // https://cs.android.com/android/platform/superproject/main/+/main:external/guava/METADATA
guavaVersion = '33.3.1-android' guavaVersion = '33.3.1-android'
glideVersion = '4.14.2' glideVersion = '4.14.2'
kotlinxCoroutinesVersion = '1.8.1' // Not the same as kotlin version, https://github.com/Kotlin/kotlinx.coroutines/releases
kotlinxCoroutinesVersion = '1.9.0'
leakCanaryVersion = '2.10' leakCanaryVersion = '2.10'
mockitoVersion = '3.12.4' mockitoVersion = '3.12.4'
robolectricVersion = '4.14.1' robolectricVersion = '4.14.1'

View File

@ -14,6 +14,7 @@
apply from: '../../constants.gradle' apply from: '../../constants.gradle'
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
android { android {
namespace 'androidx.media3.demo.compose' namespace 'androidx.media3.demo.compose'
@ -54,9 +55,6 @@ android {
buildFeatures { buildFeatures {
compose true compose true
} }
composeOptions {
kotlinCompilerExtensionVersion = "1.5.3"
}
testOptions { testOptions {
unitTests { unitTests {

View File

@ -14,6 +14,7 @@
apply from: '../../constants.gradle' apply from: '../../constants.gradle'
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
android { android {
namespace 'androidx.media3.demo.effect' namespace 'androidx.media3.demo.effect'
@ -54,10 +55,6 @@ android {
buildFeatures { buildFeatures {
compose true compose true
} }
composeOptions {
kotlinCompilerExtensionVersion = "1.5.3"
}
testOptions { testOptions {
unitTests { unitTests {
includeAndroidResources = true includeAndroidResources = true

View File

@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle" apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle"
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
@ -33,9 +36,10 @@ android {
includeAndroidResources = true includeAndroidResources = true
} }
} }
kotlin {
kotlinOptions { compilerOptions {
jvmTarget = '1.8' jvmTarget.set(JvmTarget.JVM_1_8)
}
} }
} }

View File

@ -12,8 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle" apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle"
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
android { android {
namespace 'androidx.media3.ui.compose' namespace 'androidx.media3.ui.compose'
@ -36,13 +39,10 @@ android {
includeAndroidResources = true includeAndroidResources = true
} }
} }
kotlin {
kotlinOptions { compilerOptions {
jvmTarget = '1.8' jvmTarget.set(JvmTarget.JVM_1_8)
} }
// https://developer.android.com/jetpack/androidx/releases/compose-kotlin#pre-release_kotlin_compatibility
composeOptions {
kotlinCompilerExtensionVersion = "1.5.3"
} }
} }