android-gradle-build-logic

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Android Gradle Build Logic

Android Gradle 构建逻辑

When To Use

适用场景

  • Use this skill when the request is about: android gradle plugin setup, fix build logic for android modules, version catalog for android repo.
  • Primary outcome: Shape Android build logic with Gradle, version catalogs, plugins, convention patterns, and toolchain compatibility.
  • Handoff skills when the scope expands:
  • android-modernization-upgrade
  • android-ci-cd-release-playstore
  • 当请求涉及以下内容时使用此技能:Android Gradle插件配置、Android模块构建逻辑修复、Android代码库的版本目录配置。
  • 主要产出:借助Gradle、版本目录、插件、约定模式和工具链兼容性来搭建Android构建逻辑。
  • 当范围扩大时转交至以下技能:
  • android-modernization-upgrade
  • android-ci-cd-release-playstore

Workflow

工作流程

  1. Map the request to the current Android stack, module boundaries, and minimum supported API level.
  2. Inspect the existing implementation for implicit assumptions, duplicate helpers, and outdated patterns.
  3. Apply the smallest change that improves correctness, readability, and long-term maintainability.
  4. Validate the result against the relevant showcase app path and repo benchmarks.
  5. Hand off adjacent work to the next specialized skill only after the core foundation is stable.
  1. 将请求与当前Android技术栈、模块边界和最低支持API级别进行匹配。
  2. 检查现有实现中是否存在隐式假设、重复辅助工具和过时模式。
  3. 应用最小程度的变更来提升正确性、可读性和长期可维护性。
  4. 对照相关演示应用路径和代码库基准验证结果。
  5. 仅在核心基础稳定后,将相邻工作转交至下一个专用技能。

Guardrails

防护规则

  • Prefer official Android and Kotlin guidance over custom local conventions when they conflict.
  • Keep public APIs boring and explicit; avoid clever abstractions that hide Android lifecycle costs.
  • Do not mix architectural cleanup with product behavior changes unless the request explicitly needs both.
  • Document any compatibility constraints that will affect old modules or generated code.
  • 当官方Android和Kotlin指南与本地自定义约定冲突时,优先遵循官方指南。
  • 保持公共API简单明确;避免使用会隐藏Android生命周期开销的精巧抽象。
  • 不要将架构清理与产品行为变更混合处理,除非请求明确需要同时处理两者。
  • 记录所有会影响旧模块或生成代码的兼容性约束。

Anti-Patterns

反模式

  • Sprinkling helpers across modules without a clear ownership boundary.
  • Introducing framework-specific code into pure domain or data layers.
  • Refactoring every adjacent file when only one contract needed to change.
  • Leaving migration notes implied instead of writing them down.
  • 在没有明确所有权边界的情况下,在各个模块中随意添加辅助工具。
  • 将特定于框架的代码引入纯领域层或数据层。
  • 仅需修改一个约定时就重构所有相邻文件。
  • 仅隐含迁移说明而不进行书面记录。

Examples

示例

Happy path

正常场景

  • Scenario: Run the Compose showcase build from a clean checkout with version catalogs.
  • Command:
    cd examples/orbittasks-compose && ./gradlew :app:assembleDebug
  • 场景:使用版本目录从干净的检出代码运行Compose演示构建。
  • 命令:
    cd examples/orbittasks-compose && ./gradlew :app:assembleDebug

Edge case

边缘场景

  • Scenario: Validate shared repositories and plugin management in the XML fixture.
  • Command:
    cd examples/orbittasks-xml && ./gradlew :app:assembleDebug
  • 场景:验证XML测试夹具中的共享代码库和插件管理。
  • 命令:
    cd examples/orbittasks-xml && ./gradlew :app:assembleDebug

Failure recovery

故障恢复

  • Scenario: Benchmark build-logic trigger precision against modernization and CI skills.
  • Command:
    python3 scripts/eval_triggers.py --skill android-gradle-build-logic
  • 场景:对照现代化升级和CI技能基准测试构建逻辑触发精度。
  • 命令:
    python3 scripts/eval_triggers.py --skill android-gradle-build-logic

Done Checklist

完成检查清单

  • The implementation path is explicit, minimal, and tied to the right Android surface.
  • Relevant example commands and benchmark prompts have been exercised or updated.
  • Handoffs to adjacent skills are documented when the request crosses boundaries.
  • Official references cover the chosen pattern and the main migration or troubleshooting path.
  • 实现路径明确、最小化,且与对应的Android场景绑定。
  • 相关示例命令和基准提示已执行或更新。
  • 当请求跨越边界时,已记录向相邻技能的转交说明。
  • 官方参考资料涵盖了所选模式以及主要的迁移或故障排查路径。

Official References

官方参考