1 /*
2  * Copyright (C) 2023 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 
17 import com.android.build.api.dsl.CommonExtension
18 import com.android.build.gradle.BaseExtension
19 import com.android.build.gradle.api.AndroidBasePlugin
20 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
21 
<lambda>null22 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 val androidTop: String = File(rootDir, "../../../../..").canonicalPath
29 
<lambda>null30 allprojects {
31     extra["androidTop"] = androidTop
32     extra["jetpackComposeVersion"] = "1.7.0-beta02"
33 }
34 
<lambda>null35 subprojects {
36     layout.buildDirectory.set(file("$androidTop/out/gradle-spa/$name"))
37 
38     plugins.withType<AndroidBasePlugin> {
39         configure<BaseExtension> {
40             compileSdkVersion(34)
41 
42             defaultConfig {
43                 minSdk = 21
44                 targetSdk = 35
45             }
46         }
47 
48         configure<JavaPluginExtension> {
49             toolchain {
50                 languageVersion.set(JavaLanguageVersion.of(libs.versions.jvm.get()))
51             }
52         }
53     }
54 
55     afterEvaluate {
56         plugins.withType<AndroidBasePlugin> {
57             the(CommonExtension::class).apply {
58                 if (buildFeatures.compose == true) {
59                     composeOptions {
60                         kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
61                     }
62                 }
63             }
64         }
65     }
66 
67     tasks.withType<KotlinCompile> {
68         kotlinOptions {
69             jvmTarget = libs.versions.jvm.get()
70             freeCompilerArgs = listOf("-Xjvm-default=all")
71         }
72     }
73 }
74