Skip to content

Commit

Permalink
Upgrade Gradle, move to org.ysb33r.jruby plugins (#1293)
Browse files Browse the repository at this point in the history
* Upgrade Gradle, move to org.ysb33r.jruby plugins

* Update to org.ysb33r.jruby 2.0.0
  • Loading branch information
robertpanzer authored Jan 2, 2025
1 parent 32be7e8 commit dcf411b
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 43 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co

== Unreleased

Build Improvement::

* Move to new plugin suite org.ysb33r.jruby for installing ruby gems (#1293)
* Upgrade build to Gradle 8.12 (#1293)


== 3.0.0 (2024-08-25)

Build Improvement::
Expand Down
48 changes: 26 additions & 22 deletions asciidoctorj-core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
apply plugin: 'java-library'
apply plugin: 'groovy'
apply plugin: 'biz.aQute.bnd.builder'
apply plugin: 'com.github.jruby-gradle.base'
apply plugin: 'org.ysb33r.jruby.base'
apply plugin: 'org.ysb33r.jruby.resolver'

import org.ysb33r.gradle.jruby.api.base.tasks.JRubyPrepare

project.ext.publicationName = "mavenAsciidoctorJ"

Expand All @@ -12,21 +15,27 @@ repositories {
ruby.gems()
}

configurations {
runtimeGems {
canBeResolved(true)
}
}

dependencies {
api project(':asciidoctorj-api')
api "org.jruby:jruby:$jrubyVersion"

gems "rubygems:asciidoctor:$asciidoctorGemVersion"
gems "rubygems:asciimath:$asciimathGemVersion"
gems "rubygems:coderay:$coderayGemVersion"
gems "rubygems:rouge:$rougeGemVersion"
gems "rubygems:erubis:$erubisGemVersion"
gems "rubygems:haml:$hamlGemVersion"
gems "rubygems:open-uri-cached:$openUriCachedGemVersion"
gems "rubygems:slim:$slimGemVersion"
gems "rubygems:thread_safe:$threadSafeGemVersion"
gems "rubygems:tilt:$tiltGemVersion"
gems "rubygems:concurrent-ruby:$concurrentRubyGemVersion"
runtimeGems "rubygems:asciidoctor:$asciidoctorGemVersion"
runtimeGems "rubygems:asciimath:$asciimathGemVersion"
runtimeGems "rubygems:coderay:$coderayGemVersion"
runtimeGems "rubygems:rouge:$rougeGemVersion"
runtimeGems "rubygems:erubis:$erubisGemVersion"
runtimeGems "rubygems:haml:$hamlGemVersion"
runtimeGems "rubygems:open-uri-cached:$openUriCachedGemVersion"
runtimeGems "rubygems:slim:$slimGemVersion"
runtimeGems "rubygems:thread_safe:$threadSafeGemVersion"
runtimeGems "rubygems:tilt:$tiltGemVersion"
runtimeGems "rubygems:concurrent-ruby:$concurrentRubyGemVersion"
// TODO could use dependency replacement feature to fix version of Saxon-HE
testImplementation("org.xmlmatchers:xml-matchers:$xmlMatchersVersion") { exclude module: 'Saxon-HE' }
testImplementation "net.sf.saxon:Saxon-HE:$saxonVersion"
Expand All @@ -45,22 +54,17 @@ def gemFiles = fileTree("${project.buildDir}/.gems") {

apply from: rootProject.file('gradle/versioncheck.gradle')

jrubyPrepare {
tasks.named('gemPrepare', JRubyPrepare) {
gemConfiguration = configurations.runtimeGems
doLast {
copy { // bundles the gems inside this artifact
from gemFiles
into preparedGems
}
}
}
tasks.eclipse.dependsOn jrubyPrepare

tasks.eclipse.dependsOn gemPrepare

jruby {
defaultRepositories = false
jrubyVersion = jrubyVersion
// TODO I'd like to be able to customize the name of the gemInstallDir
}

ext {
// path to use for the prepared jruby gems
Expand All @@ -70,14 +74,14 @@ ext {
sourceSets {
main {
//let's register an output folder on the main SourceSet:
output.dir(preparedGems, builtBy: 'jrubyPrepare')
output.dir(preparedGems, builtBy: 'gemPrepare')
//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
processResources.dependsOn gemPrepare


javadoc {
Expand Down
2 changes: 1 addition & 1 deletion asciidoctorj-wildfly-integration-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ task createModuleDescriptor(type: Copy) {
into "build/modules/org/asciidoctor/asciidoctorj/main"
filter {
it
.replaceAll('@@version@@', project(':asciidoctorj').version)
.replaceAll('@@version@@', project.version)
.replaceAll('@@jrubyVersion@@', jrubyVersion)
}
}
Expand Down
8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ buildscript {
}
dependencies {
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:5.3.0"
classpath("com.github.jruby-gradle:jruby-gradle-plugin:2.0.1") {
exclude module: 'grolifant'
exclude module: 'okhttp-digest'
}
classpath 'org.ysb33r.gradle:grolifant:0.17.0'
}
}

// modern plugins config
plugins {
id 'org.ysb33r.jruby.resolver' version '2.0.0'
id 'org.ysb33r.jruby.base' version '2.0.0'

id "io.sdkman.vendors" version "3.0.0"
id "signing"
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=3.0.0
version=3.0.1-SNAPSHOT
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
2 changes: 1 addition & 1 deletion gradle/sdkman.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sdkman {
consumerKey = project.sdkman_consumer_key
consumerToken = project.sdkman_consumer_token
candidate = rootProject.name
version = rootProject.version
version = project.version
hashtag = "#asciidoctorj"
url = "https://repo1.maven.org/maven2/org/asciidoctor/asciidoctorj/${rootProject.version}/asciidoctorj-${rootProject.version}-bin.zip"
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 4 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down

0 comments on commit dcf411b

Please sign in to comment.