Skip to content

build-logic refactoring.#301

Merged
ychescale9 merged 1 commit intomainfrom
yc/build-logic-refactoring
May 2, 2025
Merged

build-logic refactoring.#301
ychescale9 merged 1 commit intomainfrom
yc/build-logic-refactoring

Conversation

@ychescale9
Copy link
Member

  • multi-project build
  • move convention plugins to kstreamlined-gradle-plugin project
  • add new CI job for running build-logic checks

- multi-project build
- move convention plugins to `:kstreamlined-gradle-plugin` project
- add new CI job for running `build-logic` checks
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ychescale9, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on refactoring the build-logic module to improve its structure and maintainability. It introduces a multi-project build setup, moves convention plugins to a dedicated kstreamlined-gradle-plugin project, and adds a new CI job to ensure the build-logic module remains consistent and correct. The changes primarily involve moving existing convention plugins and updating package names to reflect the new module structure.

Highlights

  • Multi-project build: The build logic is now structured as a multi-project build, which should improve modularity and separation of concerns.
  • Convention plugins: Convention plugins have been moved to the kstreamlined-gradle-plugin project, promoting better organization and reusability.
  • CI Job: A new CI job has been added to run checks specifically for the build-logic module, ensuring its quality and consistency.
  • Package name changes: Package names have been updated to reflect the new module structure, specifically moving convention plugins from io.github.reactivecircus.kstreamlined.buildlogic.convention to io.github.reactivecircus.kstreamlined.gradle.

Changelog

Click here to see the changelog
  • .github/actions/cache-build-logic/action.yml
    • Updated the cache key to include all subdirectories under build-logic/src/ to ensure the cache is invalidated when any source file changes.
  • android/app/build.gradle.kts
    • Updated import statements for FlavorDimensions and ProductFlavors to reflect the new package location in io.github.reactivecircus.kstreamlined.gradle.buildlogic.
  • android/benchmark/build.gradle.kts
    • Updated import statements for FlavorDimensions and ProductFlavors to reflect the new package location in io.github.reactivecircus.kstreamlined.gradle.buildlogic.
  • build-logic/.gitignore
    • Removed build from .gitignore.
  • build-logic/kstreamlined-gradle-plugin/build.gradle.kts
    • Updated the detekt config file path to be absolute, using $rootDir/../detekt.yml.
    • Updated the implementation class for each gradle plugin registration to use the new package io.github.reactivecircus.kstreamlined.gradle.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/AndroidApplicationConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
    • Updated import statements to reflect the new package locations for configuration functions.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/AndroidLibraryConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
    • Updated import statements to reflect the new package locations for configuration functions.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/AndroidScreenshotTestConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/AndroidTestConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
    • Updated import statements to reflect the new package locations for configuration functions.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/ComposeConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/KMPAndroidAndIosConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
    • Updated import statements to reflect the new package locations for configuration functions.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/KMPCommonConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
    • Updated import statements to reflect the new package locations for configuration functions.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/KMPIosOnlyConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
    • Updated import statements to reflect the new package locations for configuration functions.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/KMPTestConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
    • Updated import statements to reflect the new package locations for configuration functions.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/KotlinJvmConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
    • Updated import statements to reflect the new package locations for configuration functions.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/KspConventionPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/RootPlugin.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/buildlogic/AndroidSdk.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.buildlogic.
    • Made the AndroidSdk object internal.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/buildlogic/androidBuildLogic.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.buildlogic.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/buildlogic/detektBuildLogic.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.buildlogic.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/buildlogic/kmpBuildLogic.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.buildlogic.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/buildlogic/kotlinBuildLogic.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.buildlogic.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/buildlogic/languageSettings.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.buildlogic.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/buildlogic/productFlavors.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.buildlogic.
  • build-logic/kstreamlined-gradle-plugin/src/main/kotlin/io/github/reactivecircus/kstreamlined/gradle/buildlogic/unitTestBuildLogic.kt
    • Updated the package declaration to io.github.reactivecircus.kstreamlined.gradle.buildlogic.
  • build-logic/settings.gradle.kts
    • Added rootProject.name = "build-logic" to explicitly set the root project name.
    • Included the kstreamlined-gradle-plugin project in the build.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A plugin's new home,
Gradle's logic takes new form,
Build's future unfolds.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request focuses on refactoring the build-logic module to improve its structure and maintainability. This includes moving convention plugins to a dedicated project and adding a CI job for build-logic checks. The changes seem well-organized and contribute to a more modular codebase.

Summary of Findings

  • Inconsistent package names: The package names in the convention plugins have been changed from io.github.reactivecircus.kstreamlined.buildlogic.convention to io.github.reactivecircus.kstreamlined.gradle, but the build logic functions they call still reside in the io.github.reactivecircus.kstreamlined.gradle.buildlogic package. This inconsistency could lead to confusion and should be addressed.
  • Redundant build directory exclusion: The .gitignore file in the build-logic directory previously excluded the build directory, but this exclusion is no longer present. It's important to ensure that build artifacts are not accidentally committed to the repository.
  • Hardcoded path in detekt configuration: The path to detekt.yml is hardcoded using $rootDir. While this works, it might be better to use a more robust and flexible approach for resolving the file path.

Merge Readiness

The pull request introduces significant improvements to the build logic structure. However, the package name inconsistency and the .gitignore change should be addressed before merging. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging.

detekt {
source.from(files("src/"))
config.from(files("../detekt.yml"))
config.from(files("$rootDir/../detekt.yml"))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using $rootDir works, but is there a more robust way to define the path to detekt.yml? Perhaps using a file() relative to the current module or a Gradle property?

config.from(files("${projectDir}/../detekt.yml"))

@ychescale9 ychescale9 merged commit eaf0a54 into main May 2, 2025
7 checks passed
@ychescale9 ychescale9 deleted the yc/build-logic-refactoring branch May 2, 2025 17:58
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.

1 participant