From c2adeda953563056c0fd11d20fd598bfbf797df4 Mon Sep 17 00:00:00 2001 From: Jaehwa Noh Date: Sat, 11 Oct 2025 22:18:04 +0900 Subject: [PATCH 1/2] Replace a deprecated `kotlinOptions` to `compilerOptions` Extension --- benchmark/build.gradle.kts | 25 +++++++++++++++++++--- core/camera/build.gradle.kts | 6 +++--- feature/postcapture/build.gradle.kts | 10 +++++---- feature/preview/build.gradle.kts | 10 +++++---- ui/components/build.gradle.kts | 10 +++++---- ui/components/capture/build.gradle.kts | 10 +++++---- ui/uistate/build.gradle.kts | 10 +++++---- ui/uistate/capture/build.gradle.kts | 10 +++++---- ui/uistateadapter/build.gradle.kts | 10 +++++---- ui/uistateadapter/capture/build.gradle.kts | 10 +++++---- 10 files changed, 73 insertions(+), 38 deletions(-) diff --git a/benchmark/build.gradle.kts b/benchmark/build.gradle.kts index 0c949e17a..95b0f227c 100644 --- a/benchmark/build.gradle.kts +++ b/benchmark/build.gradle.kts @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2025 The Android Open Source Project + * + * Licensed 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. + */ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + /* * Copyright (C) 2023 The Android Open Source Project * @@ -28,8 +45,10 @@ android { targetCompatibility = JavaVersion.VERSION_1_8 } - kotlinOptions { - jvmTarget = "1.8" + kotlin { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_1_8) + } } defaultConfig { @@ -79,4 +98,4 @@ androidComponents { beforeVariants(selector().all()) { it.enable = it.buildType == "benchmark" } -} \ No newline at end of file +} diff --git a/core/camera/build.gradle.kts b/core/camera/build.gradle.kts index 7e84be8d6..4b3b6f6d6 100644 --- a/core/camera/build.gradle.kts +++ b/core/camera/build.gradle.kts @@ -94,10 +94,10 @@ android { } kotlin { jvmToolchain(17) - } - kotlinOptions { - freeCompilerArgs += "-Xcontext-receivers" + compilerOptions { + freeCompilerArgs.add("-Xcontext-receivers") + } } } diff --git a/feature/postcapture/build.gradle.kts b/feature/postcapture/build.gradle.kts index 06836538d..4fcc964b0 100644 --- a/feature/postcapture/build.gradle.kts +++ b/feature/postcapture/build.gradle.kts @@ -46,9 +46,15 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + kotlin { jvmToolchain(17) + + compilerOptions { + freeCompilerArgs.add("-Xcontext-receivers") + } } + buildFeatures { buildConfig = true compose = true @@ -74,10 +80,6 @@ android { } } } - - kotlinOptions { - freeCompilerArgs += "-Xcontext-receivers" - } } dependencies { diff --git a/feature/preview/build.gradle.kts b/feature/preview/build.gradle.kts index a2a1bed97..6fd77500d 100644 --- a/feature/preview/build.gradle.kts +++ b/feature/preview/build.gradle.kts @@ -46,9 +46,15 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + kotlin { jvmToolchain(17) + + compilerOptions { + freeCompilerArgs.add("-Xcontext-receivers") + } } + buildFeatures { buildConfig = true compose = true @@ -74,10 +80,6 @@ android { } } } - - kotlinOptions { - freeCompilerArgs += "-Xcontext-receivers" - } } dependencies { diff --git a/ui/components/build.gradle.kts b/ui/components/build.gradle.kts index 02d3b2dca..ac066963a 100644 --- a/ui/components/build.gradle.kts +++ b/ui/components/build.gradle.kts @@ -46,17 +46,19 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + kotlin { jvmToolchain(17) + + compilerOptions { + freeCompilerArgs.add("-Xcontext-receivers") + } } + buildFeatures { buildConfig = true compose = true } - - kotlinOptions { - freeCompilerArgs += "-Xcontext-receivers" - } } dependencies { diff --git a/ui/components/capture/build.gradle.kts b/ui/components/capture/build.gradle.kts index 5177ea56c..b966ea75a 100644 --- a/ui/components/capture/build.gradle.kts +++ b/ui/components/capture/build.gradle.kts @@ -46,17 +46,19 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + kotlin { jvmToolchain(17) + + compilerOptions { + freeCompilerArgs.add("-Xcontext-receivers") + } } + buildFeatures { buildConfig = true compose = true } - - kotlinOptions { - freeCompilerArgs += "-Xcontext-receivers" - } } dependencies { diff --git a/ui/uistate/build.gradle.kts b/ui/uistate/build.gradle.kts index e06c9e4c7..67ee7aa09 100644 --- a/ui/uistate/build.gradle.kts +++ b/ui/uistate/build.gradle.kts @@ -46,17 +46,19 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + kotlin { jvmToolchain(17) + + compilerOptions { + freeCompilerArgs.add("-Xcontext-receivers") + } } + buildFeatures { buildConfig = true compose = true } - - kotlinOptions { - freeCompilerArgs += "-Xcontext-receivers" - } } dependencies { diff --git a/ui/uistate/capture/build.gradle.kts b/ui/uistate/capture/build.gradle.kts index 8cfba77b1..a5146ebd3 100644 --- a/ui/uistate/capture/build.gradle.kts +++ b/ui/uistate/capture/build.gradle.kts @@ -46,17 +46,19 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + kotlin { jvmToolchain(17) + + compilerOptions { + freeCompilerArgs.add("-Xcontext-receivers") + } } + buildFeatures { buildConfig = true compose = true } - - kotlinOptions { - freeCompilerArgs += "-Xcontext-receivers" - } } dependencies { diff --git a/ui/uistateadapter/build.gradle.kts b/ui/uistateadapter/build.gradle.kts index 2826a1033..85f7b4ba2 100644 --- a/ui/uistateadapter/build.gradle.kts +++ b/ui/uistateadapter/build.gradle.kts @@ -46,17 +46,19 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + kotlin { jvmToolchain(17) + + compilerOptions { + freeCompilerArgs.add("-Xcontext-receivers") + } } + buildFeatures { buildConfig = true compose = true } - - kotlinOptions { - freeCompilerArgs += "-Xcontext-receivers" - } } dependencies { diff --git a/ui/uistateadapter/capture/build.gradle.kts b/ui/uistateadapter/capture/build.gradle.kts index cb4f804bf..56fb4d3fd 100644 --- a/ui/uistateadapter/capture/build.gradle.kts +++ b/ui/uistateadapter/capture/build.gradle.kts @@ -46,17 +46,19 @@ android { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } + kotlin { jvmToolchain(17) + + compilerOptions { + freeCompilerArgs.add("-Xcontext-receivers") + } } + buildFeatures { buildConfig = true compose = true } - - kotlinOptions { - freeCompilerArgs += "-Xcontext-receivers" - } } dependencies { From fb85e057c7abb26cc2e914ccec60b5be094888c3 Mon Sep 17 00:00:00 2001 From: Jaehwa Noh Date: Sat, 11 Oct 2025 22:21:06 +0900 Subject: [PATCH 2/2] Reorder copyright. --- benchmark/build.gradle.kts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/benchmark/build.gradle.kts b/benchmark/build.gradle.kts index 95b0f227c..114462e21 100644 --- a/benchmark/build.gradle.kts +++ b/benchmark/build.gradle.kts @@ -15,22 +15,6 @@ */ import org.jetbrains.kotlin.gradle.dsl.JvmTarget -/* - * Copyright (C) 2023 The Android Open Source Project - * - * Licensed 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. - */ - plugins { alias(libs.plugins.android.test) alias(libs.plugins.kotlin.android)