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

Also test with Groovy 2.5 on classpath for Gradle 4, 5 & 6 #4520

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions rewrite-groovy2-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id("org.openrewrite.build.language-library")
}

dependencies {
testImplementation(project(":rewrite-groovy"))
testImplementation(project(":rewrite-test"))
testImplementation("org.junit.jupiter:junit-jupiter:latest.release")
testImplementation("org.codehaus.groovy:groovy:[2.5,2.6)")
testRuntimeOnly("org.codehaus.groovy:groovy-all:[2.5,2.6)")
testRuntimeOnly(project(":rewrite-java-8"))
}

tasks.named<JavaCompile>("compileTestJava") {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()

options.release.set(null as Int?) // remove `--release 8` set in `org.openrewrite.java-base`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*.java]
indent_size = 4
ij_continuation_indent_size = 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2024 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openrewrite.groovy;

import org.junit.jupiter.api.Test;
import org.openrewrite.test.RewriteTest;

import static org.openrewrite.groovy.Assertions.groovy;

class Groovy2Test implements RewriteTest {

@Test
void useInt() {
rewriteRun(groovy("def variable = \"12345\""));
}

@Test
void useJavaUtilDate() {
rewriteRun(groovy("def variable = new java.util.Date()"));
}

@Test
void useStringMultiplicationInParentheses() {
rewriteRun(groovy("def variable = (\"#\" * 6)"));
}
}
3 changes: 0 additions & 3 deletions rewrite-java-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ dependencies {
testImplementation("io.github.classgraph:classgraph:latest.release")
testImplementation("org.junit-pioneer:junit-pioneer:2.0.0")
testRuntimeOnly(project(":rewrite-java-17"))
testRuntimeOnly("junit:junit:4.13.2") {
because("Used for RemoveUnneededAssertionTest")
}
testRuntimeOnly("org.apache.hbase:hbase-shaded-client:2.4.11")
testRuntimeOnly("com.google.guava:guava:latest.release")
testRuntimeOnly("org.mapstruct:mapstruct:latest.release")
Expand Down
63 changes: 33 additions & 30 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,27 @@ pluginManagement {
// ---------------------------------------------------------------

val allProjects = listOf(
"rewrite-benchmarks",
"rewrite-bom",
"rewrite-core",
"rewrite-gradle",
"rewrite-groovy",
"rewrite-hcl",
"rewrite-java",
"rewrite-java-tck",
"rewrite-java-test",
"rewrite-java-17", // remove this when rewrite recipe gradle plugin moves to 21
"rewrite-java-21",
"rewrite-json",
"rewrite-maven",
"rewrite-properties",
"rewrite-protobuf",
"rewrite-test",
"rewrite-xml",
"rewrite-yaml",
"rewrite-benchmarks",
"rewrite-bom",
"rewrite-core",
"rewrite-gradle",
"rewrite-groovy",
"rewrite-groovy2-test",
"rewrite-hcl",
"rewrite-java",
"rewrite-java-tck",
"rewrite-java-test",
"rewrite-java-8",
"rewrite-java-11",
"rewrite-java-17", // remove this when rewrite recipe gradle plugin moves to 21
"rewrite-java-21",
"rewrite-json",
"rewrite-maven",
"rewrite-properties",
"rewrite-protobuf",
"rewrite-test",
"rewrite-xml",
"rewrite-yaml",
)

val includedProjects = file("IDE.properties").let {
Expand All @@ -42,7 +45,7 @@ val includedProjects = file("IDE.properties").let {
}
}.toSet()

if(!file("IDE.properties").exists() || includedProjects.contains("tools")) {
if (!file("IDE.properties").exists() || includedProjects.contains("tools")) {
includeBuild("tools")
}

Expand All @@ -52,23 +55,23 @@ gradle.allprojects {
configurations.all {
resolutionStrategy.dependencySubstitution {
allProjects
.minus(includedProjects)
.minus(arrayOf("rewrite-bom"))
.forEach {
substitute(project(":$it"))
.using(module("org.openrewrite:$it:latest.integration"))
}
.minus(includedProjects)
.minus(arrayOf("rewrite-bom"))
.forEach {
substitute(project(":$it"))
.using(module("org.openrewrite:$it:latest.integration"))
}
}
}
}

if (System.getProperty("idea.active") == null &&
System.getProperty("idea.sync.active") == null) {
System.getProperty("idea.sync.active") == null) {
include(
"rewrite-java-8",
"rewrite-java-11",
"rewrite-java-17",
"rewrite-java-21"
"rewrite-java-8",
"rewrite-java-11",
"rewrite-java-17",
"rewrite-java-21"
)
}

Expand Down