-
-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor so detekt-gradle-plugin can be added as an included build #4094
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4094 +/- ##
============================================
- Coverage 83.45% 83.44% -0.01%
+ Complexity 3185 3177 -8
============================================
Files 463 465 +2
Lines 9095 9104 +9
Branches 1768 1775 +7
============================================
+ Hits 7590 7597 +7
- Misses 571 572 +1
- Partials 934 935 +1
Continue to review full report at Codecov.
|
Converting to draft as there's more to be done before this works as advertised. |
I'm not loving the fact that some of the build config had to move back to the root project's build file instead of a precompiled script plugin in |
LGTM? I think this is as good as it will get. I'm using these commits and a composite build myself for a couple of things and it's working really well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I'm a bit lost here. So I give my approve because it seems to work.
build.gradle.kts
Outdated
?: System.getenv("MAVEN_CENTRAL_USER") | ||
password = findProperty("sonatypePassword") | ||
?.toString() | ||
?: System.getenv("MAVEN_CENTRAL_PW") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are moving this here because we can't apply this in the gradle plugin when we use composite compilation, right?
Could we create another plugin in build-logic
so we don't need to have this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd moved it out of build-logic
as it wasn't shared build config like mostly everything else that remained, but there's a home for it in releasing
so I've moved it there instead. The config only needs to be applied to the root build file, and releasing
is only applied in the root file so this makes sense to me.
detekt(project(":detekt-cli")) | ||
detektPlugins(project(":custom-checks")) | ||
detektPlugins(project(":detekt-formatting")) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we can't keep this here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When detekt-gradle-plugin
is an included build, and it includes build-logic
, the project
dependencies can't be resolved. So they need to be moved out of build-logic
- and applying them to subprojects from the root build file is the best way to do that from a single location.
This removes the use of `subprojects` block as it can't be used effectively with composite builds.
Replace `include("detekt-gradle-plugin")` with `includeBuild("detekt-gradle-plugin")` in settings.gradle.kts
Is there a reason why you haven't replaced this? That would allow us to don't have to rely on the preivously released version of |
I'm not too worried about perf personally, but I think some others are or were. There's also the issue that running, for example, A separate PR could be opened to link up the lifecycle tasks (build, check, run) to the same tasks in the included build so it works as expected. |
This refactors the build logic so it's possible to include detekt-gradle-plugin as either a composite build or a standard project module. Just replace
include("detekt-gradle-plugin")
withincludeBuild("detekt-gradle-plugin")
in settings.gradle.kts to define the composite build.