From 25b1ba423d92db287b1c7af2b6756d8007fff801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Schalk=20W=2E=20Cronj=C3=A9?= Date: Mon, 8 Jan 2024 17:58:04 +0100 Subject: [PATCH 01/25] Handle AsciidoctoJ closure extensions in face of Gradle instrumentation - On Gradle 7.6 - 8.3, leak some Gradle libraries onto the classpath in order to allow closure extensions to still work. - On Gradle 8.4+, throw an exception and tell the build script author to convert the closure into a string or place it in a file. - Add support for providers to strings or files. - Allow for external dependencies to be added. Closes #697 --- gradle.properties | 4 +- gradle/publishing.gradle | 8 +- .../gradleTest/complex-jvm-setup/build.gradle | 2 +- .../extension/build.gradle | 1 - .../jvm/ExtensionsFunctionalSpec.groovy | 160 ++++++++++++-- .../AsciidoctorWorkerParameters.groovy | 3 +- .../internal/ExecutorConfiguration.groovy | 1 + .../ExecutorConfigurationContainer.groovy | 4 +- .../gradle/internal/JavaExecUtils.groovy | 84 ++------ .../gradle/jvm/AbstractAsciidoctorTask.groovy | 51 ++++- .../gradle/jvm/AsciidoctorJExtension.groovy | 200 ++++++++++-------- .../gradle/internal/JavaExecUtilsSpec.groovy | 73 ------- 12 files changed, 333 insertions(+), 258 deletions(-) delete mode 100644 jvm/src/test/groovy/org/asciidoctor/gradle/internal/JavaExecUtilsSpec.groovy diff --git a/gradle.properties b/gradle.properties index fff5d6001..56651d6da 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version = 4.0.0 +version = 4.0.1 group = org.asciidoctor sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -12,7 +12,7 @@ project_vcs = https://github.com/asciidoctor/asciidoctor-gradle-plugin.g cglibVersion = 3.3.0 jsoupVersion = 1.13.1 spockVersion = 2.3-groovy-3.0 -grolifantVersion = 2.2.1 +grolifantVersion = 2.2.3 jacocoVersion = 0.8.6 codenarcVersion = 3.3.0 nodejsGradleVersion = 2.2.0 diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index bb5783b14..a70090f17 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -48,7 +48,7 @@ tasks.named('jar', Jar) { ext { pomConfig = { name project.name - description project.project_description +// description project.project_description url project.project_website inceptionYear '2013' licenses { @@ -115,9 +115,9 @@ ext { } publishing.publications.withType(MavenPublication).configureEach { - pom.withXml { - asNode().appendNode('description', project.project_description) - } +// pom.withXml { +// asNode().appendNode('description', project.project_description) +// } } pluginBundle { diff --git a/jvm/src/gradleTest/complex-jvm-setup/build.gradle b/jvm/src/gradleTest/complex-jvm-setup/build.gradle index 1166125b9..00e43ed59 100644 --- a/jvm/src/gradleTest/complex-jvm-setup/build.gradle +++ b/jvm/src/gradleTest/complex-jvm-setup/build.gradle @@ -9,7 +9,7 @@ repositories { asciidoctorj { modules { - diagram.version '1.5.16' + diagram.version '1.5.16' } logLevel 'INFO' } diff --git a/jvm/src/gradleTest/extension-in-subproject/extension/build.gradle b/jvm/src/gradleTest/extension-in-subproject/extension/build.gradle index 6dc123a25..6832f2c40 100644 --- a/jvm/src/gradleTest/extension-in-subproject/extension/build.gradle +++ b/jvm/src/gradleTest/extension-in-subproject/extension/build.gradle @@ -2,7 +2,6 @@ plugins { id 'groovy' } - dependencies { compileOnly "org.codehaus.groovy:groovy:${System.getProperty('GROOVY_VERSION')}" compileOnly "org.asciidoctor:asciidoctorj:${System.getProperty('ASCIIDOCTORJ_VERSION')}" diff --git a/jvm/src/intTest/groovy/org/asciidoctor/gradle/jvm/ExtensionsFunctionalSpec.groovy b/jvm/src/intTest/groovy/org/asciidoctor/gradle/jvm/ExtensionsFunctionalSpec.groovy index d4e3d43e8..420a1e447 100644 --- a/jvm/src/intTest/groovy/org/asciidoctor/gradle/jvm/ExtensionsFunctionalSpec.groovy +++ b/jvm/src/intTest/groovy/org/asciidoctor/gradle/jvm/ExtensionsFunctionalSpec.groovy @@ -46,7 +46,7 @@ class ExtensionsFunctionalSpec extends FunctionalSpecification { void 'Extension can be applied via closure (#model)'() { given: getBuildFile( - model.processMode, model.version, """ + model.processMode, model.version, """ asciidoctor { asciidoctorj { docExtensions { @@ -84,12 +84,95 @@ class ExtensionsFunctionalSpec extends FunctionalSpecification { model << AsciidoctorjVersionProcessModeGenerator.get() } + @SuppressWarnings('GStringExpressionWithinString') + void 'Extension can be applied via closure (Gradle #gradle)'() { + given: + final model = AsciidoctorjVersionProcessModeGenerator.get().first() + getBuildFile( + model.processMode, model.version, """ + asciidoctor { + asciidoctorj { + docExtensions { + block(name: "BIG", contexts: [":paragraph"]) { + parent, reader, attributes -> + def upperLines = reader.readLines()*.toUpperCase() + .inject("") {a, b -> a + '\\\\n' + b} + + createBlock(parent, "paragraph", [upperLines], attributes, [:]) + } + block("small") { + parent, reader, attributes -> + def lowerLines = reader.readLines()*.toLowerCase() + .inject("") {a, b -> a + '\\\\n' + b} + + createBlock(parent, "paragraph", [lowerLines], attributes, [:]) + } + } + } + } + """.stripIndent()) + + GradleRunner runner = getGradleRunner(DEFAULT_ARGS).withGradleVersion(gradle) + + when: + runner.build() + File resultFile = new File(buildDir, "docs/asciidoc/${ASCIIDOC_INLINE_EXTENSIONS_FILE.replaceFirst('asciidoc', 'html')}") + + then: 'content is generated as HTML and XML' + resultFile.exists() + resultFile.text.contains('WRITE THIS IN UPPERCASE') + resultFile.text.contains('and write this in lowercase') + + where: + gradle << ['8.3', '8.1.1', '7.6.1', '7.0.2'] + } + + @SuppressWarnings('GStringExpressionWithinString') + void 'Extension cannot be applied via closure if Gradle #gradle'() { + given: + final model = AsciidoctorjVersionProcessModeGenerator.get().first() + getBuildFile( + model.processMode, model.version, """ + asciidoctor { + asciidoctorj { + docExtensions { + block(name: "BIG", contexts: [":paragraph"]) { + parent, reader, attributes -> + def upperLines = reader.readLines()*.toUpperCase() + .inject("") {a, b -> a + '\\\\n' + b} + + createBlock(parent, "paragraph", [upperLines], attributes, [:]) + } + block("small") { + parent, reader, attributes -> + def lowerLines = reader.readLines()*.toLowerCase() + .inject("") {a, b -> a + '\\\\n' + b} + + createBlock(parent, "paragraph", [lowerLines], attributes, [:]) + } + } + } + } + """.stripIndent()) + + GradleRunner runner = getGradleRunner(DEFAULT_ARGS).withGradleVersion(gradle) + + when: + final result = runner.buildAndFail() + + then: + result.output.contains('Closures are not supported on Gradle 8.4+ due to Gradle instrumentation issues. Place the content in a string or load from it from a file instead.') + + where: + gradle << ['8.4', '8.5'] + } + @Unroll @Timeout(value = 90) void 'Extension can be applied from a string (#model)'() { given: getBuildFile( - model.processMode, model.version, """ + model.processMode, model.version, """ asciidoctor { asciidoctorj { @@ -132,12 +215,61 @@ block('small') { model << AsciidoctorjVersionProcessModeGenerator.get() } + @Unroll + @Timeout(value = 90) + void 'Extension can be applied from a string (Gradle #gradle)'() { + given: + final model = AsciidoctorjVersionProcessModeGenerator.get().first() + getBuildFile( + model.processMode, model.version, """ +asciidoctor { + + asciidoctorj { + docExtensions ''' +block(name: 'BIG', contexts: [':paragraph']) { + parent, reader, attributes -> + def upperLines = reader.readLines() + .collect {it.toUpperCase()} + .inject('') {a, b -> "\${a}\\\n\${b}"} + + createBlock(parent, "paragraph", [upperLines], attributes, [:]) +} +block('small') { + parent, reader, attributes -> + def lowerLines = reader.readLines() + .collect {it.toLowerCase()} + .inject('') {a, b -> "\${a}\\\n\${b}"} + + createBlock(parent, 'paragraph', [lowerLines], attributes, [:]) +} +''' + } +} +""") + GradleRunner runner = getGradleRunner(DEFAULT_ARGS) + if (model.processMode != 'JAVA_EXEC') { + runner.withDebug(false) + } + + when: + runner.build() + File resultFile = new File(buildDir, "docs/asciidoc/${ASCIIDOC_INLINE_EXTENSIONS_FILE.replaceFirst('asciidoc', 'html')}") + + then: 'content is generated as HTML and XML' + resultFile.exists() + resultFile.text.contains('WRITE THIS IN UPPERCASE') + resultFile.text.contains('and write this in lowercase') + + where: + gradle << ['8.4', '8.3', '8.1.1', '7.6.1', '7.0.2'] + } + @Timeout(value = 90) @Unroll void 'Extension can be applied from file (#model)'() { given: getBuildFile( - model.processMode, model.version, """ + model.processMode, model.version, """ asciidoctor { asciidoctorj { docExtensions file('src/docs/asciidoc/blockMacro.groovy') @@ -170,7 +302,7 @@ asciidoctor { given: 'A build file that declares extensions' getBuildFile( - model.processMode, model.version, ''' + model.processMode, model.version, ''' asciidoctorj { docExtensions { postprocessor { document, output -> @@ -208,7 +340,7 @@ asciidoctor { void 'Fail build if extension fails to compile (#model)'() { given: getBuildFile( - model.processMode, model.version, """ + model.processMode, model.version, """ asciidoctor { asciidoctorj { docExtensions ''' @@ -241,22 +373,22 @@ asciidoctor { given: String extDSL = '''asciidoctorj.docExtensions file('src/docs/asciidoc/blockMacro.groovy')''' getBuildFile( - processMode, version, """ + processMode, version, """ ${extScope == GLOBAL ? extDSL : ''} asciidoctor { ${extScope == LOCAL ? extDSL : ''} } """, - verScope == GLOBAL + verScope == GLOBAL ) GradleRunner runner = getGradleRunner(DEFAULT_ARGS) when: runner.build() File resultFile = new File( - buildDir, - 'docs/asciidoc/' + ASCIIDOC_INLINE_EXTENSIONS_FILE.replaceFirst('asciidoc', 'html') + buildDir, + 'docs/asciidoc/' + ASCIIDOC_INLINE_EXTENSIONS_FILE.replaceFirst('asciidoc', 'html') ) then: 'content is generated as HTML and XML' @@ -270,14 +402,14 @@ asciidoctor { and: extScope | verScope - LOCAL | LOCAL - LOCAL | GLOBAL - GLOBAL | LOCAL - GLOBAL | GLOBAL + LOCAL | LOCAL + LOCAL | GLOBAL + GLOBAL | LOCAL + GLOBAL | GLOBAL } File getBuildFile( - final String processMode, final String version, final String extraContent, boolean configureGlobally = false) { + final String processMode, final String version, final String extraContent, boolean configureGlobally = false) { String versionConfig = """ asciidoctorj { diff --git a/jvm/src/main/groovy/org/asciidoctor/gradle/internal/AsciidoctorWorkerParameters.groovy b/jvm/src/main/groovy/org/asciidoctor/gradle/internal/AsciidoctorWorkerParameters.groovy index 55d529322..8ed726db0 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/internal/AsciidoctorWorkerParameters.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/internal/AsciidoctorWorkerParameters.groovy @@ -18,13 +18,14 @@ package org.asciidoctor.gradle.internal import org.ysb33r.grolifant.api.remote.worker.SerializableWorkerAppParameters /** - * Parameters for serializing ASciidoctor jobs to workers. + * Parameters for serializing Asciidoctor jobs to workers. * * @author Schalk W> Cronjé * * @since 4.0 */ class AsciidoctorWorkerParameters implements SerializableWorkerAppParameters { + private static final long serialVersionUID = 1251694026305095019 /** * Whether to attempt conversions in parallel inside the worker. diff --git a/jvm/src/main/groovy/org/asciidoctor/gradle/internal/ExecutorConfiguration.groovy b/jvm/src/main/groovy/org/asciidoctor/gradle/internal/ExecutorConfiguration.groovy index fd3c7d62b..80c829ecd 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/internal/ExecutorConfiguration.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/internal/ExecutorConfiguration.groovy @@ -29,6 +29,7 @@ import java.util.regex.Pattern @SuppressWarnings(['CloneableWithoutClone']) @TupleConstructor class ExecutorConfiguration implements Serializable, Cloneable { + private static final long serialVersionUID = -2024L File sourceDir File outputDir File projectDir diff --git a/jvm/src/main/groovy/org/asciidoctor/gradle/internal/ExecutorConfigurationContainer.groovy b/jvm/src/main/groovy/org/asciidoctor/gradle/internal/ExecutorConfigurationContainer.groovy index 2e642f54d..d62f816b4 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/internal/ExecutorConfigurationContainer.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/internal/ExecutorConfigurationContainer.groovy @@ -17,7 +17,8 @@ package org.asciidoctor.gradle.internal import groovy.transform.CompileStatic -/** Contains a number of executor configurations. +/** + * Contains a number of executor configurations. * * @since 2.0.0 * @@ -25,6 +26,7 @@ import groovy.transform.CompileStatic */ @CompileStatic class ExecutorConfigurationContainer implements Serializable { + private static final long serialVersionUID = -2024L final List configurations ExecutorConfigurationContainer(Iterable list) { diff --git a/jvm/src/main/groovy/org/asciidoctor/gradle/internal/JavaExecUtils.groovy b/jvm/src/main/groovy/org/asciidoctor/gradle/internal/JavaExecUtils.groovy index 9d69b824d..c89e01247 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/internal/JavaExecUtils.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/internal/JavaExecUtils.groovy @@ -22,8 +22,6 @@ import org.asciidoctor.gradle.remote.AsciidoctorJavaExec import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.file.FileCollection -import org.gradle.api.invocation.Gradle -import org.gradle.util.GradleVersion import org.ysb33r.grolifant.api.core.ProjectOperations import java.util.regex.Pattern @@ -45,16 +43,10 @@ class JavaExecUtils { */ public static final String JRUBY_COMPLETE_DEPENDENCY = 'org.jruby:jruby-complete' - /** The name of the Guava JAR used internally by Gradle. - * - */ - private static final FilenameFilter INTERNAL_GUAVA_PATTERN = internalGuavaPattern() - /** Get the classpath that needs to be passed to the external Java process. * * @param project Current Gradle project * @param asciidoctorClasspath External asciidoctor dependencies - * @param addInternalGuava Set to {@code true} to add internal Guava to classpath * @return A computed classpath that can be given to an external Java process. * * @deprecated @@ -62,28 +54,25 @@ class JavaExecUtils { @Deprecated static FileCollection getJavaExecClasspath( final Project project, - final FileCollection asciidoctorClasspath, - boolean addInternalGuava = false + final FileCollection asciidoctorClasspath ) { File entryPoint = getClassLocation(AsciidoctorJavaExec) File groovyJar = getClassLocation(GroovyObject) FileCollection fc = project.files(entryPoint, groovyJar, asciidoctorClasspath) - addInternalGuava ? project.files(fc, getInternalGuavaLocation(project.gradle)) : fc + fc } /** Get the classpath that needs to be passed to the external Java process. * * @param project Current Gradle project * @param asciidoctorClasspath External asciidoctor dependencies - * @param addInternalGuava Set to {@code true} to add internal Guava to classpath * @return A computed classpath that can be given to an external Java process. */ static FileCollection getJavaExecClasspath( final ProjectOperations po, - final FileCollection asciidoctorClasspath, - boolean addInternalGuava = false + final FileCollection asciidoctorClasspath ) { File entryPoint = getClassLocation(AsciidoctorJavaExec) File groovyJar = getClassLocation(GroovyObject) @@ -91,9 +80,6 @@ class JavaExecUtils { final fc = po.fsOperations.emptyFileCollection() fc.from(entryPoint, groovyJar) - if (addInternalGuava) { - fc.from(getInternalGuavaLocation(po)) - } fc + asciidoctorClasspath } @@ -153,43 +139,23 @@ class JavaExecUtils { getClassLocation(GroovyObject) } - /** Locate the internal Guava JAR from the Gradle distribution - * - * @param gradle Gradle instance - * @return Return Guava location. Never {@code null} - * @throw InternalGuavaLocationException - */ - static File getInternalGuavaLocation(ProjectOperations po) { - File[] files = new File(po.gradleUserHomeDir.get(), 'lib').listFiles(INTERNAL_GUAVA_PATTERN) - - if (!files) { - throw new InternalGuavaLocationException('Cannot locate a Guava JAR in the Gradle distribution') - } else if (files.size() > 1) { - throw new InternalGuavaLocationException( - "Found more than one Guava JAR in the Gradle distribution: ${files*.name}" - ) + static File getInternalGradleLibraryLocation(ProjectOperations po, final Pattern libraryPattern) { + final filter = new FilenameFilter() { + @Override + boolean accept(File dir, String name) { + name.matches(libraryPattern) + } } - files[0] - } - /** Locate the internal Guava JAR from the Gradle distribution - * - * @param gradle Gradle instance - * @return Return Guava location. Never {@code null} - * @throw InternalGuavaLocationException - * - * @deprecated - */ - @Deprecated - @SuppressWarnings('DuplicateStringLiteral') - static File getInternalGuavaLocation(Gradle gradle) { - File[] files = new File(gradle.gradleHomeDir, 'lib').listFiles(INTERNAL_GUAVA_PATTERN) + File[] files = new File(po.gradleHomeDir.get(), 'lib').listFiles(filter) if (!files) { - throw new InternalGuavaLocationException('Cannot locate a Guava JAR in the Gradle distribution') + throw new InternalGradleLibraryLocationException( + "Cannot locate a library in the Gradle distribution using ${libraryPattern}" + ) } else if (files.size() > 1) { - throw new InternalGuavaLocationException( - "Found more than one Guava JAR in the Gradle distribution: ${files*.name}" + throw new InternalGradleLibraryLocationException( + "Found more than one library matching ${libraryPattern} in the Gradle distribution: ${files*.name}" ) } files[0] @@ -197,25 +163,9 @@ class JavaExecUtils { /** Thrown when an internal Guava JAR cannot be located. * - * @since 3.0 + * @since 4.0 */ @InheritConstructors - static class InternalGuavaLocationException extends RuntimeException { - } - - private static FilenameFilter internalGuavaPattern() { - Pattern filter - if (GradleVersion.current() >= GradleVersion.version('5.0')) { - filter = ~/guava-([\d.]+)-[jre|android]+.jar/ - } else { - filter = ~/guava-jdk5-([\d.]+).jar/ - } - - new FilenameFilter() { - @Override - boolean accept(File dir, String name) { - name.matches(filter) - } - } + static class InternalGradleLibraryLocationException extends RuntimeException { } } diff --git a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy index a9f306320..2d7c3c387 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -52,6 +52,7 @@ import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.bundling.Jar import org.gradle.process.JavaForkOptions import org.gradle.workers.WorkerExecutor +import org.ysb33r.grolifant.api.core.LegacyLevel import org.ysb33r.grolifant.api.core.jvm.ExecutionMode import org.ysb33r.grolifant.api.core.jvm.JavaForkOptionsWithEnvProvider import org.ysb33r.grolifant.api.core.jvm.worker.WorkerAppParameterFactory @@ -66,6 +67,7 @@ import static org.asciidoctor.gradle.base.internal.AsciidoctorAttributes.prepare import static org.asciidoctor.gradle.base.internal.AsciidoctorAttributes.resolveAsCacheable import static org.asciidoctor.gradle.base.internal.AsciidoctorAttributes.resolveAsSerializable import static org.asciidoctor.gradle.internal.JavaExecUtils.getExecConfigurationDataFile +import static org.asciidoctor.gradle.internal.JavaExecUtils.getInternalGradleLibraryLocation import static org.gradle.api.tasks.PathSensitivity.RELATIVE /** @@ -426,8 +428,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getSerializableAsciidoctorJExtensions() { + asciidoctorJExtensions.findAll { !(it instanceof Dependency) }.collect { + getSerializableAsciidoctorJExtension(it) + } + } + + private Object getSerializableAsciidoctorJExtension(Object ext) { + switch (ext) { + case CharSequence: + return projectOperations.stringTools.stringize(ext) + case Provider: + return getSerializableAsciidoctorJExtension(((Provider) ext).get()) + default: + return ext + } + } + private Map prepareWorkspacesByLanguage() { languagesAsOptionals.collectEntries { Optional lang -> Workspace workspace = prepareWorkspace(lang) @@ -652,7 +670,6 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask> - mapping } @@ -695,8 +712,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask closurePaths) { + // Jumping through hoops to make docExtensions based upon closures to work. + closurePaths.add(getClassLocation(org.gradle.internal.scripts.ScriptOrigin)) + if (LegacyLevel.PRE_8_4 && !LegacyLevel.PRE_7_6) { + closurePaths.add(getClassLocation(org.gradle.api.GradleException)) + } + if (LegacyLevel.PRE_8_4 && !LegacyLevel.PRE_8_3) { + closurePaths.add(getInternalGradleLibraryLocation( + projectOperations, + ~/gradle-internal-instrumentation-api-([\d.]+).jar/ + )) + closurePaths.add(getInternalGradleLibraryLocation( + projectOperations, + ~/gradle-instrumentation-declarations-([\d.]+).jar/ + )) + } + if (!LegacyLevel.PRE_8_1 && LegacyLevel.PRE_8_4) { + closurePaths.add(getClassLocation(kotlin.io.FilesKt)) + closurePaths.add(getClassLocation(org.gradle.internal.lazy.Lazy)) + closurePaths.add(getInternalGradleLibraryLocation(projectOperations, ~/fastutil-([\d.]+)-min.jar/)) + } + } + // TODO: Try to do this without a detached configuration private FileCollection jrubyLessConfiguration(List deps) { Configuration cfg = detachedConfigurationCreator.apply(deps) diff --git a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AsciidoctorJExtension.groovy b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AsciidoctorJExtension.groovy index 8d986c72a..00b57d168 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AsciidoctorJExtension.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AsciidoctorJExtension.groovy @@ -28,6 +28,8 @@ import org.gradle.api.* import org.gradle.api.artifacts.* import org.gradle.api.artifacts.dsl.DependencyHandler import org.gradle.api.logging.LogLevel +import org.gradle.api.provider.Provider +import org.ysb33r.grolifant.api.core.LegacyLevel import java.util.concurrent.Callable import java.util.function.BiConsumer @@ -64,8 +66,8 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension { private static final String ASCIIDOCTOR_DEPENDENCY_PROPERTY_NAME = 'asciidoctorj' private static final String CONFIGURATION_NAME = "__\$\$${NAME}\$\$__" - // TODO: Kill this off -// private static final boolean GUAVA_REQUIRED_FOR_EXTERNALS = !LegacyLevel.PRE_4_8 + @SuppressWarnings(['SpaceAfterOpeningBrace', 'SpaceBeforeClosingBrace']) + private static final Closure EMPTY_CONFIGURATOR = {} private static final BiConsumer> DRD_VERSION_RESOLVER = { DependencyResolveDetails drd, Callable versionResolver -> @@ -76,7 +78,6 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension { private final Map options = [:] private final List jrubyRequires = [] private final List asciidoctorExtensions = [] -// private final List gemPaths = [] private final List warningsAsErrors = [] private final DefaultAsciidoctorJModules modules private final Configuration publicConfiguration @@ -89,9 +90,7 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension { private boolean onlyTaskExtensions = false private boolean onlyTaskWarnings = false private LogLevel logLevel -// private Boolean injectGuavaJar private boolean onlyTaskRequires = false -// private boolean onlyTaskGems = false /** Attach extension to a project. * @@ -118,8 +117,6 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension { 'Please report a bug at https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues' ) } -// this.configurations = project.configurations -// this.dependencies = project.dependencies this.modules.onUpdate { owner.updateConfiguration() } updateConfiguration() @@ -185,22 +182,126 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension { * Defines extensions to be registered. The given parameters should * either contain Asciidoctor Groovy DSL closures or files * with content conforming to the Asciidoctor Groovy DSL. + *

+ * If you use this method, then Gradle JARs will be leaked on to the classpath. This might not be what you + * want. + *

+ * @param Closures of Asciidoctor Groovy DSL extensions. * - * @since 2.2.0 + * @since 4.0.0 + */ + void docExtensions(Closure... exts) { + if (LegacyLevel.PRE_8_4) { + addExtensions(exts as List) + } else { + throw new GradleException( + 'Closures are not supported on Gradle 8.4+ due to Gradle instrumentation issues. ' + + 'Place the content in a string or load from it from a file instead.' + ) + } + } + + /** + * Defines extensions to be registered. The given parameters should + * either contain Asciidoctor Groovy DSL closures or files + * with content conforming to the Asciidoctor Groovy DSL. + * + * @param Files of Groovy code of Asciidoctor Groovy DSL extensions. + * + * @since 4.0.0 + */ + void docExtensions(File... exts) { + addExtensions(exts as List) + } + + /** + * Defines extensions to be registered. The given parameters should + * either contain Asciidoctor Groovy DSL closures or files + * with content conforming to the Asciidoctor Groovy DSL. + * + * @param Strings of Groovy code of Asciidoctor Groovy DSL extensions. + * + * @since 4.0.0 + */ + void docExtensions(String... exts) { + addExtensions(exts as List) + } + + /** + * Defines extensions to be registered. The given parameters should + * either contain Asciidoctor Groovy DSL closures or files + * with content conforming to the Asciidoctor Groovy DSL. + * + * @param Provider to strings or files of Groovy code of Asciidoctor Groovy DSL extensions + * + * @since 4.0.0 */ - void docExtensions(Object... exts) { - addExtensions(exts as List) + void docExtensions(Provider... exts) { + addExtensions(exts as List) + } + + /** + * Defines extensions to be registered. The given parameters should + * either contain Asciidoctor Groovy DSL closures or files + * with content conforming to the Asciidoctor Groovy DSL. + * + *

+ * THis method is specifically useful for project dependencies. + *

+ * @param Dependencies containing Asciidoctor extensions + * + * @since 4.0.0 + */ + void docExtensions(Dependency... exts) { + addExtensions(exts as List) + } + + /** + * Defines extensions to be registered. The given parameters should + * either contain Asciidoctor Groovy DSL closures or files + * with content conforming to the Asciidoctor Groovy DSL. + * + *

+ * THis method is specifically useful for project dependencies. + *

+ * @param Dependencies containing Asciidoctor extensions + * + * @since 4.0.0 + */ + void docExtensions(Project... exts) { + addExtensions(exts as List) + } + + /** + * Defines extensions to be registered. The given parameters should + * either contain Asciidoctor Groovy DSL closures or files + * with content conforming to the Asciidoctor Groovy DSL. + * + * @param External dependency definitions using standard Gradle dependency notation. + * + * @since 4.0.0 + */ + void docExtensionsFromExternal(String... exts) { + addExtensions(Transform.toList(exts as List) { + dependencyCreator.apply(it.toString(), EMPTY_CONFIGURATOR) + } as List) } /** * Clears the existing list of extensions and replace with a new set. * - * If this is declared on a task extension all extention from the global + * If this is declared on a task extension all extension from the global * project extension will be ignored. * * @since 2.2.0 */ void setDocExtensions(Iterable newExtensions) { + if (!LegacyLevel.PRE_8_4 && newExtensions.find { it instanceof Closure }) { + throw new GradleException( + 'Closures are no longer supported on Gradle 8.4+ due to Gradle instrumentation issues. ' + + 'Place content in a string or load from it from a file instead.' + ) + } asciidoctorExtensions.clear() addExtensions(newExtensions as List) onlyTaskExtensions = true @@ -261,58 +362,6 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension { ~/include file not found/ } -// /* ------------------------- -// tag::extension-property[] -// gemPaths:: One or more gem installation directories (separated by the system path separator). -// Use `gemPaths` to append. Use `setGemPaths` or `gemPaths=['path1','path2']` to overwrite. -// Use `asGemPath` to obtain a path string, separated by platform-specific separator. -// Type: `FileCollection`, but any collection of objects convertible with `project.files` can be passed -// Default: empty -// end::extension-property[] -// ------------------------- */ -// -// /** Returns the list of paths to be used for {@code GEM_HOME} -// * -// */ -// FileCollection getGemPaths() { -// if (!task || onlyTaskGems) { -// projectOperations.fsOperations.files(this.gemPaths) -// } else { -// projectOperations.fsOperations.files(this.gemPaths).from(extFromProject.gemPaths) -// } -// } -// -// /** Sets a new list of GEM paths to be used. -// * -// * @param paths Paths resolvable by {@ocde project.files} -// */ -// void setGemPaths(Iterable paths) { -// this.gemPaths.clear() -// this.gemPaths.addAll(paths) -// -// if (task) { -// this.onlyTaskGems = true -// } -// } -// -// /** Adds more paths for discovering GEMs. -// * -// * @param f Path objects that can be be converted with {@code project.file}. -// */ -// void gemPaths(Object... f) { -// this.gemPaths.addAll(f) -// } -// -// /** -// * Returns the list of paths to be used for GEM installations in a format that is -// * suitable for assignment to {@code GEM_HOME} -// * -// * Calling this will cause gemPath to be resolved immediately. -// */ -// String asGemPath() { -// getGemPaths().files*.toString().join(OS.pathSeparator) -// } - /* ------------------------- tag::extension-property[] jrubyVersion:: Minimum version of JRuby to be used. @@ -576,31 +625,6 @@ class AsciidoctorJExtension extends AbstractImplementationEngineExtension { this.version = v } -// /** Whether the Guava JAR that ships with the Gradle distribution should be injected into the -// * classpath for external AsciidoctorJ processes. -// * -// * If not set previously via {@link #setInjectInternalGuavaJar} then a default version depending of the version of -// * the Gradle distribution will be used. -// * -// * @return {@code true} if JAR should be injected. -// */ -// boolean getInjectInternalGuavaJar() { -// if (task) { -// this.injectGuavaJar == null ? extFromProject.injectInternalGuavaJar : this.injectGuavaJar -// } else { -// this.injectGuavaJar == null ? GUAVA_REQUIRED_FOR_EXTERNALS : this.injectGuavaJar -// } -// } - -// /** Whether the Guava JAR that ships with the Gradle distribution should be injected into the -// * classpath for external AsciidoctorJ processes. -// * -// * @param inject {@code true} if JAR should be injected. -// */ -// void setInjectInternalGuavaJar(boolean inject) { -// this.injectGuavaJar = inject -// } - /** * Returns a runConfiguration of the configured AsciidoctorJ dependencies. * diff --git a/jvm/src/test/groovy/org/asciidoctor/gradle/internal/JavaExecUtilsSpec.groovy b/jvm/src/test/groovy/org/asciidoctor/gradle/internal/JavaExecUtilsSpec.groovy deleted file mode 100644 index 6d4521b6d..000000000 --- a/jvm/src/test/groovy/org/asciidoctor/gradle/internal/JavaExecUtilsSpec.groovy +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2013-2024 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.asciidoctor.gradle.internal - -import org.gradle.api.invocation.Gradle -import spock.lang.Specification -import spock.lang.TempDir - -import static org.asciidoctor.gradle.internal.JavaExecUtils.getInternalGuavaLocation - -class JavaExecUtilsSpec extends Specification { - - @TempDir - File temporaryFolder - - void 'Throw exception if internal Guava cannot be found'() { - setup: - def gradle = Stub(Gradle) - gradle.gradleHomeDir >> temporaryFolder - - when: - getInternalGuavaLocation(gradle) - - then: - def e = thrown(JavaExecUtils.InternalGuavaLocationException) - e.message.contains('Cannot locate a Guava JAR in the Gradle distribution') - } - - void 'Throw exception if multiple internal Guava JARs are found'() { - setup: - def gradle = Stub(Gradle) - gradle.gradleHomeDir >> temporaryFolder - new File(temporaryFolder, 'lib').mkdirs() - new File(temporaryFolder, 'lib/guava-0.0-android.jar').text = '' - new File(temporaryFolder, 'lib/guava-0.1-android.jar').text = '' - - when: - getInternalGuavaLocation(gradle) - - then: - def e = thrown(JavaExecUtils.InternalGuavaLocationException) - e.message.contains('Found more than one Guava JAR in the Gradle distribution') - } - - void 'detect jre variant of guava'() { - setup: - def gradle = Stub(Gradle) - gradle.gradleHomeDir >> temporaryFolder - new File(temporaryFolder, 'lib').mkdirs() - new File(temporaryFolder, 'lib/guavasomething.jar') - def guavaJar = new File(temporaryFolder, 'lib/guava-30.0-jre.jar') - guavaJar.text = '' - - when: - def location = JavaExecUtils.getInternalGuavaLocation(gradle) - - then: - location == guavaJar - } -} From 967cd52a512520aa2b3431c9c2434f6c868cde65 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 23 Dec 2023 09:29:39 +0000 Subject: [PATCH 02/25] Add renovate.json --- renovate.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 renovate.json diff --git a/renovate.json b/renovate.json new file mode 100644 index 000000000..5db72dd6a --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ] +} From 1e3da3161a664b95609ab172158492f2007a9970 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:18:29 +0000 Subject: [PATCH 03/25] chore(deps): update plugin com.github.ben-manes.versions to v0.50.0 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 78631b639..ba9bbbf35 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ plugins { id 'net.nemerosa.versioning' version '2.6.1' apply false - id 'com.github.ben-manes.versions' version '0.17.0' apply false + id 'com.github.ben-manes.versions' version '0.50.0' apply false id 'com.github.hierynomus.license' version '0.16.1' apply false id 'com.github.kt3k.coveralls' version '2.8.2' apply false id 'net.ossindex.audit' version '0.1.1' apply false From f70c44b7dd3537689d04fe9f66cb9d84e39669f1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:16:41 +0000 Subject: [PATCH 04/25] fix(deps): update dependency org.ysb33r.gradle.jruby:jrubygradle-resolver to v1.0.1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 56651d6da..b9861031f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ grolifantVersion = 2.2.3 jacocoVersion = 0.8.6 codenarcVersion = 3.3.0 nodejsGradleVersion = 2.2.0 -pluginJrubySimpleVersion = 1.0.0 +pluginJrubySimpleVersion = 1.0.1 pluginPublishPlugin = 1.2.1 org.gradle.daemon = true From b245a8858ad1745520a0a16de7dc3fc7992eafa0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:12:41 +0000 Subject: [PATCH 05/25] chore(deps): update plugin org.ysb33r.gradletest to v3.0.0-alpha.4 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index ba9bbbf35..6e2ca636b 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ plugins { id 'org.ysb33r.os' version '0.9' apply false id 'org.ysb33r.cloudci' version '2.5' apply false id 'org.ysb33r.cloudci.appveyor.testreporter' version '2.5' apply false - id 'org.ysb33r.gradletest' version '3.0.0-alpha.3' apply false + id 'org.ysb33r.gradletest' version '3.0.0-alpha.4' apply false id 'idea' } From 796dfe3a591e9ea099135a7e7bf5c653c1339891 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:12:36 +0000 Subject: [PATCH 06/25] chore(deps): update plugin org.ajoberstar.git-publish to v2.1.3 --- docs/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build.gradle b/docs/build.gradle index 1f6487cdd..c9c67c35d 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -4,7 +4,7 @@ plugins { id 'idea' id 'org.asciidoctor.jvm.convert' apply false id 'org.asciidoctor.editorconfig' apply false - id 'org.ajoberstar.git-publish' version '2.1.1' apply false + id 'org.ajoberstar.git-publish' version '2.1.3' apply false } repositories { From 02600e754a2d9bb6b28d0c6be2a6a6ddce9c2aba Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:18:36 +0000 Subject: [PATCH 07/25] chore(deps): update plugin fi.linuxbox.download.worker to v0.4 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6e2ca636b..6b1e2371b 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ plugins { id 'com.github.kt3k.coveralls' version '2.8.2' apply false id 'net.ossindex.audit' version '0.1.1' apply false id 'org.kordamp.jdeps' version '0.2.0' apply false - id 'fi.linuxbox.download.worker' version '0.3' apply false + id 'fi.linuxbox.download.worker' version '0.4' apply false id 'org.ysb33r.ivypot' version '1.0.0' apply false id 'org.ysb33r.os' version '0.9' apply false id 'org.ysb33r.cloudci' version '2.5' apply false From 452369ed425e389b727dc6bc8c6a4388e28ea8ae Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:19:22 +0000 Subject: [PATCH 08/25] chore(deps): update actions/setup-java action to v4 --- .github/workflows/build.yml | 6 +++--- .github/workflows/push-documentation.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 008252632..81b3873b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: 11 distribution: zulu @@ -26,7 +26,7 @@ jobs: # use a short path to avoid exceeding the path limit on Windows... sigh with: path: 'w' - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: 11 distribution: zulu @@ -66,7 +66,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: ${{ matrix.java }} distribution: zulu diff --git a/.github/workflows/push-documentation.yml b/.github/workflows/push-documentation.yml index 0158979cd..aac5c9482 100644 --- a/.github/workflows/push-documentation.yml +++ b/.github/workflows/push-documentation.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: 11 distribution: zulu From c0a2c87a824486d9c791aa1d304c2ec468e4abba Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:18:43 +0000 Subject: [PATCH 09/25] chore(deps): update plugin net.ossindex.audit to v0.4.11 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 6b1e2371b..590de0ed3 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ plugins { id 'com.github.ben-manes.versions' version '0.50.0' apply false id 'com.github.hierynomus.license' version '0.16.1' apply false id 'com.github.kt3k.coveralls' version '2.8.2' apply false - id 'net.ossindex.audit' version '0.1.1' apply false + id 'net.ossindex.audit' version '0.4.11' apply false id 'org.kordamp.jdeps' version '0.2.0' apply false id 'fi.linuxbox.download.worker' version '0.4' apply false id 'org.ysb33r.ivypot' version '1.0.0' apply false From 75b24edf47f623f511df39001eadedd2fba5a429 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:18:50 +0000 Subject: [PATCH 10/25] chore(deps): update plugin org.ysb33r.cloudci to v2.7 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 590de0ed3..f7784b52a 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ plugins { id 'fi.linuxbox.download.worker' version '0.4' apply false id 'org.ysb33r.ivypot' version '1.0.0' apply false id 'org.ysb33r.os' version '0.9' apply false - id 'org.ysb33r.cloudci' version '2.5' apply false + id 'org.ysb33r.cloudci' version '2.7' apply false id 'org.ysb33r.cloudci.appveyor.testreporter' version '2.5' apply false id 'org.ysb33r.gradletest' version '3.0.0-alpha.4' apply false id 'idea' From 71eaee536408bd57a4e03f1f4d541b42682a76f9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:19:12 +0000 Subject: [PATCH 11/25] fix(deps): update dependency org.jsoup:jsoup to v1.17.2 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b9861031f..b2ed5d733 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ project_issues = https://github.com/asciidoctor/asciidoctor-gradle-plugin/i project_vcs = https://github.com/asciidoctor/asciidoctor-gradle-plugin.git cglibVersion = 3.3.0 -jsoupVersion = 1.13.1 +jsoupVersion = 1.17.2 spockVersion = 2.3-groovy-3.0 grolifantVersion = 2.2.3 jacocoVersion = 0.8.6 From bbe96b73abec79e6e5b1d1741886cbeeee74bd38 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:19:08 +0000 Subject: [PATCH 12/25] fix(deps): update dependency commons-io:commons-io to v2.15.1 --- testfixtures/jvm/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testfixtures/jvm/build.gradle b/testfixtures/jvm/build.gradle index c2f4f3c7d..e7b92d29a 100644 --- a/testfixtures/jvm/build.gradle +++ b/testfixtures/jvm/build.gradle @@ -15,7 +15,7 @@ dependencies { implementation gradleApi() implementation gradleTestKit() api "org.ysb33r.gradle:grolifant-herd:${agProject.versionOf('grolifant')}" - api 'commons-io:commons-io:2.6' + api 'commons-io:commons-io:2.15.1' implementation "org.jsoup:jsoup:$jsoupVersion" implementation "cglib:cglib-nodep:$cglibVersion" implementation("org.spockframework:spock-core:${agProject.versionOf('spock')}") { From d3b9a4625e488479400f0beaf66095d84790226d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 03:52:44 +0000 Subject: [PATCH 13/25] chore(deps): update plugin org.ysb33r.os to v0.10 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f7784b52a..e544b6d0f 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ plugins { id 'org.kordamp.jdeps' version '0.2.0' apply false id 'fi.linuxbox.download.worker' version '0.4' apply false id 'org.ysb33r.ivypot' version '1.0.0' apply false - id 'org.ysb33r.os' version '0.9' apply false + id 'org.ysb33r.os' version '0.10' apply false id 'org.ysb33r.cloudci' version '2.7' apply false id 'org.ysb33r.cloudci.appveyor.testreporter' version '2.5' apply false id 'org.ysb33r.gradletest' version '3.0.0-alpha.4' apply false From 91e391793fd294b714542d38fb0d433dbd52d804 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 03:54:02 +0000 Subject: [PATCH 14/25] chore(deps): update plugin org.ysb33r.os to v1 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e544b6d0f..9c3e2ebb5 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ plugins { id 'org.kordamp.jdeps' version '0.2.0' apply false id 'fi.linuxbox.download.worker' version '0.4' apply false id 'org.ysb33r.ivypot' version '1.0.0' apply false - id 'org.ysb33r.os' version '0.10' apply false + id 'org.ysb33r.os' version '1.0.0' apply false id 'org.ysb33r.cloudci' version '2.7' apply false id 'org.ysb33r.cloudci.appveyor.testreporter' version '2.5' apply false id 'org.ysb33r.gradletest' version '3.0.0-alpha.4' apply false From 179aa139bc4da8fa143e43f31d770931299edd36 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 03:52:58 +0000 Subject: [PATCH 15/25] chore(deps): update plugin org.ysb33r.cloudci.appveyor.testreporter to v4 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9c3e2ebb5..2aa37ba30 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ plugins { id 'org.ysb33r.ivypot' version '1.0.0' apply false id 'org.ysb33r.os' version '1.0.0' apply false id 'org.ysb33r.cloudci' version '2.7' apply false - id 'org.ysb33r.cloudci.appveyor.testreporter' version '2.5' apply false + id 'org.ysb33r.cloudci.appveyor.testreporter' version '4.0.0' apply false id 'org.ysb33r.gradletest' version '3.0.0-alpha.4' apply false id 'idea' } From 19181dd04b16ffc74d1509bee79caa7e261dafdc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:59:40 +0000 Subject: [PATCH 16/25] chore(deps): update plugin org.ajoberstar.git-publish to v4 --- docs/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build.gradle b/docs/build.gradle index c9c67c35d..04015387d 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -4,7 +4,7 @@ plugins { id 'idea' id 'org.asciidoctor.jvm.convert' apply false id 'org.asciidoctor.editorconfig' apply false - id 'org.ajoberstar.git-publish' version '2.1.3' apply false + id 'org.ajoberstar.git-publish' version '4.2.1' apply false } repositories { From 7da09d6a66f7c2c86a0bfe7290cfc85b8d2c457d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 02:58:53 +0000 Subject: [PATCH 17/25] chore(deps): update plugin net.nemerosa.versioning to v2.15.1 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2aa37ba30..4e1dfece2 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ */ plugins { - id 'net.nemerosa.versioning' version '2.6.1' apply false + id 'net.nemerosa.versioning' version '2.15.1' apply false id 'com.github.ben-manes.versions' version '0.50.0' apply false id 'com.github.hierynomus.license' version '0.16.1' apply false id 'com.github.kt3k.coveralls' version '2.8.2' apply false From 811e379a47f74eecc96adf4f1dbdcc090b6c46b5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 06:34:47 +0000 Subject: [PATCH 18/25] chore(deps): update plugin com.github.kt3k.coveralls to v2.12.2 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4e1dfece2..77ccd1f1f 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ plugins { id 'net.nemerosa.versioning' version '2.15.1' apply false id 'com.github.ben-manes.versions' version '0.50.0' apply false id 'com.github.hierynomus.license' version '0.16.1' apply false - id 'com.github.kt3k.coveralls' version '2.8.2' apply false + id 'com.github.kt3k.coveralls' version '2.12.2' apply false id 'net.ossindex.audit' version '0.4.11' apply false id 'org.kordamp.jdeps' version '0.2.0' apply false id 'fi.linuxbox.download.worker' version '0.4' apply false From 35ee0351c590f06aefaa7669142b6b9faae2286a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 06:34:56 +0000 Subject: [PATCH 19/25] chore(deps): update plugin org.ysb33r.cloudci to v4 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 77ccd1f1f..395d16324 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ plugins { id 'fi.linuxbox.download.worker' version '0.4' apply false id 'org.ysb33r.ivypot' version '1.0.0' apply false id 'org.ysb33r.os' version '1.0.0' apply false - id 'org.ysb33r.cloudci' version '2.7' apply false + id 'org.ysb33r.cloudci' version '4.0.0' apply false id 'org.ysb33r.cloudci.appveyor.testreporter' version '4.0.0' apply false id 'org.ysb33r.gradletest' version '3.0.0-alpha.4' apply false id 'idea' From 39a4fff7dd4608bb31311571241be10219f9f369 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 9 Jan 2024 14:47:29 +0800 Subject: [PATCH 20/25] chore(deps): update actions/checkout action to v4 * chore(deps): update actions/checkout action to v4 * Remove workaround --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Goooler --- .github/workflows/build.yml | 9 +++------ .github/workflows/push-documentation.yml | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81b3873b4..1e5585c66 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: java-version: 11 @@ -22,10 +22,7 @@ jobs: build-windows: runs-on: windows-latest steps: - - uses: actions/checkout@v1 - # use a short path to avoid exceeding the path limit on Windows... sigh - with: - path: 'w' + - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: java-version: 11 @@ -65,7 +62,7 @@ jobs: # java: [ 8, 11 ] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: java-version: ${{ matrix.java }} diff --git a/.github/workflows/push-documentation.yml b/.github/workflows/push-documentation.yml index aac5c9482..3ef6e33cd 100644 --- a/.github/workflows/push-documentation.yml +++ b/.github/workflows/push-documentation.yml @@ -7,7 +7,7 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: java-version: 11 From 20afba2da95fdc23b15bbe2f3a4be299a00d9457 Mon Sep 17 00:00:00 2001 From: Zongle Wang Date: Tue, 9 Jan 2024 14:53:27 +0800 Subject: [PATCH 21/25] Enable Gradle caching flag --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index b2ed5d733..c8b9c2174 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ nodejsGradleVersion = 2.2.0 pluginJrubySimpleVersion = 1.0.1 pluginPublishPlugin = 1.2.1 -org.gradle.daemon = true +org.gradle.caching = true org.gradle.parallel = true org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=768m From ce6f35512a40c2ef4979a83e4d5532b336f16f32 Mon Sep 17 00:00:00 2001 From: Goooler Date: Tue, 9 Jan 2024 15:15:26 +0800 Subject: [PATCH 22/25] Tweak gradle-build-action usages --- .github/workflows/build.yml | 62 +++++++++--------------- .github/workflows/push-documentation.yml | 16 +++--- 2 files changed, 29 insertions(+), 49 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e5585c66..e886629f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,16 +9,13 @@ jobs: with: java-version: 11 distribution: zulu - # Licensing - - name: Licensing - uses: gradle/gradle-build-action@v2 + - uses: gradle/gradle-build-action@v2 with: - arguments: --console=plain -S license - # Coding style + gradle-home-cache-cleanup: true + - name: Licensing + run: ./gradlew --console=plain -S license - name: Coding style - uses: gradle/gradle-build-action@v2 - with: - arguments: --console=plain -S codenarcAll + run: ./gradlew --console=plain -S codenarcAll build-windows: runs-on: windows-latest steps: @@ -27,32 +24,27 @@ jobs: with: java-version: 11 distribution: zulu + - uses: gradle/gradle-build-action@v2 + with: + gradle-home-cache-cleanup: true - name: Cache offline repository uses: actions/cache@v3 with: path: testfixtures/offline-repo/build/repo key: ${{ runner.os }}-offline-repo-${{ hashFiles('module-versions.properties') }} restore-keys: ${{ runner.os }}-offline-repo- - # Build - name: Build offline repository - uses: gradle/gradle-build-action@v2 - with: - arguments: --console=plain --no-build-cache :testfixtures-offline-repo:buildOfflineRepositories + run: ./gradlew --console=plain --no-build-cache :testfixtures-offline-repo:buildOfflineRepositories - name: Build - uses: gradle/gradle-build-action@v2 - with: - arguments: --console=plain --warning-mode=all -s clean assemble - # Test + run: ./gradlew --console=plain --warning-mode=all -s clean assemble # TODO: Resolve the gem integration test issue. See https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/694 - name: Test - uses: gradle/gradle-build-action@v2 - with: - arguments: --console=plain --warning-mode=all -s check --no-parallel -Djava.net.preferIPv4Stack=true -x gradleTest -x :asciidoctor-gradle-jvm-gems:IntTest --scan + run: ./gradlew --console=plain --warning-mode=all -s check --no-parallel -x gradleTest -x :asciidoctor-gradle-jvm-gems:IntTest --scan + env: + JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true # Stop gradlew to avoid locking issues - name: Cleanup - uses: gradle/gradle-build-action@v2 - with: - arguments: --stop + run: ./gradlew --stop build: strategy: matrix: @@ -67,6 +59,9 @@ jobs: with: java-version: ${{ matrix.java }} distribution: zulu + - uses: gradle/gradle-build-action@v2 + with: + gradle-home-cache-cleanup: true - name: Cache offline repository uses: actions/cache@v3 with: @@ -74,28 +69,15 @@ jobs: key: ${{ runner.os }}-offline-repo-${{ hashFiles('module-versions.properties') }} restore-keys: ${{ runner.os }}-offline-repo- - name: Build offline repository - uses: gradle/gradle-build-action@v2 - with: - arguments: --console=plain --no-build-cache :testfixtures-offline-repo:buildOfflineRepositories - # Build + run: ./gradlew --console=plain --no-build-cache :testfixtures-offline-repo:buildOfflineRepositories - name: Build - uses: gradle/gradle-build-action@v2 - with: - arguments: -i -S --console=plain --no-build-cache assemble - # Integration tests + run: ./gradlew -i -S --console=plain --no-build-cache assemble - name: Integration tests (without slides) - uses: gradle/gradle-build-action@v2 - with: - arguments: -i -s --console=plain --no-build-cache test intTest remoteTest --scan + run: ./gradlew -i -s --console=plain --no-build-cache test intTest remoteTest --scan # arguments: -i -s --console=plain --no-build-cache test intTest remoteTest -x asciidoctor-gradle-jvm-slides:intTest # arguments: -i -s --console=plain --no-build-cache test intTest remoteTest -x asciidoctor-gradle-slides-export:intTest -x asciidoctor-gradle-jvm-slides:intTest # TODO: See https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/695 # - name: Integration tests (slides only) -# uses: eskatos/gradle-command-action@v2 -# with: -# arguments: -i -s --console=plain --no-build-cache test asciidoctor-gradle-jvm-slides:intTest asciidoctor-gradle-slides-export:intTest - # Gradle tests +# uses: ./gradlew -i -s --console=plain --no-build-cache test asciidoctor-gradle-jvm-slides:intTest asciidoctor-gradle-slides-export:intTest - name: Gradle tests - uses: gradle/gradle-build-action@v2 - with: - arguments: -i -s --console=plain --no-build-cache gradleTest --scan + run: ./gradlew -i -s --console=plain --no-build-cache gradleTest --scan diff --git a/.github/workflows/push-documentation.yml b/.github/workflows/push-documentation.yml index 3ef6e33cd..84655636b 100644 --- a/.github/workflows/push-documentation.yml +++ b/.github/workflows/push-documentation.yml @@ -12,16 +12,14 @@ jobs: with: java-version: 11 distribution: zulu - - name: Combine documentation - uses: gradle/gradle-build-action@v2 + - uses: gradle/gradle-build-action@v2 with: - build-root-directory: docs - arguments: --console=plain -q combineDocs + gradle-home-cache-cleanup: true + - run: cd docs + - name: Combine documentation + run: ./gradlew --console=plain -q combineDocs - name: Publish documentation - uses: gradle/gradle-build-action@v2 - with: - build-root-directory: docs - arguments: "--console=plain --info :antora:publishDocs :gh-pages:publishDocs + run: ./gradlew --console=plain --info :antora:publishDocs :gh-pages:publishDocs -Dorg.ajoberstar.grgit.auth.username=${{ secrets.GITHUB_PUBLISH_USER }} -Dorg.ajoberstar.grgit.auth.password=${{ secrets.GITHUB_PUBLISH_KEY }} - -Dorg.ajoberstar.grgit.auth.force=hardcoded" + -Dorg.ajoberstar.grgit.auth.force=hardcoded From 5f041e347caa44462588718cd7558811c79adf90 Mon Sep 17 00:00:00 2001 From: Abel Salgado Romero Date: Tue, 9 Jan 2024 14:00:23 +0100 Subject: [PATCH 23/25] Set Java Toolchain to enforce module JVM to 8 Otherwise the value of 'org.gradle.jvm.version' is set to the JVM used during build Fixes #702 --- build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle b/build.gradle index 395d16324..ac381bd8e 100644 --- a/build.gradle +++ b/build.gradle @@ -150,6 +150,12 @@ subprojects { targetCompatibility = project.targetCompatibility } + java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } + } + project.tasks.withType(Test) { testLogging { afterSuite { desc, result -> From d60b01196f7536f10bb720a6e170e16b5e4bade4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 9 Jan 2024 23:11:35 +0800 Subject: [PATCH 24/25] Gradle 7.6.3 * chore(deps): update dependency gradle to v7.6.3 * Migrate Copy task * Remove outdated Gradle version checkers * Try to fix `Can generate a asciidoctorconfigfile` * Remove sourceCompatibility & targetCompatibility after using toolchain --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Goooler --- .../AsciidoctorEditorConfigIntegrationSpec.groovy | 7 +++++-- .../org/asciidoctor/gradle/base/AsciidoctorUtils.groovy | 3 --- .../gradle/base/internal/DeprecatedFeatures.groovy | 4 +--- build.gradle | 5 ----- .../src/main/groovy/AsciidoctorGradleGroovyProject.groovy | 4 ++-- gradle.properties | 2 -- gradle/wrapper/gradle-wrapper.properties | 2 +- .../slides/export/base/AbstractExportBaseTask.groovy | 7 +------ 8 files changed, 10 insertions(+), 24 deletions(-) diff --git a/asciidoctoreditorconfig/src/intTest/groovy/org/asciidoctor/gradle/editorconfig/AsciidoctorEditorConfigIntegrationSpec.groovy b/asciidoctoreditorconfig/src/intTest/groovy/org/asciidoctor/gradle/editorconfig/AsciidoctorEditorConfigIntegrationSpec.groovy index 4711b45dc..cc9a89c5a 100644 --- a/asciidoctoreditorconfig/src/intTest/groovy/org/asciidoctor/gradle/editorconfig/AsciidoctorEditorConfigIntegrationSpec.groovy +++ b/asciidoctoreditorconfig/src/intTest/groovy/org/asciidoctor/gradle/editorconfig/AsciidoctorEditorConfigIntegrationSpec.groovy @@ -34,9 +34,12 @@ class AsciidoctorEditorConfigIntegrationSpec extends FunctionalSpecification { File attrFile = new File(projectDir, 'inputs.adoc') attrFile.text = ":${key3}: ${value3}\n" + new File(projectDir, 'gradle.properties').text = """ + group=${groupName} + version=${projVer} + """.stripIndent() + getGroovyBuildFile(""" - group = '${groupName}' - version = '${projVer}' apply plugin : 'org.asciidoctor.jvm.base' asciidoctorj { diff --git a/base/src/main/groovy/org/asciidoctor/gradle/base/AsciidoctorUtils.groovy b/base/src/main/groovy/org/asciidoctor/gradle/base/AsciidoctorUtils.groovy index 20f36750a..32beaa4d2 100644 --- a/base/src/main/groovy/org/asciidoctor/gradle/base/AsciidoctorUtils.groovy +++ b/base/src/main/groovy/org/asciidoctor/gradle/base/AsciidoctorUtils.groovy @@ -27,7 +27,6 @@ import org.gradle.api.provider.Property import org.gradle.api.provider.Provider import org.gradle.api.specs.Spec import org.gradle.api.tasks.util.PatternSet -import org.gradle.util.GradleVersion import org.ysb33r.grolifant.api.core.OperatingSystem import org.ysb33r.grolifant.api.core.ProjectOperations @@ -48,8 +47,6 @@ class AsciidoctorUtils { public static final OperatingSystem OS = OperatingSystem.current() public static final String UNDERSCORE_LED_FILES = '**/_*' public static final PatternSet UNDERSCORE_LED_PATTERN = new PatternSet().include(UNDERSCORE_LED_FILES) - public static final boolean GRADLE_LT_5_0 = GradleVersion.current() < GradleVersion.version('5.0') - public static final boolean GRADLE_LT_5_1 = GradleVersion.current() < GradleVersion.version('5.1') static final Spec ACCEPT_ONLY_FILES = new Spec() { @Override diff --git a/base/src/main/groovy/org/asciidoctor/gradle/base/internal/DeprecatedFeatures.groovy b/base/src/main/groovy/org/asciidoctor/gradle/base/internal/DeprecatedFeatures.groovy index c6d207a70..b1bf24b54 100644 --- a/base/src/main/groovy/org/asciidoctor/gradle/base/internal/DeprecatedFeatures.groovy +++ b/base/src/main/groovy/org/asciidoctor/gradle/base/internal/DeprecatedFeatures.groovy @@ -21,7 +21,6 @@ import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.plugins.ExtraPropertiesExtension -import org.gradle.util.GradleVersion /** * A simplified way of grouping deprecation messages. @@ -36,8 +35,7 @@ class DeprecatedFeatures implements Plugin { private static final String EXTENSION_NAME = '$$asciidoctor-deprecated-features$$' private static final String BASE_MESSAGE = 'You are using one or more deprecated Asciidoctor Gradle plugin features.' - private static final boolean GRADLE_4_5_OR_LATER = GradleVersion.current() >= GradleVersion.version('4.5') - private static final String COMMAND_LINE = GRADLE_4_5_OR_LATER ? '--warning-mode=all' : '-i or --info' + private static final String COMMAND_LINE = '--warning-mode=all' static void addDeprecationMessage(Project project, String identifier, String message) { try { diff --git a/build.gradle b/build.gradle index ac381bd8e..9e67e2716 100644 --- a/build.gradle +++ b/build.gradle @@ -145,11 +145,6 @@ subprojects { } } - compileGroovy { - sourceCompatibility = project.sourceCompatibility - targetCompatibility = project.targetCompatibility - } - java { toolchain { languageVersion = JavaLanguageVersion.of(8) diff --git a/buildSrc/src/main/groovy/AsciidoctorGradleGroovyProject.groovy b/buildSrc/src/main/groovy/AsciidoctorGradleGroovyProject.groovy index 1bdb1f11b..cf9f97c75 100644 --- a/buildSrc/src/main/groovy/AsciidoctorGradleGroovyProject.groovy +++ b/buildSrc/src/main/groovy/AsciidoctorGradleGroovyProject.groovy @@ -29,8 +29,8 @@ class AsciidoctorGradleGroovyProject implements Plugin { SourceSetContainer sourceSets = project.extensions.getByType(SourceSetContainer) SourceSet main = sourceSets.getByName('main') - project.tasks.named(main.processResourcesTaskName).configure { Copy copy -> - copy.from generateModuleVersions, { CopySpec cs -> + project.tasks.named(main.processResourcesTaskName, Copy).configure { copy -> + copy.from(generateModuleVersions.get().outputs.files) { CopySpec cs -> cs.into "${ModuleVersions.INTERMEDIATE_FOLDER_PATH}" } } diff --git a/gradle.properties b/gradle.properties index c8b9c2174..3d7cd2cb4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,5 @@ version = 4.0.1 group = org.asciidoctor -sourceCompatibility = 1.8 -targetCompatibility = 1.8 copyrightYear = 2013-2024 project_description = A Gradle plugin suite that uses Asciidoctor via JRuby/Node.js to process AsciiDoc source files within the project. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0f80bbf51..068cdb2dc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/slides-export/src/main/groovy/org/asciidoctor/gradle/slides/export/base/AbstractExportBaseTask.groovy b/slides-export/src/main/groovy/org/asciidoctor/gradle/slides/export/base/AbstractExportBaseTask.groovy index fc3b0e2c8..ece96d51c 100644 --- a/slides-export/src/main/groovy/org/asciidoctor/gradle/slides/export/base/AbstractExportBaseTask.groovy +++ b/slides-export/src/main/groovy/org/asciidoctor/gradle/slides/export/base/AbstractExportBaseTask.groovy @@ -29,12 +29,10 @@ import org.gradle.api.provider.Provider import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.Internal -import org.gradle.api.tasks.Optional import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.PathSensitive import org.gradle.api.tasks.SkipWhenEmpty import org.gradle.api.tasks.options.Option -import org.gradle.util.GradleVersion import org.ysb33r.grolifant.api.core.ProjectOperations import java.util.concurrent.Callable @@ -46,7 +44,6 @@ import static org.gradle.api.tasks.PathSensitivity.RELATIVE */ @CompileStatic abstract class AbstractExportBaseTask extends DefaultTask { - private final static boolean GRADLE_GE_4_8 = GradleVersion.current() >= GradleVersion.version('4.8') private final static String HTML_EXT = '.html' private final List slideInputFiles = [] private final ProjectOperations projectOperations @@ -280,10 +277,8 @@ abstract class AbstractExportBaseTask extends DefaultTask { dependsOn tasks.findAll { if (it instanceof Task) { true - } else if (GRADLE_GE_4_8) { - it instanceof org.gradle.api.tasks.TaskProvider } else { - false + it instanceof org.gradle.api.tasks.TaskProvider } }.toSet() } From c0486193b8616dc366eaa3ea1e55cc6729288ccc Mon Sep 17 00:00:00 2001 From: Goooler Date: Tue, 9 Jan 2024 23:32:32 +0800 Subject: [PATCH 25/25] Tweak checkTaskDependencies --- .../slides/export/base/AbstractExportBaseTask.groovy | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/slides-export/src/main/groovy/org/asciidoctor/gradle/slides/export/base/AbstractExportBaseTask.groovy b/slides-export/src/main/groovy/org/asciidoctor/gradle/slides/export/base/AbstractExportBaseTask.groovy index ece96d51c..5fa251b53 100644 --- a/slides-export/src/main/groovy/org/asciidoctor/gradle/slides/export/base/AbstractExportBaseTask.groovy +++ b/slides-export/src/main/groovy/org/asciidoctor/gradle/slides/export/base/AbstractExportBaseTask.groovy @@ -15,7 +15,6 @@ */ package org.asciidoctor.gradle.slides.export.base -import groovy.transform.CompileDynamic import groovy.transform.CompileStatic import org.asciidoctor.gradle.base.AbstractAsciidoctorBaseTask import org.asciidoctor.gradle.base.AsciidoctorUtils @@ -32,6 +31,7 @@ import org.gradle.api.tasks.Internal import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.PathSensitive import org.gradle.api.tasks.SkipWhenEmpty +import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.options.Option import org.ysb33r.grolifant.api.core.ProjectOperations @@ -272,14 +272,9 @@ abstract class AbstractExportBaseTask extends DefaultTask { this.projectOperations } - @CompileDynamic private void checkTaskDependencies(Iterable tasks) { dependsOn tasks.findAll { - if (it instanceof Task) { - true - } else { - it instanceof org.gradle.api.tasks.TaskProvider - } - }.toSet() + it instanceof Task || it instanceof TaskProvider + } } }