79 lines
2.3 KiB
Groovy
79 lines
2.3 KiB
Groovy
/**
|
||
* 整个项目(app/module)的通用gradle配置
|
||
* 需要自行确定namespace。需要自行动态判定module是属于application(并配置applicationId),还是library。
|
||
* 默认依赖基础组件module,(:modulesBase:lib_base)
|
||
*/
|
||
|
||
apply plugin: 'org.jetbrains.kotlin.android'
|
||
apply plugin: 'kotlin-kapt'
|
||
|
||
android {
|
||
//rootProject 是指项目的根项目
|
||
compileSdk rootProject.ext.android.compileSdk
|
||
|
||
//ARouter配置 kotlin
|
||
kapt {
|
||
arguments {
|
||
arg("AROUTER_MODULE_NAME", project.getName())
|
||
}
|
||
}
|
||
|
||
defaultConfig {
|
||
|
||
minSdk rootProject.ext.android.minSdk
|
||
targetSdk rootProject.ext.android.targetSdk
|
||
versionCode rootProject.ext.android.versionCode
|
||
versionName rootProject.ext.android.versionName
|
||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||
|
||
}
|
||
|
||
viewBinding {
|
||
enabled = true
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
minifyEnabled false
|
||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||
}
|
||
}
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_1_8
|
||
targetCompatibility JavaVersion.VERSION_1_8
|
||
}
|
||
|
||
kotlinOptions {
|
||
jvmTarget = '1.8'
|
||
}
|
||
|
||
kotlin {
|
||
jvmToolchain(8)
|
||
}
|
||
|
||
//动态切换集成/组件模式的AndroidManifest。注意:需要自己添加debug的AndroidManifest文件
|
||
sourceSets {
|
||
main {
|
||
if (rootProject.ext.isDebug) {
|
||
manifest.srcFile 'src/main/debug/AndroidManifest.xml'
|
||
} else {
|
||
manifest.srcFile 'src/main/AndroidManifest.xml'
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
dependencies {
|
||
//使用implementation不传递依赖,可以防止重复依赖或依赖冲突
|
||
//公共依赖包
|
||
implementation project(':modulesBase:lib_base')
|
||
//ARouter 注解处理器 APT需要在每个使用的组件的build.gradle去添加,并在defaultConfig里添加project.getName。这里属于通用配置,一次配置完。
|
||
kapt rootProject.ext.arouter_compiler
|
||
kapt rootProject.ext.glide_compiler
|
||
|
||
testImplementation 'junit:junit:4.13.2'
|
||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||
} |