forked from darryrzhong/Android-Compose-MVVM-App
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.build.gradle.kts
More file actions
91 lines (77 loc) · 2.83 KB
/
Copy pathmodule.build.gradle.kts
File metadata and controls
91 lines (77 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
buildscript {
repositories {
google()
mavenCentral()
maven(url = "https://maven.aliyun.com/repository/google")
maven(url = "https://maven.aliyun.com/repository/gradle-plugin")
maven(url = "https://maven.aliyun.com/repository/public")
maven(url = "https://maven.aliyun.com/repository/central")
}
dependencies {
classpath(libs.plugin.android.gradle)
classpath(libs.plugin.kotlin.gradle)
}
}
import com . android . build . gradle . BaseExtension
val isBuildModule: String by project
if (isBuildModule.toBoolean()) {
//作为独立App应用运行
apply(plugin = "com.android.application")
} else {
//作为组件运行
apply(plugin = "com.android.library")
}
apply(plugin = "org.jetbrains.kotlin.android")
// configure<BaseExtension> fails if looked up by type. Use getByName("android") instead.
(extensions.getByName("android") as BaseExtension).apply {
val libs = rootProject.extensions.getByType<VersionCatalogsExtension>().named("libs")
compileSdkVersion(libs.findVersion("android-compileSdk").get().requiredVersion.toInt())
buildToolsVersion(libs.findVersion("android-buildTools").get().requiredVersion)
defaultConfig {
minSdkVersion(libs.findVersion("android-minSdk").get().requiredVersion.toInt())
targetSdkVersion(libs.findVersion("android-targetSdk").get().requiredVersion.toInt())
if (isBuildModule.toBoolean()) {
versionCode(libs.findVersion("android-versionCode").get().requiredVersion.toInt())
versionName(libs.findVersion("android-versionName").get().requiredVersion)
}
consumerProguardFiles("consumer-rules.pro")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments["AROUTER_MODULE_NAME"] = project.name
}
}
}
buildTypes {
getByName("debug") {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
getByName("release") {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
sourceSets {
getByName("main") {
if (isBuildModule.toBoolean()) {
manifest.srcFile("src/main/alone/AndroidManifest.xml")
} else {
manifest.srcFile("src/main/AndroidManifest.xml")
}
}
}
dataBinding {
isEnabled = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}