Initialize Compose Launcher source and deployment
This commit is contained in:
commit
12a8c24441
77 files changed
+9594
No files matched your search
@@ -0,0 +1,90 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
id("org.jetbrains.kotlin.plugin.serialization")
|
||||
}
|
||||
|
||||
fun buildConfigString(value: String): String =
|
||||
"\"" + value.replace("\\", "\\\\").replace("\"", "\\\"") + "\""
|
||||
|
||||
val syncServer = providers.environmentVariable("LAUNCHER_SYNC_SERVER")
|
||||
.orElse(providers.gradleProperty("launcherSyncServer")).orNull.orEmpty()
|
||||
val deviceToken = providers.environmentVariable("LAUNCHER_DEVICE_TOKEN")
|
||||
.orElse(providers.gradleProperty("launcherDeviceToken")).orNull.orEmpty()
|
||||
|
||||
android {
|
||||
namespace = "com.ttstd.compose.launcher"
|
||||
compileSdk = 37
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.ttstd.compose.launcher"
|
||||
minSdk = 26
|
||||
targetSdk = 37
|
||||
versionCode = 2
|
||||
versionName = "1.1.0"
|
||||
buildConfigField("String", "SYNC_SERVER", buildConfigString(syncServer))
|
||||
buildConfigField("String", "DEVICE_TOKEN", buildConfigString(deviceToken))
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
// 不加 applicationIdSuffix:Launcher 的包名一旦变化,
|
||||
// 系统会当成另一个 HOME 应用,且 widget hostId / 布局文件都不通用了
|
||||
isMinifyEnabled = false
|
||||
}
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
packaging {
|
||||
resources.excludes += setOf("/META-INF/{AL2.0,LGPL2.1}")
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests.isReturnDefaultValues = true
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.JVM_1_8)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.core:core-ktx:1.13.1")
|
||||
implementation("androidx.activity:activity-compose:1.9.2")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.6")
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.6")
|
||||
|
||||
implementation(platform("androidx.compose:compose-bom:2024.09.03"))
|
||||
implementation("androidx.compose.ui:ui")
|
||||
implementation("androidx.compose.ui:ui-graphics")
|
||||
implementation("androidx.compose.foundation:foundation")
|
||||
implementation("androidx.compose.material3:material3")
|
||||
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
|
||||
|
||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
|
||||
// 纯 Kotlin 逻辑(映射 / 协议校验)在这里跑,不需要真机
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
}
|
||||
Reference in new issue
Block a user