You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
csamsclient/app/build.gradle.kts

136 lines
5.1 KiB

4 years ago
plugins {
id("com.android.application")
id("kotlin-android")
4 years ago
id("org.jetbrains.kotlin.plugin.serialization") version "1.4.32"
4 years ago
}
android {
compileSdk = 30
defaultConfig {
applicationId = "com.gyf.csams"
minSdk = 21
targetSdk = 30
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}
buildTypes {
val appName="${rootProject.extra["APP_NAME"]}"
4 years ago
val serverAddress=rootProject.extra["SERVER_ADDRESS"]
4 years ago
debug {
manifestPlaceholders(mapOf("APP_NAME" to appName))
buildConfigField(type="String",name="APP_NAME",value = "\"$appName\"")
4 years ago
buildConfigField(type="String",name="SERVER_ADDRESS",value = "\"$serverAddress\"")
4 years ago
}
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
manifestPlaceholders(mapOf("APP_NAME" to appName))
buildConfigField(type="String",name="APP_NAME",value = "\"$appName\"")
4 years ago
buildConfigField(type="String",name="SERVER_ADDRESS",value = "\"$serverAddress\"")
4 years ago
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
useIR = true
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = rootProject.extra["compose_version"] as String
}
4 years ago
packagingOptions {
resources.excludes.add("META-INF/AL2.0")
resources.excludes.add("META-INF/LGPL2.1")
}
4 years ago
}
dependencies {
/**
* 针对最新的平台功能和 API 调整应用,同时还支持旧设备。
* https://developer.android.com/jetpack/androidx/releases/core
*/
implementation("androidx.core:core-ktx:1.3.2")
/**
* 允许在平台旧版 API 上访问新 API(很多使用 Material Design)。
* https://developer.android.com/jetpack/androidx/releases/appcompat
*/
implementation("androidx.appcompat:appcompat:1.2.0")
/**
* 与设备互动所需的 Compose UI 的基本组件,包括布局、绘图和输入。
* https://developer.android.com/jetpack/androidx/releases/compose-ui
*/
implementation("androidx.compose.ui:ui:${rootProject.extra["compose_version"]}")
implementation("androidx.compose.ui:ui-tooling:${rootProject.extra["compose_version"]}")
/**
* Compose 的编程模型和状态管理的基本构建块,以及 Compose 编译器插件针对的核心运行时。
* https://developer.android.com/jetpack/androidx/releases/compose-runtime
*/
implementation("androidx.compose.runtime:runtime-livedata:${rootProject.extra["compose_version"]}")
//Material Components
implementation("com.google.android.material:material:1.3.0")
/**
* 使用现成可用的 Material Design 组件构建 Jetpack Compose UI。这是更高层级的 Compose 入口点,旨在提供与 www.material.io 上描述的组件一致的组件。
* https://developer.android.com/jetpack/androidx/releases/compose-material
*/
implementation("androidx.compose.material:material:${rootProject.extra["compose_version"]}")
/**
* 生命周期感知型组件
* https://developer.android.com/jetpack/androidx/releases/lifecycle
*/
implementation("androidx.lifecycle:lifecycle-runtime-ktx:${rootProject.extra["lifecycle_version"]}")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha04")
/**
* 访问基于 Activity 构建的可组合 API。
* https://developer.android.com/jetpack/androidx/releases/activity
*/
4 years ago
implementation("androidx.activity:activity-compose:1.3.0-alpha07")
4 years ago
/**
* Simple, pretty and powerful logger for android
* https://github.com/orhanobut/logger
*/
implementation("com.orhanobut:logger:2.2.0")
4 years ago
/**
*
* https://github.com/square/okhttp
*/
implementation("com.squareup.okhttp3:okhttp:4.9.1")
/**
* https://github.com/google/gson
*/
implementation("com.google.code.gson:gson:2.8.6")
/**
* https://kotlinlang.org/docs/serialization.html
*/
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
4 years ago
//测试
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"]}")
}