Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 1 | /* |
Chaohui Wang | 2652147 | 2023-11-03 23:19:57 +0800 | [diff] [blame] | 2 | * Copyright (C) 2023 The Android Open Source Project |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 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 | |
Chaohui Wang | cb737f8 | 2023-11-29 13:37:50 +0800 | [diff] [blame] | 28 | val androidTop: String = File(rootDir, "../../../../..").canonicalPath |
Chaohui Wang | 2652147 | 2023-11-03 23:19:57 +0800 | [diff] [blame] | 29 | |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 30 | allprojects { |
Chaohui Wang | 2652147 | 2023-11-03 23:19:57 +0800 | [diff] [blame] | 31 | extra["androidTop"] = androidTop |
Chaohui Wang | fcc24ec | 2024-03-21 14:02:36 +0800 | [diff] [blame] | 32 | extra["jetpackComposeVersion"] = "1.7.0-alpha05" |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | subprojects { |
Chaohui Wang | 2652147 | 2023-11-03 23:19:57 +0800 | [diff] [blame] | 36 | layout.buildDirectory.set(file("$androidTop/out/gradle-spa/$name")) |
| 37 | |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 38 | plugins.withType<AndroidBasePlugin> { |
| 39 | configure<BaseExtension> { |
Chaohui Wang | f7f3e96 | 2023-06-23 12:22:25 +0800 | [diff] [blame] | 40 | compileSdkVersion(34) |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 41 | |
| 42 | defaultConfig { |
| 43 | minSdk = 21 |
| 44 | targetSdk = 34 |
| 45 | } |
Chaohui Wang | 2652147 | 2023-11-03 23:19:57 +0800 | [diff] [blame] | 46 | } |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 47 | |
Chaohui Wang | 2652147 | 2023-11-03 23:19:57 +0800 | [diff] [blame] | 48 | configure<JavaPluginExtension> { |
| 49 | toolchain { |
| 50 | languageVersion.set(JavaLanguageVersion.of(libs.versions.jvm.get())) |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | afterEvaluate { |
| 56 | plugins.withType<AndroidBasePlugin> { |
Chaohui Wang | ef4a221 | 2023-08-16 10:15:18 +0800 | [diff] [blame] | 57 | the(CommonExtension::class).apply { |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 58 | if (buildFeatures.compose == true) { |
| 59 | composeOptions { |
Chaohui Wang | ef4a221 | 2023-08-16 10:15:18 +0800 | [diff] [blame] | 60 | kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 61 | } |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | tasks.withType<KotlinCompile> { |
| 68 | kotlinOptions { |
Chaohui Wang | 2652147 | 2023-11-03 23:19:57 +0800 | [diff] [blame] | 69 | jvmTarget = libs.versions.jvm.get() |
Chaohui Wang | 4c18b35 | 2023-06-08 16:11:22 +0800 | [diff] [blame] | 70 | freeCompilerArgs = listOf("-Xjvm-default=all") |
| 71 | } |
| 72 | } |
| 73 | } |