Skip to content
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

Use provided configuration for optional language dependencies #411

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
23 changes: 14 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
plugins {
id("org.openrewrite.build.recipe-library") version "latest.release"
id("org.openrewrite.build.moderne-source-available-license") version "latest.release"
id("com.netflix.nebula.provided-base") version "10.0.1"
}
apply(plugin = "com.netflix.nebula.provided-base")
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't have both a plugin id block above and also an apply call. This apply mechanism is an old way of applying plugins.

Copy link
Contributor Author

@jevanlingen jevanlingen Dec 24, 2024

Choose a reason for hiding this comment

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

Thx for the info! I am still trying to make it work; I don't have much experience with Gradle, so this was my first attempt. At the moment, the provided functions do not work at all 😞. I think it has something to do with Kotlin DSL not supported out-of-the-box.

Copy link
Contributor Author

@jevanlingen jevanlingen Dec 24, 2024

Choose a reason for hiding this comment

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

Ah, now I get it! The plugin does not do anything anymore, it's only an empty plugin today:

LOGGER.warn("nebula.provided-base plugin does nothing. Use the 'compileOnly' configuration")

See alse: history.

What do you propose @jkschneider? Start going for the compileOnly scope? What do you think @timtebeek ? Maybe you have something to say as well @sambsnyd?


FYI: there is another archived project with the same intention.


group = "org.openrewrite.recipe"
description = "The first Static Analysis and REMEDIATION tool"
Expand All @@ -17,22 +19,19 @@ dependencies {
implementation("org.openrewrite.meta:rewrite-analysis:${rewriteVersion}")
implementation("org.apache.commons:commons-text:latest.release")

// Limit transitive dependencies for downstream projects like rewrite-spring
compileOnly("org.openrewrite:rewrite-groovy")
compileOnly("org.openrewrite:rewrite-kotlin:${rewriteVersion}")
compileOnly("org.openrewrite:rewrite-csharp:${rewriteVersion}")

annotationProcessor("org.openrewrite:rewrite-templating:${rewriteVersion}")
implementation("org.openrewrite:rewrite-templating:${rewriteVersion}")
compileOnly("com.google.errorprone:error_prone_core:2.+:with-dependencies") {
compileOnly("com.google.errorprone:error_prone_core:2.+") {
exclude("com.google.auto.service", "auto-service-annotations")
}

provided("org.openrewrite:rewrite-groovy")
provided("org.openrewrite:rewrite-kotlin:${rewriteVersion}")
provided("org.openrewrite:rewrite-csharp:${rewriteVersion}")

testImplementation("org.jetbrains:annotations:24.+")
testImplementation("org.openrewrite:rewrite-groovy")
testImplementation("org.openrewrite:rewrite-kotlin:${rewriteVersion}")
testImplementation("org.openrewrite:rewrite-csharp:${rewriteVersion}")
testImplementation("org.openrewrite:rewrite-test")
testImplementation("org.jetbrains:annotations:24.+")
testImplementation("org.junit-pioneer:junit-pioneer:2.+")
testImplementation("junit:junit:4.13.2")

Expand All @@ -41,3 +40,9 @@ dependencies {
testRuntimeOnly("org.openrewrite:rewrite-java-17")
testRuntimeOnly("com.google.code.findbugs:jsr305:latest.release")
}

tasks.register("listConfigurations") {
doLast {
configurations.forEach { println(it.name) }
}
}
Loading