- 新增 AnimLog.kt,提供 BuildConfig.DEBUG 条件控制的 logd 日志工具, 支持 lambda 延迟求值以避免 release 模式下的字符串拼接开销 - 全模块替换 android.util.Log.d 为 logd,并将日志重构为 lambda 形式 - CalendarViewModel: toggleYearView / selectMonthFromYearView 添加纳秒级 耗时追踪日志 - CalendarMonthView / CalendarMonthPage / CalendarPager / YearGridView: 增加重组/进入/离开/页面切换/动画状态变化的详细调试日志 - 折叠动画/滑动进度日志添加状态去重,避免频繁重复输出 - P0: 缓存 sharedElement tween 实例(CalendarMonthView + YearGridView), 避免每次重组创建新实例导致动画重新计算 - P0: YearPager pageYear 使用 remember 稳定计算,避免 settledPage 与 yearViewYear 不同步导致抖动 - 移除 YearPager crossFadeAlpha,改为无透明度渐变 - app/build.gradle.kts 添加 profileinstaller 依赖 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
100 lines
2.8 KiB
Plaintext
100 lines
2.8 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)
|
||
implementation(libs.androidx.profileinstaller)
|
||
debugImplementation(libs.compose.uiToolingPreview)
|
||
debugImplementation(libs.compose.uiTooling)
|
||
}
|