From cb8659a3a6b593418390ff3edc12b7ae83da6eab Mon Sep 17 00:00:00 2001 From: Robert Panzer Date: Sat, 9 Apr 2022 18:56:33 +0200 Subject: [PATCH 1/3] Fix versionCheck gradle task to compare against version of resolved gem instead of project version --- gradle/versioncheck.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/versioncheck.gradle b/gradle/versioncheck.gradle index b233baa6..9c77125f 100644 --- a/gradle/versioncheck.gradle +++ b/gradle/versioncheck.gradle @@ -22,14 +22,14 @@ task checkVersion() { String gem_latest_version = getLatestGemVersion(gem_name) String javaVersion = latestGemVersionAsJavaVersion(gem_latest_version) - try { - Version projectVersion = Version.valueOf(version as String) + String resolvedVersion = project.configurations.gems.resolvedConfiguration.resolvedArtifacts.find { it.name == gem_name }.moduleVersion.id.version + Version projectVersion = Version.valueOf(resolvedVersion as String) Version gemJavaVersion = Version.valueOf(javaVersion) if (projectVersion.lessThan(gemJavaVersion)) { - logger.warn "\nWARNING\nVersion mismatch: Current Version: {}, Gem Version: {}\n",version , gem_latest_version + logger.warn "\nWARNING\nVersion mismatch: Current Version: {}, Gem Version: {}\n", resolvedVersion , gem_latest_version } else { println "up-to-date" } From 3cba0cfc1e97016f1ad89cad4723d165b09b2288 Mon Sep 17 00:00:00 2001 From: Robert Panzer Date: Sat, 9 Apr 2022 19:00:00 +0200 Subject: [PATCH 2/3] Apply jruby plugin only to main asciidoctorj module instead of all --- asciidoctorj-core/build.gradle | 33 +++++++++++++++++++++++++++++++++ build.gradle | 34 ---------------------------------- gradle/eclipse.gradle | 1 - 3 files changed, 33 insertions(+), 35 deletions(-) diff --git a/asciidoctorj-core/build.gradle b/asciidoctorj-core/build.gradle index a62d6e37..ae5bec84 100644 --- a/asciidoctorj-core/build.gradle +++ b/asciidoctorj-core/build.gradle @@ -1,12 +1,17 @@ apply plugin: 'java-library' apply plugin: 'groovy' apply plugin: 'biz.aQute.bnd.builder' +apply plugin: 'com.github.jruby-gradle.base' project.ext.publicationName = "mavenAsciidoctorJ" apply from: rootProject.file('gradle/publish.gradle') apply from: rootProject.file('gradle/signing.gradle') +repositories { + ruby.gems() +} + dependencies { api project(path: ':asciidoctorj-api') api "org.jruby:jruby:$jrubyVersion" @@ -38,6 +43,8 @@ def gemFiles = fileTree("${project.buildDir}/.gems") { include "gems/asciidoctor-*/data/**" } +apply from: rootProject.file('gradle/versioncheck.gradle') + jrubyPrepare { doLast { copy { // bundles the gems inside this artifact @@ -46,6 +53,32 @@ jrubyPrepare { } } } +tasks.eclipse.dependsOn jrubyPrepare + + +jruby { + defaultRepositories = false + defaultVersion = jrubyVersion + // TODO I'd like to be able to customize the name of the gemInstallDir +} + +ext { + // path to use for the prepared jruby gems + preparedGems = new File("$buildDir/preparedGems") +} + +sourceSets { + main { + //let's register an output folder on the main SourceSet: + output.dir(preparedGems, builtBy: 'jrubyPrepare') + //it is now a part of the 'main' classpath and will be a part of the jar + } +} + +// QUESTION is this the right place to insert this task dependency in the lifecycle? +// IMPORTANT The TMP or TEMP environment variable must be set for the gem install command to work on Windows +processResources.dependsOn jrubyPrepare + javadoc { classpath = sourceSets.main.output + sourceSets.main.compileClasspath + project(':asciidoctorj-test-support').sourceSets.test.output diff --git a/build.gradle b/build.gradle index 18d80adf..1da30b2d 100644 --- a/build.gradle +++ b/build.gradle @@ -185,10 +185,6 @@ subprojects { } -configure(subprojects.findAll { !it.isDistribution() && it.name != 'asciidoctorj-api' && it.name != 'asciidoctorj-documentation' && it.name != 'asciidoctorj-test-support' && it.name != 'asciidoctorj-arquillian-extension' && !isIntegrationTestProject(it) }) { - apply from: rootProject.file('gradle/versioncheck.gradle') -} - boolean isIntegrationTestProject(def project) { project.name in ['asciidoctorj-wildfly-integration-test', 'asciidoctorj-springboot-integration-test', @@ -198,17 +194,9 @@ boolean isIntegrationTestProject(def project) { // apply JRuby and sources/javadocs packaging stuff for all subprojects except the distribution configure(subprojects.findAll { !it.isDistribution() }) { - apply plugin: 'com.github.jruby-gradle.base' apply from: rootProject.file('gradle/eclipse.gradle') apply plugin: 'idea' - jruby { - defaultRepositories false - } - - repositories { - ruby.gems() - } javadoc { // Oracle JDK8 likes to fail the build over spoiled HTML @@ -224,26 +212,4 @@ configure(subprojects.findAll { !it.name.endsWith('-distribution') && ! it.name. withSourcesJar() } - jruby { - defaultRepositories = false - defaultVersion = jrubyVersion - // TODO I'd like to be able to customize the name of the gemInstallDir - } - - ext { - // path to use for the prepared jruby gems - preparedGems = new File("$buildDir/preparedGems") - } - - sourceSets { - main { - //let's register an output folder on the main SourceSet: - output.dir(preparedGems, builtBy: 'jrubyPrepare') - //it is now a part of the 'main' classpath and will be a part of the jar - } - } - - // QUESTION is this the right place to insert this task dependency in the lifecycle? - // IMPORTANT The TMP or TEMP environment variable must be set for the gem install command to work on Windows - processResources.dependsOn jrubyPrepare } diff --git a/gradle/eclipse.gradle b/gradle/eclipse.gradle index aaa728d1..edd1a2b5 100644 --- a/gradle/eclipse.gradle +++ b/gradle/eclipse.gradle @@ -1,6 +1,5 @@ apply plugin: 'eclipse' -tasks.eclipse.dependsOn jrubyPrepare eclipse { classpath { defaultOutputDir = file('build/eclipse') From 9ec1e7a40274d9fa82d62f32c060c11f1d5410cf Mon Sep 17 00:00:00 2001 From: Robert Panzer Date: Sat, 9 Apr 2022 19:00:45 +0200 Subject: [PATCH 3/3] Updated changelog --- CHANGELOG.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 29872007..db5eac01 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -26,6 +26,7 @@ Build Improvement:: * Upgrade to gradle 7.4.2 (#1086) * Upgrade to Wildfly 26.0.1 for integration test (#1085) * Upgrade to Spring Boot 2.6.5 for integration test (#1085) +* Fix gem version check task (#1087) Documentation::