- ComposeTrace 改用 BuildConfig.ENABLE_TRACE 控制,release 关闭,debug/trace 开启 - core/app 添加 trace buildType:release 优化(R8 + shrink resources)+ 保留 trace 标记 - CalendarMonthView/WeekPager 添加更多自定义 trace marker,覆盖年月视图切换路径 - profile.sh 增强: - 添加 --trace 参数支持 trace 构建 - Perfetto 配置增加 gpu.memory 和 surfaceflinger.frametimeline 数据源 - 报告自动提取帧率百分位、jank 比例、内存摘要 - 添加年月视图切换专项分析指南和基线对比方法 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
99 lines
2.7 KiB
Plaintext
99 lines
2.7 KiB
Plaintext
import java.time.LocalDateTime
|
||
import java.time.format.DateTimeFormatter
|
||
|
||
plugins {
|
||
alias(libs.plugins.androidApplication)
|
||
alias(libs.plugins.composeCompiler)
|
||
}
|
||
|
||
val baseVersion = findProperty("app.version.base") as? String ?: "1.0.0"
|
||
|
||
val gitHash = try {
|
||
providers.exec {
|
||
commandLine("git", "rev-parse", "--short=5", "HEAD")
|
||
}.standardOutput.asText.get().trim()
|
||
} catch (_: Exception) {
|
||
"unknown"
|
||
}
|
||
|
||
val buildDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("ddMMyy"))
|
||
val appVersionName = "${baseVersion}_${gitHash}_${buildDate}"
|
||
|
||
android {
|
||
namespace = "plus.rua.project"
|
||
compileSdk = libs.versions.android.compileSdk.get().toInt()
|
||
|
||
defaultConfig {
|
||
applicationId = "plus.rua.project"
|
||
minSdk = libs.versions.android.minSdk.get().toInt()
|
||
targetSdk = libs.versions.android.targetSdk.get().toInt()
|
||
versionCode = 1
|
||
versionName = appVersionName
|
||
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
isMinifyEnabled = true
|
||
isShrinkResources = true
|
||
proguardFiles(
|
||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||
"proguard-rules.pro"
|
||
)
|
||
signingConfig = signingConfigs.getByName("debug")
|
||
}
|
||
// trace 构建类型:release 优化 + trace 标记保留,用于性能分析
|
||
create("trace") {
|
||
initWith(buildTypes.getByName("release"))
|
||
signingConfig = signingConfigs.getByName("debug")
|
||
matchingFallbacks += listOf("release")
|
||
}
|
||
// benchmark 构建类型供 macrobenchmark 模块使用
|
||
create("benchmark") {
|
||
initWith(buildTypes.getByName("release"))
|
||
signingConfig = signingConfigs.getByName("debug")
|
||
matchingFallbacks += listOf("release")
|
||
isDebuggable = true
|
||
}
|
||
}
|
||
|
||
|
||
buildFeatures {
|
||
compose = true
|
||
buildConfig = false
|
||
}
|
||
|
||
compileOptions {
|
||
sourceCompatibility = JavaVersion.VERSION_17
|
||
targetCompatibility = JavaVersion.VERSION_17
|
||
}
|
||
|
||
packaging {
|
||
resources {
|
||
excludes += listOf(
|
||
"/META-INF/AL2.0",
|
||
"/META-INF/LGPL2.1",
|
||
"/META-INF/LICENSE*",
|
||
"/META-INF/NOTICE*",
|
||
"META-INF/DEPENDENCIES",
|
||
"**/*.kotlin_metadata",
|
||
"**/*.kotlin_module",
|
||
)
|
||
}
|
||
}
|
||
|
||
bundle {
|
||
density { enableSplit = true }
|
||
abi { enableSplit = true }
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
implementation(project(":core"))
|
||
|
||
implementation(platform(libs.compose.bom))
|
||
implementation(libs.androidx.activity.compose)
|
||
debugImplementation(libs.compose.uiToolingPreview)
|
||
debugImplementation(libs.compose.uiTooling)
|
||
}
|