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 
17 import com.android.build.gradle.BaseExtension
18 import com.android.build.gradle.api.AndroidBasePlugin
19 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
20 
21 plugins {
22     alias(libs.plugins.android.application) apply false
23     alias(libs.plugins.android.library) apply false
24     alias(libs.plugins.kotlin.android) apply false
25 }
26 
27 allprojects {
28     extra["jetpackComposeVersion"] = "1.6.0-alpha01"
29 }
30 
31 subprojects {
32     plugins.withType<AndroidBasePlugin> {
33         configure<BaseExtension> {
34             compileSdkVersion(34)
35 
36             defaultConfig {
37                 minSdk = 21
38                 targetSdk = 34
39             }
40 
41             compileOptions {
42                 sourceCompatibility = JavaVersion.VERSION_17
43                 targetCompatibility = JavaVersion.VERSION_17
44             }
45         }
46     }
47 
48     afterEvaluate {
49         plugins.withType<AndroidBasePlugin> {
50             configure<BaseExtension> {
51                 if (buildFeatures.compose == true) {
52                     composeOptions {
53                         kotlinCompilerExtensionVersion = "1.4.4"
54                     }
55                 }
56             }
57         }
58     }
59 
60     tasks.withType<KotlinCompile> {
61         kotlinOptions {
62             jvmTarget = "17"
63             freeCompilerArgs = listOf("-Xjvm-default=all")
64         }
65     }
66 }
67