Files
android-client/docs/decisions/0002-convention-plugins-and-version-catalog.md
2026-09-03 19:03:35 +08:00

24 lines
975 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ADR 0002:约定插件 + 版本目录作为唯一配置事实源
- **状态**:已接受
- **日期**:2026-09-03
## 背景
多模块项目若在每个模块手写 `android {}` 模板,会出现配置漂移、版本不一致、样板重复。
## 决策
- **约定插件**(`build-logic/`,included build):提供 `mcl.*` 插件,集中编码 compileSdk/minSdk、Java/Kotlin target、Compose、Hilt、Room、Lint、Spotless 等配置。模块只声明插件 + namespace。
- **版本目录**(`gradle/libs.versions.toml`):所有依赖版本唯一事实源,主构建与 build-logic 共用。
## 理由
- 把"严谨性"编码进确定性规则(harness-engineering 的"严谨性转移"原则),而非依赖人工记忆。
- 一个版本改一处,全项目生效。
## 后果
- 新增/调整模块配置需改 build-logic;新增依赖需改版本目录。
- 好处:`verifyArchitecture` 等约束可挂在约定插件体系里统一执行。