Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare 4.0.3 release #732

Merged
merged 7 commits into from
Jul 18, 2024
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
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 4.0.2
version = 4.0.3
group = org.asciidoctor

copyrightYear = 2013-2024
Expand All @@ -14,7 +14,7 @@ grolifantVersion = 3.0.1
jacocoVersion = 0.8.6
codenarcVersion = 3.3.0
nodejsGradleVersion = 2.2.0
pluginJrubySimpleVersion = 1.0.1
pluginJrubySimpleVersion = 1.0.2
pluginPublishPlugin = 1.2.1

org.gradle.caching = true
Expand Down
2 changes: 1 addition & 1 deletion jvm-epub/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ generateModuleVersions {
}

dependencies {
implementation project(':asciidoctor-gradle-jvm')
api project(':asciidoctor-gradle-jvm')

intTestOfflineRepo "org.asciidoctor:asciidoctorj:${compileOnlyAsciidoctorJVersion}"
intTestOfflineRepo "org.asciidoctor:asciidoctorj-epub3:${downloadOnlyEpubVersion}"
Expand Down
2 changes: 1 addition & 1 deletion jvm-pdf/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ agProject {
}

dependencies {
implementation project(':asciidoctor-gradle-jvm')
api project(':asciidoctor-gradle-jvm')
intTestOfflineRepo "org.asciidoctor:asciidoctorj:${compileOnlyAsciidoctorJVersion}"
intTestOfflineRepo "org.asciidoctor:asciidoctorj-pdf:${downloadOnlyPdfVersion}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ import java.util.regex.Pattern
import static groovy.lang.Closure.DELEGATE_FIRST
import static org.ysb33r.grolifant.api.core.ClosureUtils.configureItem

/** Extension for configuring AsciidoctorJ.
/**
* Extension for configuring AsciidoctorJ.
*
* It can be used as both a project and a task extension.
*
Expand Down Expand Up @@ -85,7 +86,7 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension {
private final BiFunction<String, Closure, Dependency> dependencyCreator
private final Function<Project, Dependency> projectDependency
private Object version
private Optional<Object> jrubyVersion
private Optional<Object> jrubyVersionProvider
private boolean onlyTaskOptions = false
private boolean onlyTaskExtensions = false
private boolean onlyTaskWarnings = false
Expand Down Expand Up @@ -381,27 +382,29 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension {
*/
String getJrubyVersion() {
if (task) {
if (this.jrubyVersion != null && this.jrubyVersion.present) {
projectOperations.stringTools.stringize(this.jrubyVersion.get())
if (this.jrubyVersionProvider != null && this.jrubyVersionProvider.present) {
projectOperations.stringTools.stringize(this.jrubyVersionProvider.get())
} else {
extFromProject.getJrubyVersion()
extFromProject.jrubyVersion
}
} else {
this.jrubyVersion?.present ? projectOperations.stringTools.stringize(this.jrubyVersion.get()) : null
this.jrubyVersionProvider?.present ?
projectOperations.stringTools.stringize(this.jrubyVersionProvider.get()) : null
}
}

/** Set a version of JRuby to use.
*
* The version specified is not a guarantetd version, simply a minimum required version.
* The version specified is not a guaranteed version, simply a minimum required version.
* If the version of asciidoctorj is dependent on a version later than the one specified
* here, then that would be used instead. In such cases iif the exact version needs to be
* here, then that would be used instead. In such cases if the exact version needs to be
* forced then a resolution strategy needs to be provided via {@link #resolutionStrategy}.
*
* @param v JRuby version
*/
void setJrubyVersion(Object v) {
this.jrubyVersion = Optional.of(v)
this.jrubyVersionProvider = Optional.of(v)
updateConfiguration()
}

/* -------------------------
Expand Down Expand Up @@ -624,6 +627,7 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension {
*/
void setVersion(Object v) {
this.version = v
updateConfiguration()
}

/**
Expand All @@ -644,8 +648,13 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension {
*/
void loadJRubyResolutionStrategy(Configuration cfg) {
cfg.resolutionStrategy.eachDependency { DependencyResolveDetails dsr ->
if (dsr.target.name == 'jruby' && dsr.target.group == 'org.jruby') {
dsr.useTarget "${JRUBY_COMPLETE_DEPENDENCY}:${dsr.target.version}"
if (dsr.requested.name == 'jruby' && dsr.requested.group == 'org.jruby') {
dsr.useTarget "${JRUBY_COMPLETE_DEPENDENCY}:${dsr.requested.version}"
}

String req = "${dsr.requested.group}:${dsr.requested.name}"
if (JRUBY_COMPLETE_DEPENDENCY == req && jrubyVersion) {
dsr.useVersion jrubyVersion
}
}
}
Expand Down Expand Up @@ -700,11 +709,6 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension {
}
}

@SuppressWarnings(['UnusedPrivateMethodParameter', 'UnusedPrivateMethod'])
private String minimumSafeJRubyVersion(final String asciidoctorjVersion) {
'9.1.0.0'
}

@SuppressWarnings('Instanceof')
private List<Pattern> patternize(final List<Object> patterns) {
Transform.toList(patterns) {
Expand All @@ -729,8 +733,12 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension {
final String diagramVer = finalDiagramVersion

loadDependencyRuleOnce(ASCIIDOCTORJ_CORE_DEPENDENCY) { -> owner.version }
loadDependencyRuleOnce(JRUBY_COMPLETE_DEPENDENCY) { ->
owner.getJrubyVersion() ?: owner.minimumSafeJRubyVersion(owner.getVersion())

if (jrubyVersionProvider?.present) {
loadDependencyRuleOnce(
JRUBY_COMPLETE_DEPENDENCY,
{ Optional x -> x.get() }.curry(jrubyVersionProvider) as Callable<String>
)
}

if (gDslVer != null) {
Expand Down
Loading