Skip to content
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
10 changes: 7 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

jobs:
tests:
name: "E2E tests"
runs-on: ubuntu-latest
steps:
- name: Checkout project with submodules
Expand All @@ -20,7 +21,7 @@ jobs:
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 19
distribution: 'zulu'
- uses: gradle/gradle-build-action@v2
- name: Run sanity check
Expand All @@ -31,5 +32,8 @@ jobs:
ORG_GRADLE_PROJECT_sonatypePasswordE2E: ${{ secrets.SONATYPE_PASSWORD_E2E }}
ORG_GRADLE_PROJECT_signingKeyE2E: ${{ secrets.GPG_SIGNING_KEY_E2E }}
ORG_GRADLE_PROJECT_signingPasswordE2E: ${{ secrets.GPG_SIGNING_KEY_PASSPHRASE_E2E }}
run: |
./gradlew --stacktrace -Pe2eVerboseOutput e2eTest
run: >
./gradlew
--stacktrace
-Pe2eVerboseOutput
e2eTest
2 changes: 1 addition & 1 deletion .github/workflows/gradle-latest-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
java-version: 19
distribution: 'zulu'
- uses: gradle/gradle-build-action@v2

Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/java-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:
openjdk:
strategy:
matrix:
jdk: [11, 17]
name: "OpenJDK ${{ matrix.jdk }}"
jdk: [11, 17, 19]
testJdk: [auto, 8]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wonder if we shouldn't have "fail-fast" disabled for that workflow?

name: "OpenJDK ${{ matrix.jdk }} (with testJDK ${{ matrix.testJdk }})"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -38,4 +39,5 @@ jobs:
- name: Test cross Java versions compatibility
run: |
./gradlew --version
./gradlew --stacktrace build compatTestJava${{ matrix.jdk }}
./gradlew -q javaToolchains
./gradlew --stacktrace -PnexusPublishPlugin.test.java=${{ matrix.testJdk }} build compatTestJava${{ matrix.jdk }}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To avoid "javaauto" in stutter, we could add testJdk matrix elements manually, adjusting "auto" version to a given JDK version.
Also a shell command could replace "auto" with a proper version.

However, I don't know which of this 3 options is best :-/

4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
java-version: 19
distribution: 'zulu'
- uses: gradle/gradle-build-action@v2
with:
arguments: --stacktrace build compatTestJava11
arguments: --stacktrace build compatTestJava17
44 changes: 42 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ dependencies {
testImplementation("ru.lanwen.wiremock:wiremock-junit5:1.3.1")
testImplementation("org.assertj:assertj-core:3.25.1")
// This cannot be updated to 5.x as it requires Java 11,
// but we are running CI on Java 8 in .github/workflows/java-versions.yml.
// but we are running tests on CI with Java 8 in .github/workflows/java-versions.yml.
testImplementation("org.mockito:mockito-junit-jupiter:4.11.0")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
}
Expand Down Expand Up @@ -129,6 +129,22 @@ stutter {
compatibleRange("7.3")
}
}
register("java19") {
javaToolchain {
languageVersion = JavaLanguageVersion.of(19)
}
gradleVersions {
compatibleRange("7.6")
}
}
register("javaauto") {
javaToolchain {
languageVersion = JavaLanguageVersion.of(JavaVersion.current().majorVersion)
}
gradleVersions {
compatibleRange("7.6")
}
}
}
}

Expand Down Expand Up @@ -174,7 +190,7 @@ kotlin.target.compilations.configureEach {
compilerOptions.configure {
// Gradle fully supports running on Java 8: https://docs.gradle.org/current/userguide/compatibility.html,
// so we should allow users to do that too.
jvmTarget = JvmTarget.fromTarget(JavaVersion.VERSION_1_8.toString())
jvmTarget = JvmTarget.fromTarget(project.java.targetCompatibility.toString())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider merging #300 then rebasing.


// Suppress "Language version 1.3 is deprecated and its support will be removed in a future version of Kotlin".
freeCompilerArgs.add("-Xsuppress-version-warnings")
Expand Down Expand Up @@ -252,6 +268,17 @@ tasks {
showStandardStreams = true
}
}
javaLauncher = project.javaToolchains.launcherFor {
languageVersion = providers
.gradleProperty("nexusPublishPlugin.test.java")
.map {
if (it == "auto") {
JavaLanguageVersion.of(JavaVersion.current().majorVersion)
} else {
JavaLanguageVersion.of(it)
}
}
}
}
withType<Test>().configureEach {
dependsOn(shadowJar)
Expand All @@ -261,6 +288,19 @@ tasks {
withType<Test>().matching { it.name.startsWith("compatTest") }.configureEach {
systemProperty("plugin.version", project.version)
}
named<Test>("test").configure {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is equivalent:

Suggested change
named<Test>("test").configure {
test {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is that tasks.test {} or project.test {} just to make sure it's at the right level in the build.gradle.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tasks.test

It's sitting in the tasks {} block so can reference test directly here.

javaLauncher = project.javaToolchains.launcherFor {
languageVersion = providers
.gradleProperty("nexusPublishPlugin.test.java")
.map {
if (it == "auto") {
JavaLanguageVersion.of(JavaVersion.current().majorVersion)
} else {
JavaLanguageVersion.of(it)
}
}
}
}
}

publishing {
Expand Down
14 changes: 7 additions & 7 deletions buildSrc/src/main/kotlin/IdeaExtExtensions.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,13 +24,13 @@ import java.io.File
import kotlin.math.min

fun IdeaProject.settings(configuration: ProjectSettings.() -> kotlin.Unit) =
(this as ExtensionAware).configure(configuration)
(this as ExtensionAware).configure(configuration)

fun ProjectSettings.copyright(configuration: CopyrightConfiguration.() -> kotlin.Unit) =
(this as ExtensionAware).configure(configuration)
(this as ExtensionAware).configure(configuration)

fun Project.readCopyrightHeader(licenseHeaderFile: File) =
licenseHeaderFile.readLines()
.map { line -> line.substring(min(line.length, 3)) }
.joinToString("\n")
.trim()
licenseHeaderFile.readLines()
.map { line -> line.substring(min(line.length, 3)) }
.joinToString("\n")
.trim()
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configuration-cache=true

# Version of JDK to use for running tests.
# Possible values:
# - auto -> use Java running Gradle, best for local dev.
# - A Java major version number, like 8, 11 or 17.
nexusPublishPlugin.test.java=auto
2 changes: 2 additions & 0 deletions stutter.lockfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# DO NOT MODIFY: Generated by Stutter plugin.
java11=6.2.2,6.9.4,7.0.2,7.6.2,8.0.2,8.2.1
java17=7.3.3,7.6.2,8.0.2,8.2.1
java19=7.6.2,8.0.2,8.2.1
java8=6.2.2,6.9.4,7.0.2,7.6.2,8.0.2,8.2.1
javaauto=7.3.3,7.6.2,8.0.2,8.2.1