Skip to content

Support installing Whetstone in modules using the new Android KMP plugin#114

Closed
kingsleyadio wants to merge 149 commits intodeliveryhero:mainfrom
kingsleyadio:kingsley/support-new-android-kmp
Closed

Support installing Whetstone in modules using the new Android KMP plugin#114
kingsleyadio wants to merge 149 commits intodeliveryhero:mainfrom
kingsleyadio:kingsley/support-new-android-kmp

Conversation

@kingsleyadio
Copy link
Copy Markdown
Contributor

Support android library modules that use the new KMP plugin

kozaxinan added 21 commits July 23, 2025 23:31
        delete(rootProject.layout.buildDirectory)
    } back
Adds the `ORG_GRADLE_PROJECT_signingInMemoryKeyId` environment variable to the `publish-release` workflow. This provides the necessary key ID for the Gradle publishing plugin to sign the release artifacts.
The publish command is run a second time in the release workflow, without the preceding `clean` tasks. This is intended to make the publishing process more robust against potential intermittent failures.
Moves the `includeBuild` declarations for `build-logic` and `whetstone-gradle-plugin` inside the `pluginManagement` block in `settings.gradle.kts`.

This aligns the build configuration with modern Gradle practices for declaring plugin sources.
The `clean` task in the `whetstone-gradle-plugin` module is now configured to also delete the root project's build directory. This ensures a more thorough cleanup when the task is executed.
This commit introduces several improvements to the build configuration for the `whetstone-gradle-plugin` and the associated CI workflow.

Key changes include:
- Replaced the `kotlin-kapt` plugin with `kotlin-jvm` in the Gradle plugin module.
- Updated the build script to use lazy configuration for the `generateBuildConfig` task and its output. The `compileKotlin` task dependency and the addition of the generated source directory are now configured lazily using `tasks.named` and `flatMap`.
- Added the `GROUP` property to `whetstone-gradle-plugin/gradle.properties` to define the Maven group ID.
- Consolidated the Gradle commands in the `publish-release.yml` workflow.
- Reordered the `includeBuild` statements in `settings.gradle.kts`.
The `whetstone-gradle-plugin` build script is updated to load properties from the root `gradle.properties` file.

A new `loadParentProperties` function reads the parent `gradle.properties` and sets its key-value pairs as extra properties on the plugin project. This allows the plugin module to access configurations defined at the root level.
Bumps the project version to 1.1.3.

Also, fixes an issue in the `publish-release` workflow where the `whetstone-gradle-plugin/gradle.properties` file was being overwritten. The workflow now appends properties from the root `gradle.properties` file, preserving the plugin's specific configuration.
* Refactor plugin to support product flavors

The Whetstone Gradle plugin has been updated to use the modern Android Gradle Plugin (AGP) Variant API for configuring consumer Proguard files in library modules.

The implementation was migrated from the older `LibraryExtension` and `buildTypes.configureEach` to `LibraryAndroidComponentsExtension` and the `onVariants` callback. This ensures that generated Proguard files are correctly added to all build variants, including combinations of build types and product flavors. The previous approach only supported build types.

To validate this change, the `sample-library` has been updated to include product flavors.

* Refactor Proguard configuration and update CI

This commit improves how the Whetstone Gradle plugin handles consumer Proguard files, particularly for Android application modules.

The plugin is updated to explicitly look for the `export<Variant>ConsumerProguardFiles` task by name. By wrapping this lookup in a `try-catch` block, the plugin now gracefully handles application modules where this task does not exist, preventing potential build failures.

The CI workflow is also updated:
- The test command is changed to `./gradlew build` for more comprehensive checks.
- The sample app is now built using `./gradlew sample:assembleRelease` to ensure the Proguard rules are correctly applied and tested in a release configuration.

* Refactor sample module build scripts

Removes the `matchingFallbacks` configuration for the "hilt" flavor from the `sample` app's build types.

Additionally, the flavor dimension variable is renamed to `dimensionName` in the `sample` and `sample-library` build scripts for improved clarity.
Updates the version name from `1.1.4-SNAPSHOT` to `1.1.4` and enables automatic publishing to Maven Central.
@kozaxinan
Copy link
Copy Markdown
Collaborator

Could you rebase to current state, lets merge this.

Updates the following dependencies:
- Anvil to 2.6.1
- Kotlin to 2.2.0
- Binary Compatibility Validator to 0.18.1
* Enable automatic publishing to Maven Central

* Update publish-release.yml

* Update gradle.properties
@kingsleyadio kingsleyadio force-pushed the kingsley/support-new-android-kmp branch from efea696 to da84f6a Compare October 18, 2025 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.