Skip to content
Merged
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
9 changes: 0 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ updates:
open-pull-requests-limit: 50
schedule:
interval: monthly
- package-ecosystem: gradle
directory: /test-project-kotlin-pre-1-7
open-pull-requests-limit: 50
schedule:
interval: monthly
ignore:
- dependency-name: "org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin"
# This pre-Kotlin-1.7 project must not have the Kotlin major version updated:
update-types: [ "version-update:semver-major" ]
- package-ecosystem: gradle
directory: /test-project-mixed
open-pull-requests-limit: 50
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ The plugin currently supports:

The plugin supports the following test engines:

* JUnit 5
* JUnit 4
* JUnit 5 (for JUnit versions before 5.8.0 use plugin version v1.8.15, higher versions of JUnit 5 can use the latest version of the plugin)
* JUnit 4 (Use plugin version v1.8.15)
* TestNG
* ![Since 1.7.0](https://img.shields.io/badge/since-1.7.0-brightgreen) Spock 2 with Groovy 3
* ![Since 1.7.0](https://img.shields.io/badge/since-1.7.0-brightgreen) AssertJ
Expand Down Expand Up @@ -102,10 +102,10 @@ subprojects {
}

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.10.2"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.14.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.14.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.14.0'
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.14.0"
}
}
```
Expand Down Expand Up @@ -144,10 +144,10 @@ subprojects {
}

dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.14.0")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.14.0")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.14.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.14.0")
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ configurations {
compile.extendsFrom plugin
}

def jUnitVersion = '5.10.2'
def jUnitVersion = '5.14.0'

dependencies {
implementation gradleApi()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ModulePluginSmokeTest {
@SuppressWarnings("unused")
private enum GradleVersion {
v8_11, v8_14_3,
v9_0, v9_1_0
v9_0, v9_2_0
;

@Override
Expand All @@ -58,14 +58,11 @@ void before() throws IOException {
void smokeTest(
@CartesianTest.Values(strings = {
"test-project",
"test-project-kotlin-pre-1-7",
"test-project-kotlin",
"test-project-groovy"
}) String projectName,
@CartesianTest.Enum GradleVersion gradleVersion) {
LOGGER.lifecycle("Executing smokeTest of {} with Gradle {}", projectName, gradleVersion);
assumeTrue(jdkSupported(gradleVersion));
assumeTrue(checkKotlinCombination(projectName, gradleVersion));
var result = GradleRunner.create()
.withProjectDir(new File(projectName + "/"))
.withPluginClasspath(pluginClasspath)
Expand All @@ -88,14 +85,11 @@ void smokeTest(
void smokeTestRun(
@CartesianTest.Values(strings = {
"test-project",
"test-project-kotlin-pre-1-7",
"test-project-kotlin",
"test-project-groovy"
}) String projectName,
@CartesianTest.Enum GradleVersion gradleVersion) {
LOGGER.lifecycle("Executing smokeTestRun of {} with Gradle {}", projectName, gradleVersion);
assumeTrue(jdkSupported(gradleVersion));
assumeTrue(checkKotlinCombination(projectName, gradleVersion));
var writer = new StringWriter(256);
var result = GradleRunner.create()
.withProjectDir(new File(projectName + "/"))
Expand All @@ -117,18 +111,14 @@ void smokeTestRun(
@CartesianTest(name = "smokeTestJunit5({arguments})")
void smokeTestJunit5(
@CartesianTest.Values(strings = {
"5.4.2/1.4.2",
"5.5.2/1.5.2",
"5.7.1/1.7.1",
"5.8.0/1.8.0",
"5.10.2/1.10.2"
"5.10.2/1.10.2",
"5.14.0/1.14.0"
}) String junitVersionPair,
@CartesianTest.Enum GradleVersion gradleVersion) {
LOGGER.lifecycle("Executing smokeTestJunit5 with junitVersionPair {} and Gradle {}", junitVersionPair, gradleVersion);
assumeTrue(jdkSupported(gradleVersion));
var junitVersionParts = junitVersionPair.split("/");
final String junitVersion = junitVersionParts[0];
assumeTrue(checkJUnitCombination(junitVersion, gradleVersion));
var junitVersionProperty = String.format("-PjUnitVersion=%s", junitVersion);
var junitPlatformVersionProperty = String.format("-PjUnitPlatformVersion=%s", junitVersionParts[1]);
var result = GradleRunner.create()
Expand All @@ -148,7 +138,6 @@ void smokeTestJunit5(
@CartesianTest(name = "smokeTestMixed({arguments})")
void smokeTestMixed(@CartesianTest.Enum GradleVersion gradleVersion) {
LOGGER.lifecycle("Executing smokeTestMixed with Gradle {}", gradleVersion);
assumeTrue(jdkSupported(gradleVersion));
var result = GradleRunner.create()
.withProjectDir(new File("test-project-mixed"))
.withPluginClasspath(pluginClasspath)
Expand Down Expand Up @@ -200,14 +189,11 @@ private static void assertExpectedClassFileFormats(
void smokeTestDist(
@CartesianTest.Values(strings = {
"test-project",
"test-project-kotlin-pre-1-7",
"test-project-kotlin",
"test-project-groovy"
}) String projectName,
@CartesianTest.Enum GradleVersion gradleVersion) {
LOGGER.lifecycle("Executing smokeTestDist of {} with Gradle {}", projectName, gradleVersion);
assumeTrue(jdkSupported(gradleVersion));
assumeTrue(checkKotlinCombination(projectName, gradleVersion));
var result = GradleRunner.create()
.withProjectDir(new File(projectName + "/"))
.withPluginClasspath(pluginClasspath)
Expand Down Expand Up @@ -247,14 +233,11 @@ void smokeTestDist(
void smokeTestRunDemo(
@CartesianTest.Values(strings = {
"test-project",
"test-project-kotlin-pre-1-7",
"test-project-kotlin",
"test-project-groovy"
}) String projectName,
@CartesianTest.Enum GradleVersion gradleVersion) {
LOGGER.lifecycle("Executing smokeTestRunDemo of {} with Gradle {}", projectName, gradleVersion);
assumeTrue(jdkSupported(gradleVersion));
assumeTrue(checkKotlinCombination(projectName, gradleVersion));
var result = GradleRunner.create()
.withProjectDir(new File(projectName + "/"))
.withPluginClasspath(pluginClasspath)
Expand All @@ -272,14 +255,11 @@ void smokeTestRunDemo(
void smokeTestRunStartScripts(
@CartesianTest.Values(strings = {
"test-project",
"test-project-kotlin-pre-1-7",
"test-project-kotlin",
"test-project-groovy"
}) String projectName,
@CartesianTest.Enum GradleVersion gradleVersion) {
LOGGER.lifecycle("Executing smokeTestRunScripts of {} with Gradle {}", projectName, gradleVersion);
assumeTrue(jdkSupported(gradleVersion));
assumeTrue(checkKotlinCombination(projectName, gradleVersion));
var result = GradleRunner.create()
.withProjectDir(new File(projectName + "/"))
.withPluginClasspath(pluginClasspath)
Expand Down Expand Up @@ -313,54 +293,4 @@ private static void assertOutputDoesNotContain(BuildResult result, String text)
final String output = result.getOutput();
assertFalse(output.contains(text), "Output should not contain '" + text + "', but was: " + output);
}

private static boolean checkKotlinCombination(String projectName, GradleVersion gradleVersion) {
final boolean kotlin_NotSupported = projectName.startsWith("test-project-kotlin") && gradleVersion.toString().compareTo("6.4") < 0;
final boolean kotlinPost1_7_NotSupported = projectName.equals("test-project-kotlin") && gradleVersion.toString().compareTo("6.6") < 0;
final boolean kotlinPre1_7_NotSupported = projectName.equals("test-project-kotlin-pre-1-7") && gradleVersion.toString().compareTo("8.0") >= 0;
if (kotlin_NotSupported || kotlinPost1_7_NotSupported || kotlinPre1_7_NotSupported) {
LOGGER.lifecycle("Unsupported combination: {} / Gradle {}. Test skipped", projectName, gradleVersion);
return false;
}
return true;
}

private boolean checkJUnitCombination(final String junitVersion, final GradleVersion gradleVersion) {
final boolean gradleEighthPlus = gradleVersion.ordinal() >= GradleVersion.v8_11.ordinal();
final Matcher m = SEMANTIC_VERSION.matcher(junitVersion);
assumeTrue(m.matches(), "JUnit version not semantic: " + junitVersion);
final boolean junitOlderThan5_8_0 = Integer.parseInt(m.group("major")) < 5 ||
(Integer.parseInt(m.group("major")) == 5 && Integer.parseInt(m.group("minor")) < 8);

if (gradleEighthPlus && junitOlderThan5_8_0) {
LOGGER.lifecycle("Unsupported JUnit and Gradle combination. Gradle: {}, JUnit: {}: Test skipped", gradleVersion, junitVersion);
return false;
}
return true;
}

private static int javaMajorVersion() {
final String version = System.getProperty("java.version");

// Java 9+ (9.0.1, 11.0.2, 17.0.2 format)
int dotIndex = version.indexOf(".");
if (dotIndex == -1) {
// Handle cases like "17" without dot
return Integer.parseInt(version);
}

return Integer.parseInt(version.substring(0, dotIndex));
}

private boolean jdkSupported(final GradleVersion gradleVersion) {
final int javaMajor = javaMajorVersion();

// All supported Gradle versions (8.11+) require Java 17+
if (javaMajor < 17) {
LOGGER.lifecycle("Gradle {} requires Java 17+, but running Java {}: Test skipped", gradleVersion, javaMajor);
return false;
}

return true;
}
}
4 changes: 2 additions & 2 deletions test-project-groovy/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
jUnitVersion = 5.10.2
jUnitPlatformVersion = 1.10.2
jUnitVersion = 5.14.0
jUnitPlatformVersion = 1.14.0
40 changes: 0 additions & 40 deletions test-project-kotlin-pre-1-7/README.md

This file was deleted.

64 changes: 0 additions & 64 deletions test-project-kotlin-pre-1-7/build.gradle.kts

This file was deleted.

2 changes: 0 additions & 2 deletions test-project-kotlin-pre-1-7/gradle.properties

This file was deleted.

21 changes: 0 additions & 21 deletions test-project-kotlin-pre-1-7/greeter.api/build.gradle.kts

This file was deleted.

This file was deleted.

This file was deleted.

Loading