|
|
|
plugins {
|
|
|
|
id("com.android.application")
|
|
|
|
id("kotlin-android")
|
|
|
|
id("kotlin-kapt")
|
|
|
|
}
|
|
|
|
|
|
|
|
android {
|
|
|
|
compileSdk = 30
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId = "com.gyf.csams.foreground"
|
|
|
|
minSdk = 21
|
|
|
|
targetSdk = 30
|
|
|
|
versionCode = 1
|
|
|
|
versionName = "1.0"
|
|
|
|
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
vectorDrawables {
|
|
|
|
useSupportLibrary = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
val appName = "${rootProject.extra["foreground_app_name"]}"
|
|
|
|
val serverAddress = rootProject.extra["SERVER_ADDRESS"]
|
|
|
|
debug {
|
|
|
|
manifestPlaceholders.apply {
|
|
|
|
this["foreground_app_name"] = appName
|
|
|
|
}
|
|
|
|
buildConfigField(type = "String", name = "foreground_app_name", value = "\"$appName\"")
|
|
|
|
buildConfigField(type = "String", name = "SERVER_ADDRESS", value = "\"$serverAddress\"")
|
|
|
|
}
|
|
|
|
release {
|
|
|
|
isMinifyEnabled = false
|
|
|
|
proguardFiles(
|
|
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
|
|
"proguard-rules.pro"
|
|
|
|
)
|
|
|
|
manifestPlaceholders.apply {
|
|
|
|
this["foreground_app_name"] = appName
|
|
|
|
}
|
|
|
|
buildConfigField(type = "String", name = "foreground_app_name", value = "\"$appName\"")
|
|
|
|
buildConfigField(type = "String", name = "SERVER_ADDRESS", value = "\"$serverAddress\"")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
}
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
buildFeatures {
|
|
|
|
compose = true
|
|
|
|
}
|
|
|
|
composeOptions {
|
|
|
|
kotlinCompilerExtensionVersion = rootProject.extra["compose_version"] as String
|
|
|
|
}
|
|
|
|
packagingOptions {
|
|
|
|
resources.excludes.add("META-INF/AL2.0")
|
|
|
|
resources.excludes.add("META-INF/LGPL2.1")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
implementation(project(":lib"))
|
|
|
|
kapt("androidx.room:room-compiler:${rootProject.extra["room_version"]}")
|
|
|
|
|
|
|
|
// optional - Test helpers
|
|
|
|
testImplementation("androidx.room:room-testing:${rootProject.extra["room_version"]}")
|
|
|
|
//测试
|
|
|
|
testImplementation("junit:junit:4.13.2")
|
|
|
|
/**
|
|
|
|
* A cross environment JUnit4 runner for Android tests.
|
|
|
|
* https://developer.android.com/reference/androidx/test/ext/junit/runners/package-summary?hl=en
|
|
|
|
*/
|
|
|
|
androidTestImplementation("androidx.test.ext:junit:1.1.2")
|
|
|
|
/**
|
|
|
|
* https://developer.android.com/training/testing/espresso
|
|
|
|
* 使用 Espresso 来编写简洁、美观且可靠的 Android 界面测试。
|
|
|
|
* 包含核心和基本的 View 匹配器、操作和断言
|
|
|
|
*/
|
|
|
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
|
|
|
|
// androidTestImplementation("androidx.compose.ui:ui-test-junit4:${rootProject.extra["compose_version"]}")
|
|
|
|
|
|
|
|
}
|