Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Chaohui Wang | ef4a221 | 2023-08-16 10:15:18 +0800 | [diff] [blame] | 17 | import com.android.build.api.dsl.CommonExtension |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 18 | import com.android.build.gradle.BaseExtension |
| 19 | import com.android.build.gradle.api.AndroidBasePlugin |
| 20 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| 21 | |
| 22 | plugins { |
| 23 | alias(libs.plugins.android.application) apply false |
| 24 | alias(libs.plugins.android.library) apply false |
| 25 | alias(libs.plugins.kotlin.android) apply false |
| 26 | } |
| 27 | |
| 28 | allprojects { |
Chaohui Wang | e5652a6 | 2023-10-13 09:38:05 +0800 | [diff] [blame^] | 29 | extra["jetpackComposeVersion"] = "1.6.0-alpha07" |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | subprojects { |
| 33 | plugins.withType<AndroidBasePlugin> { |
| 34 | configure<BaseExtension> { |
Chaohui Wang | f7f3e96 | 2023-06-23 12:22:25 +0800 | [diff] [blame] | 35 | compileSdkVersion(34) |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 36 | |
| 37 | defaultConfig { |
| 38 | minSdk = 21 |
| 39 | targetSdk = 34 |
| 40 | } |
| 41 | |
| 42 | compileOptions { |
| 43 | sourceCompatibility = JavaVersion.VERSION_17 |
| 44 | targetCompatibility = JavaVersion.VERSION_17 |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | afterEvaluate { |
| 50 | plugins.withType<AndroidBasePlugin> { |
Chaohui Wang | ef4a221 | 2023-08-16 10:15:18 +0800 | [diff] [blame] | 51 | the(CommonExtension::class).apply { |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 52 | if (buildFeatures.compose == true) { |
| 53 | composeOptions { |
Chaohui Wang | ef4a221 | 2023-08-16 10:15:18 +0800 | [diff] [blame] | 54 | kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 55 | } |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | tasks.withType<KotlinCompile> { |
| 62 | kotlinOptions { |
| 63 | jvmTarget = "17" |
| 64 | freeCompilerArgs = listOf("-Xjvm-default=all") |
| 65 | } |
| 66 | } |
| 67 | } |