Skip to content

refactor(convention): introduce internal android macrobenchmark convention plugin#509

Merged
marlonlom merged 2 commits into
mainfrom
refactor/macrobenchmark-convention-plugin
Jun 21, 2026
Merged

refactor(convention): introduce internal android macrobenchmark convention plugin#509
marlonlom merged 2 commits into
mainfrom
refactor/macrobenchmark-convention-plugin

Conversation

@marlonlom

Copy link
Copy Markdown
Owner

Summary

This PR introduces the AndroidMacroBenchmarkPlugin to consolidate and centralize shared build configurations for our macrobenchmark modules. By abstracting this logic into build-logic, we remove significant boilerplate duplication from the mobile and Wear OS benchmark modules.

Changes Made

  • Build Logic: - Created AndroidMacroBenchmarkPlugin.kt to handle com.android.test configuration, SDK versions via Config, custom benchmark build types, and standard test/UI-automator dependencies.
    • Registered the plugin under the ID mocca.android.macrobenchmark in build-logic/convention/build.gradle.kts.
  • Benchmark Modules:
    • Migrated benchmarks/macro/mobile/build.gradle.kts to use the new plugin ID and stripped out the redundant setup.
    • Migrated benchmarks/macro/wearos/build.gradle.kts similarly, achieving identical build behavior with significantly less code.

Verification Done

  • Run ./gradlew :benchmarks:macro:mobile:assembleBenchmark to ensure the mobile benchmark target compiles correctly.
  • Run ./gradlew :benchmarks:macro:wearos:assembleBenchmark to verify the Wear OS benchmark target setup.
  • Executed spotless checks to ensure compliance with code style rules.

…ntion plugin

Create AndroidMacroBenchmarkPlugin to consolidate and centralize
shared configurations for macrobenchmark modules.

- Extract common compile SDK, target SDK, and min SDK configurations.
- Abstract the custom 'benchmark' build type setup.
- Centralize required test and UI automator dependencies.
- Apply the new mocca.android.macrobenchmark plugin to the mobile and wearos modules to drastically reduce boilerplate.
@marlonlom marlonlom self-assigned this Jun 21, 2026
@marlonlom marlonlom added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 21, 2026
@marlonlom marlonlom added dependencies Pull requests that update a dependency file kotlin Pull requests that update kotlin code labels Jun 21, 2026
…benchmarks

Introduces a specific macrobenchmark AndroidConfig configuration block within build-logic to decouple macrobenchmark SDK targets from the main mobile configuration. This sets the minimum SDK version for macrobenchmarks to API 24, as required by the library, and updates the AndroidMacroBenchmarkPlugin to utilize these new parameters.

- Add macrobenchmark config with minSdkVersion = 24
- Update AndroidMacroBenchmarkPlugin to reference Config.macrobenchmark fields instead of Config.mobile
@marlonlom marlonlom merged commit d6f0c14 into main Jun 21, 2026
2 checks passed
@marlonlom marlonlom deleted the refactor/macrobenchmark-convention-plugin branch June 21, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation enhancement New feature or request kotlin Pull requests that update kotlin code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor]: Centralize macrobenchmark module configurations via convention plugin

1 participant