blob: 4147813bd05910592808cbb4707a73fd44d85af4 [file] [log] [blame]
Chaohui Wang4c18b352023-06-08 16:11:22 +08001/*
Chaohui Wang26521472023-11-03 23:19:57 +08002 * Copyright (C) 2023 The Android Open Source Project
Chaohui Wang4c18b352023-06-08 16:11:22 +08003 *
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 Wangef4a2212023-08-16 10:15:18 +080017import com.android.build.api.dsl.CommonExtension
Chaohui Wang4c18b352023-06-08 16:11:22 +080018import com.android.build.gradle.BaseExtension
19import com.android.build.gradle.api.AndroidBasePlugin
20import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
21
22plugins {
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 Wangcb737f82023-11-29 13:37:50 +080028val androidTop: String = File(rootDir, "../../../../..").canonicalPath
Chaohui Wang26521472023-11-03 23:19:57 +080029
Chaohui Wang4c18b352023-06-08 16:11:22 +080030allprojects {
Chaohui Wang26521472023-11-03 23:19:57 +080031 extra["androidTop"] = androidTop
Chaohui Wangfcc24ec2024-03-21 14:02:36 +080032 extra["jetpackComposeVersion"] = "1.7.0-alpha05"
Chaohui Wang4c18b352023-06-08 16:11:22 +080033}
34
35subprojects {
Chaohui Wang26521472023-11-03 23:19:57 +080036 layout.buildDirectory.set(file("$androidTop/out/gradle-spa/$name"))
37
Chaohui Wang4c18b352023-06-08 16:11:22 +080038 plugins.withType<AndroidBasePlugin> {
39 configure<BaseExtension> {
Chaohui Wangf7f3e962023-06-23 12:22:25 +080040 compileSdkVersion(34)
Chaohui Wang4c18b352023-06-08 16:11:22 +080041
42 defaultConfig {
43 minSdk = 21
44 targetSdk = 34
45 }
Chaohui Wang26521472023-11-03 23:19:57 +080046 }
Chaohui Wang4c18b352023-06-08 16:11:22 +080047
Chaohui Wang26521472023-11-03 23:19:57 +080048 configure<JavaPluginExtension> {
49 toolchain {
50 languageVersion.set(JavaLanguageVersion.of(libs.versions.jvm.get()))
Chaohui Wang4c18b352023-06-08 16:11:22 +080051 }
52 }
53 }
54
55 afterEvaluate {
56 plugins.withType<AndroidBasePlugin> {
Chaohui Wangef4a2212023-08-16 10:15:18 +080057 the(CommonExtension::class).apply {
Chaohui Wang4c18b352023-06-08 16:11:22 +080058 if (buildFeatures.compose == true) {
59 composeOptions {
Chaohui Wangef4a2212023-08-16 10:15:18 +080060 kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
Chaohui Wang4c18b352023-06-08 16:11:22 +080061 }
62 }
63 }
64 }
65 }
66
67 tasks.withType<KotlinCompile> {
68 kotlinOptions {
Chaohui Wang26521472023-11-03 23:19:57 +080069 jvmTarget = libs.versions.jvm.get()
Chaohui Wang4c18b352023-06-08 16:11:22 +080070 freeCompilerArgs = listOf("-Xjvm-default=all")
71 }
72 }
73}