From fe47a9daf97c6f2ef65fda0c61d3d0a4bb514d61 Mon Sep 17 00:00:00 2001 From: David Gregorczyk Date: Mon, 16 Sep 2024 16:44:13 +0200 Subject: [PATCH] Bump Java version used by asciidoc-converter; bump Kotlin version; fix Github request error. --- .ci/asciidoc-converter/build.gradle.kts | 27 +++++++++++++------ .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../extension/IssuesSectionPreprocessor.kt | 16 ++++++----- .../org/sdpi/asciidoc/github/IssueImport.kt | 5 ++-- .github/workflows/feature-review-build.yml | 4 +-- .github/workflows/latest-master-build.yml | 4 +-- .github/workflows/release-build.yml | 4 +-- 7 files changed, 38 insertions(+), 24 deletions(-) diff --git a/.ci/asciidoc-converter/build.gradle.kts b/.ci/asciidoc-converter/build.gradle.kts index 9a3d7c4..fa9e746 100644 --- a/.ci/asciidoc-converter/build.gradle.kts +++ b/.ci/asciidoc-converter/build.gradle.kts @@ -2,9 +2,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { java - kotlin("jvm") version "1.8.10" - kotlin("plugin.serialization") version "1.8.10" application + idea + kotlin("jvm") version "2.0.10" + kotlin("plugin.serialization") version "2.0.10" } group = "org.sdpi" @@ -15,9 +16,8 @@ repositories { } dependencies { - // regex pattern - implementation("org.jetbrains.kotlin:kotlin-stdlib:1.7.10") + implementation(kotlin("stdlib")) // command line parsing // https://mvnrepository.com/artifact/com.github.ajalt/clikt @@ -44,12 +44,11 @@ dependencies { // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine runtimeOnly(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = "5.7.1") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1") // https://mvnrepository.com/artifact/org.kohsuke/github-api implementation("org.kohsuke:github-api:1.315") - testImplementation(kotlin("test")) } @@ -57,10 +56,22 @@ tasks.test { useJUnitPlatform() } -tasks.withType { - kotlinOptions.jvmTarget = "1.8" +val javaSource: Int = 17 +val jdkVersion: Int = javaSource + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(javaSource) + } + withJavadocJar() + withSourcesJar() +} + +kotlin { + jvmToolchain(jdkVersion) } + application { mainClass.set("org.sdpi.ConvertAndVerifySupplementKt") } \ No newline at end of file diff --git a/.ci/asciidoc-converter/gradle/wrapper/gradle-wrapper.properties b/.ci/asciidoc-converter/gradle/wrapper/gradle-wrapper.properties index 41dfb87..19cfad9 100644 --- a/.ci/asciidoc-converter/gradle/wrapper/gradle-wrapper.properties +++ b/.ci/asciidoc-converter/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/extension/IssuesSectionPreprocessor.kt b/.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/extension/IssuesSectionPreprocessor.kt index 9bd16b1..5e4eb32 100644 --- a/.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/extension/IssuesSectionPreprocessor.kt +++ b/.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/extension/IssuesSectionPreprocessor.kt @@ -25,12 +25,16 @@ class IssuesSectionPreprocessor( .filter { it.variableName == VAR_MILESTONE_PUBLICATION || it.variableName == VAR_MILESTONE_REVIEW } .associateBy(VariableDeclaration::variableName) - val issues = IssueImport( - githubToken, - variables[VAR_MILESTONE_PUBLICATION]!!.variableValue, - variables[VAR_MILESTONE_REVIEW]!!.variableValue - ).requestIssues().issues() - + val issues = try { + IssueImport( + githubToken, + variables[VAR_MILESTONE_PUBLICATION]!!.variableValue, + variables[VAR_MILESTONE_REVIEW]!!.variableValue + ).requestIssues().issues() + } catch (e: Exception) { + logger.error(e) { e.message } + throw e + } reader.restoreLines(lines.fold(mutableListOf()) { acc, line -> when (line.trim().lowercase()) { diff --git a/.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/github/IssueImport.kt b/.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/github/IssueImport.kt index b93daf5..138c136 100644 --- a/.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/github/IssueImport.kt +++ b/.ci/asciidoc-converter/src/main/kotlin/org/sdpi/asciidoc/github/IssueImport.kt @@ -72,15 +72,14 @@ class IssueImport( return this } - private fun issuesInMilestones( repository: GHRepository, state: GHIssueState, vararg milestones: String ): List { return milestones - .map { ms -> - repository.listMilestones(GHIssueState.ALL).first { it.title == ms }.let { + .mapNotNull { ms -> + repository.listMilestones(GHIssueState.ALL).firstOrNull { it.title == ms }?.let { repository.getIssues(state, it) } } diff --git a/.github/workflows/feature-review-build.yml b/.github/workflows/feature-review-build.yml index 0a499e5..5e63f5f 100755 --- a/.github/workflows/feature-review-build.yml +++ b/.github/workflows/feature-review-build.yml @@ -17,10 +17,10 @@ jobs: - name: Checkout branch uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '11' + java-version: '17' distribution: 'temurin' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/latest-master-build.yml b/.github/workflows/latest-master-build.yml index 7573794..3df0996 100755 --- a/.github/workflows/latest-master-build.yml +++ b/.github/workflows/latest-master-build.yml @@ -20,10 +20,10 @@ jobs: - name: Checkout branch uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '11' + java-version: '17' distribution: 'temurin' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 38e5430..0372351 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -20,10 +20,10 @@ jobs: - name: Checkout branch uses: actions/checkout@v4 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: '11' + java-version: '17' distribution: 'temurin' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file