-
Notifications
You must be signed in to change notification settings - Fork 24
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
kotlin-compiler-embeddable dependencies should be compileOnly #407
Conversation
@@ -5,7 +5,7 @@ plugins { | |||
} | |||
|
|||
dependencies { | |||
api(libs.kotlin.compiler) |
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 don't think this will work well when generating the fat jars for cli / ide plugins for detekt and ktlint.
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.
Good point. I think that I can add separate Gradle configuration for shadowJar, but it will require adding transitive dependencies explicitly.
Example for detekt rules:
dependencies {
api(libs.detekt.core)
api(projects.rules.common)
shadowJarInclude(libs.kotlin.compiler)
// ...
}
What do you think?
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.
Compiling with shadowjar can be detected in this project by the existence of the "uberJar" property.
In the build.gradle.kts for the detekt / ktlint projects, we are already checking it, so I guess we could do it in the dependencies block as well:
if (project.hasProperty("uberJar")) {
api(...)
} else {
compileOnly(...)
}
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've added custom configuration that checks if uberJar
property is set and adds dependency as api
and compileOnly
otherwise.
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've fixed test dependencies, the check should pass now
…if uberJar property is set.
07bd672
to
2e98f76
Compare
After upgrading kotlin version to
2.1.0
kotlin gradle plugin raises warning ifkotlin-compiler-embeddable
is present in the classpath:According to the output of
buildEnvironment
Gradle task compose-rules add kotlin-compiler-embeddable to the classpath:after proposed changes: