From 97e6e3daaca2c645ef1110f0b899501405970694 Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Fri, 12 Apr 2024 16:19:49 -0500 Subject: [PATCH 01/16] Remove asciidoctorj from AbstractAsciidoctorTask --- .../org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy | 1 - 1 file changed, 1 deletion(-) 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 2d7c3c387..011172dd2 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -93,7 +93,6 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask asciidocConfigurations = [] From 008d6af033c31fd3278a7d26a35c96b0d6705de1 Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Fri, 12 Apr 2024 16:52:11 -0500 Subject: [PATCH 02/16] Add optionsProperty and attributesProperty to AbstractAsciidoctorTask to replace references to asciidoctorj.options and asciidoctorj.attributes --- .../gradle/jvm/AbstractAsciidoctorTask.groovy | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) 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 011172dd2..6fd3caafb 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -38,10 +38,12 @@ import org.asciidoctor.gradle.internal.ExecutorUtils import org.asciidoctor.gradle.internal.JavaExecUtils import org.asciidoctor.gradle.remote.AsciidoctorJavaExec import org.gradle.api.Action +import org.gradle.api.GradleException import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.ConfigurationContainer import org.gradle.api.artifacts.Dependency import org.gradle.api.file.FileCollection +import org.gradle.api.provider.MapProperty import org.gradle.api.provider.Property import org.gradle.api.provider.Provider import org.gradle.api.tasks.Classpath @@ -103,6 +105,9 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask jvmClasspath private final List> gemJarProviders = [] + private final MapProperty optionsProperty = project.objects.mapProperty(String, Object) + private final MapProperty attributesProperty = project.objects.mapProperty(String, Object) + @Delegate private final DefaultAsciidoctorFileOperations asciidoctorTaskFileOperations @@ -221,7 +226,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getOptions() { - resolveAsCacheable(asciidoctorj.options, projectOperations) + resolveAsCacheable(optionsProperty.get(), projectOperations) } /** Apply a new set of Asciidoctor options, clearing any options previously set. @@ -233,7 +238,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getAttributes() { - resolveAsCacheable(asciidoctorj.attributes, projectOperations) + resolveAsCacheable(attributesProperty.get(), projectOperations) } /** Apply a new set of Asciidoctor options, clearing any options previously set. @@ -267,7 +279,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask, Configuration> - inputs.files(this.asciidoctorj.configuration) + inputs.files(asciidoctorj.configuration) inputs.files { gemJarProviders }.withPathSensitivity(RELATIVE) inputs.property 'backends', { -> backends() } inputs.property 'asciidoctorj-version', { -> asciidoctorj.version } From 2ebef2a0a466f494de3378ed944ce0c07dea10d1 Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Mon, 15 Apr 2024 16:43:26 -0500 Subject: [PATCH 03/16] Replace references to extension in task --- .../gradle/jvm/AbstractAsciidoctorTask.groovy | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) 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 6fd3caafb..05abe4c7b 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -22,6 +22,7 @@ import org.asciidoctor.gradle.base.AsciidoctorTaskFileOperations import org.asciidoctor.gradle.base.AsciidoctorTaskMethods import org.asciidoctor.gradle.base.AsciidoctorTaskOutputOptions import org.asciidoctor.gradle.base.AsciidoctorTaskWorkspacePreparation +import org.asciidoctor.gradle.base.SafeMode import org.asciidoctor.gradle.base.Transform import org.asciidoctor.gradle.base.internal.DefaultAsciidoctorBaseDirConfiguration import org.asciidoctor.gradle.base.internal.DefaultAsciidoctorFileOperations @@ -43,6 +44,8 @@ import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.ConfigurationContainer import org.gradle.api.artifacts.Dependency import org.gradle.api.file.FileCollection +import org.gradle.api.logging.LogLevel +import org.gradle.api.provider.ListProperty import org.gradle.api.provider.MapProperty import org.gradle.api.provider.Property import org.gradle.api.provider.Provider @@ -62,6 +65,7 @@ import org.ysb33r.grolifant.api.core.runnable.AbstractJvmModelExecTask import org.ysb33r.grolifant.api.remote.worker.WorkerAppExecutorFactory import java.util.function.Function +import java.util.regex.Pattern import static org.asciidoctor.gradle.base.AsciidoctorUtils.getClassLocation import static org.asciidoctor.gradle.base.internal.AsciidoctorAttributes.evaluateProviders @@ -107,6 +111,14 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask optionsProperty = project.objects.mapProperty(String, Object) private final MapProperty attributesProperty = project.objects.mapProperty(String, Object) + private final ListProperty attributeProviderProperty = project.objects.listProperty(AsciidoctorAttributeProvider) + @Classpath + private FileCollection configurationsFileCollection + private final ListProperty fatalWarningsProperty = project.objects.listProperty(Pattern) + private final ListProperty requiresProperty = project.objects.listProperty(String) + private final Property logLevelProperty = project.objects.property(LogLevel) + private final Property safeModeProperty = project.objects.property(SafeMode) + private final ListProperty docExtensionsProperty = project.objects.listProperty(Object) @Delegate private final DefaultAsciidoctorFileOperations asciidoctorTaskFileOperations @@ -303,7 +315,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getAttributeProviders() { - asciidoctorj.attributeProviders + attributeProviderProperty.get() } /** Returns all of the specified configurations as a collections of files. @@ -312,11 +324,10 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask seed + projectOperations.configurations.asConfiguration(it) } @@ -439,7 +450,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getAsciidoctorJExtensions() { - asciidoctorj.docExtensions + docExtensionsProperty.get() } @Nested @@ -718,7 +735,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask deps = asciidoctorj.docExtensions.findAll { + List deps = this.docExtensionsProperty.get().findAll { it instanceof Dependency } as List @@ -784,7 +801,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask findExtensionClosures() { - asciidoctorj.docExtensions.findAll { + this.docExtensionsProperty.get().findAll { it instanceof Closure } as List } From 77ba88c16e301394a040af79d6324e4b192551dc Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Wed, 8 May 2024 10:59:16 -0500 Subject: [PATCH 04/16] Solve CC issues - still not rendering document --- .../gradle/jvm/AbstractAsciidoctorTask.groovy | 67 +++++++++++++------ 1 file changed, 47 insertions(+), 20 deletions(-) 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 05abe4c7b..b9328330e 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -57,6 +57,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.jcodings.util.Hash import org.ysb33r.grolifant.api.core.LegacyLevel import org.ysb33r.grolifant.api.core.jvm.ExecutionMode import org.ysb33r.grolifant.api.core.jvm.JavaForkOptionsWithEnvProvider @@ -66,6 +67,7 @@ import org.ysb33r.grolifant.api.remote.worker.WorkerAppExecutorFactory import java.util.function.Function import java.util.regex.Pattern +import java.util.stream.Collectors import static org.asciidoctor.gradle.base.AsciidoctorUtils.getClassLocation import static org.asciidoctor.gradle.base.internal.AsciidoctorAttributes.evaluateProviders @@ -109,16 +111,40 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask jvmClasspath private final List> gemJarProviders = [] - private final MapProperty optionsProperty = project.objects.mapProperty(String, Object) - private final MapProperty attributesProperty = project.objects.mapProperty(String, Object) - private final ListProperty attributeProviderProperty = project.objects.listProperty(AsciidoctorAttributeProvider) + protected final MapProperty optionsProperty = project.objects.mapProperty(String, Object) + protected final MapProperty attributesProperty = project.objects.mapProperty(String, Object) + public final ListProperty attributeProviderProperty = project.objects.listProperty(AsciidoctorAttributeProvider) @Classpath - private FileCollection configurationsFileCollection - private final ListProperty fatalWarningsProperty = project.objects.listProperty(Pattern) - private final ListProperty requiresProperty = project.objects.listProperty(String) - private final Property logLevelProperty = project.objects.property(LogLevel) - private final Property safeModeProperty = project.objects.property(SafeMode) - private final ListProperty docExtensionsProperty = project.objects.listProperty(Object) + protected FileCollection configurationsFileCollection + protected final ListProperty fatalWarningsProperty = project.objects.listProperty(Pattern) + protected final ListProperty requiresProperty = project.objects.listProperty(String) + protected final Property logLevelProperty = project.objects.property(LogLevel) + protected final Property safeModeProperty = project.objects.property(SafeMode) + protected final ListProperty docExtensionsProperty = project.objects.listProperty(Object) + + @Internal + private AsciidoctorJExtension getAsciidoctorJExtension() { + extensions.getByName(AsciidoctorJExtension.NAME) as AsciidoctorJExtension + } + + private final Provider jrubyLessDependenciesProvider = project.provider { + List deps = this.docExtensionsProperty.get().findAll { + it instanceof Dependency + } as List + Configuration cfg = detachedConfigurationCreator.apply(deps) + getAsciidoctorJExtension().loadJRubyResolutionStrategy(cfg) + } + + private final Provider>> attributesByLangProvider = project.provider { + def attributesByLang = new HashMap>() + languagesAsOptionals.each { lang -> + if (lang.isPresent()) { + attributesByLang.put(lang.get(), getAsciidoctorJExtension().getAttributesForLang(lang.get())) + } + } + attributesByLang + } as Provider>> + @Delegate private final DefaultAsciidoctorFileOperations asciidoctorTaskFileOperations @@ -303,7 +329,8 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getReportableConfigurations() { - ([asciidoctorj.configuration] + projectOperations.configurations.asConfigurations(asciidocConfigurations)) + (/*[asciidoctorj.configuration] +*/ projectOperations.configurations.asConfigurations(asciidocConfigurations)) .toSet() } @@ -512,7 +539,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask, Configuration> inputs.files(asciidoctorj.configuration) - inputs.files { gemJarProviders }.withPathSensitivity(RELATIVE) +// inputs.files { gemJarProviders }.withPathSensitivity(RELATIVE) inputs.property 'backends', { -> backends() } inputs.property 'asciidoctorj-version', { -> asciidoctorj.version } inputs.property 'jruby-version', { -> asciidoctorj.jrubyVersion ?: '' } @@ -751,11 +778,11 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask deps) { - Configuration cfg = detachedConfigurationCreator.apply(deps) - asciidoctorj.loadJRubyResolutionStrategy(cfg) - cfg - } +// private FileCollection jrubyLessConfiguration(List deps) { +// Configuration cfg = detachedConfigurationCreator.apply(deps) +// asciidoctorj.loadJRubyResolutionStrategy(cfg) +// cfg +// } private Map preparePreserialisedAttributes(final File workingSourceDir, Optional lang) { prepareAttributes( projectOperations.stringTools, attributes, - (lang.present ? asciidoctorj.getAttributesForLang(lang.get()) : [:]), + (lang.present ? attributesByLangProvider.get().getOrDefault(lang.get(), [:]) : [:]), // THIS IS NULL getTaskSpecificDefaultAttributes(workingSourceDir) as Map, attributeProviders, lang From ba468e603efa3b37688363b517bdc407a978dcce Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Wed, 8 May 2024 16:34:22 -0500 Subject: [PATCH 05/16] Set safemodeProperty and logLevelProperty --- .../org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 b9328330e..ca0ac3292 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -519,12 +519,13 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask Date: Tue, 14 May 2024 18:32:27 -0500 Subject: [PATCH 06/16] Beginning cleanup --- .../gradle/jvm/AbstractAsciidoctorTask.groovy | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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 ca0ac3292..cb05970cf 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -57,7 +57,6 @@ 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.jcodings.util.Hash import org.ysb33r.grolifant.api.core.LegacyLevel import org.ysb33r.grolifant.api.core.jvm.ExecutionMode import org.ysb33r.grolifant.api.core.jvm.JavaForkOptionsWithEnvProvider @@ -342,7 +341,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getAttributeProviders() { - attributeProviderProperty.get() + attributeProviderProperty.get().stream().collect(Collectors.toList()) } /** Returns all of the specified configurations as a collections of files. @@ -539,8 +538,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask, Configuration> - inputs.files(asciidoctorj.configuration) -// inputs.files { gemJarProviders }.withPathSensitivity(RELATIVE) + inputs.files { gemJarProviders }.withPathSensitivity(RELATIVE) inputs.property 'backends', { -> backends() } inputs.property 'asciidoctorj-version', { -> asciidoctorj.version } inputs.property 'jruby-version', { -> asciidoctorj.jrubyVersion ?: '' } @@ -645,9 +643,9 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getAsciidoctorJExtensions() { - docExtensionsProperty.get() + docExtensionsProperty.get().stream().collect(Collectors.toList()) } @Nested From 14442baa9dd0541d4ba7f92fe0de6b386747f170 Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Mon, 20 May 2024 11:19:45 -0500 Subject: [PATCH 07/16] Fixed detachedConfigurationCreator config cache issue --- .../gradle/jvm/AbstractAsciidoctorTask.groovy | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) 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 cb05970cf..de0cad66b 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -106,7 +106,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask, Configuration> detachedConfigurationCreator +// private final Function, Configuration> detachedConfigurationCreator private final Property jvmClasspath private final List> gemJarProviders = [] @@ -130,9 +130,18 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask deps = this.docExtensionsProperty.get().findAll { it instanceof Dependency } as List + + def detachedConfigurationCreator = { ConfigurationContainer c, List d -> + final cfg = c.detachedConfiguration(d.toArray() as Dependency[]) + cfg.canBeConsumed = false + cfg.canBeResolved = true + cfg + }.curry(project.configurations) as Function, Configuration> + Configuration cfg = detachedConfigurationCreator.apply(deps) getAsciidoctorJExtension().loadJRubyResolutionStrategy(cfg) - } + cfg + } as Provider private final Provider>> attributesByLangProvider = project.provider { def attributesByLang = new HashMap>() @@ -531,12 +540,12 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask deps -> - final cfg = c.detachedConfiguration(deps.toArray() as Dependency[]) - cfg.canBeConsumed = false - cfg.canBeResolved = true - cfg - }.curry(project.configurations) as Function, Configuration> +// this.detachedConfigurationCreator = { ConfigurationContainer c, List deps -> +// final cfg = c.detachedConfiguration(deps.toArray() as Dependency[]) +// cfg.canBeConsumed = false +// cfg.canBeResolved = true +// cfg +// }.curry(project.configurations) as Function, Configuration> inputs.files { gemJarProviders }.withPathSensitivity(RELATIVE) inputs.property 'backends', { -> backends() } @@ -819,7 +828,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask, attributeProviders, lang From 42e0744b0d0113261af0e8450e3b50f65a6cf956 Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Wed, 19 Jun 2024 16:48:32 -0500 Subject: [PATCH 08/16] Removed commented-out detachedConfigurationCreator field --- .../org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy | 1 - 1 file changed, 1 deletion(-) 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 de0cad66b..db3bfd191 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -106,7 +106,6 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask, Configuration> detachedConfigurationCreator private final Property jvmClasspath private final List> gemJarProviders = [] From acccec9d7758300cdf1bdbfba5a41e924a07e8f3 Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Thu, 20 Jun 2024 11:40:21 -0500 Subject: [PATCH 09/16] Remove classpath annotation, as the asciidoctorj extension didn't have an input annotation --- .../org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy | 2 -- 1 file changed, 2 deletions(-) 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 db3bfd191..0dfd08eb7 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -49,7 +49,6 @@ import org.gradle.api.provider.ListProperty import org.gradle.api.provider.MapProperty import org.gradle.api.provider.Property import org.gradle.api.provider.Provider -import org.gradle.api.tasks.Classpath import org.gradle.api.tasks.Input import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Nested @@ -112,7 +111,6 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask optionsProperty = project.objects.mapProperty(String, Object) protected final MapProperty attributesProperty = project.objects.mapProperty(String, Object) public final ListProperty attributeProviderProperty = project.objects.listProperty(AsciidoctorAttributeProvider) - @Classpath protected FileCollection configurationsFileCollection protected final ListProperty fatalWarningsProperty = project.objects.listProperty(Pattern) protected final ListProperty requiresProperty = project.objects.listProperty(String) From 17f6274320410f6825a98f448e8904a421fa61fc Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Thu, 20 Jun 2024 12:01:33 -0500 Subject: [PATCH 10/16] Remove commented-out code. It was replaced --- .../asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy | 7 ------- 1 file changed, 7 deletions(-) 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 0dfd08eb7..3ce36d899 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -814,13 +814,6 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask deps) { -// Configuration cfg = detachedConfigurationCreator.apply(deps) -// asciidoctorj.loadJRubyResolutionStrategy(cfg) -// cfg -// } - private Map preparePreserialisedAttributes(final File workingSourceDir, Optional lang) { prepareAttributes( projectOperations.stringTools, From fe09ac0cfbd20236942d87153ad33a5c5cf39d5d Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Thu, 20 Jun 2024 12:16:23 -0500 Subject: [PATCH 11/16] Remove commented-out detachedConfigurationCreator. It has been moved to within the jrubyLessDependenciesProvider --- .../gradle/jvm/AbstractAsciidoctorTask.groovy | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) 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 3ce36d899..acd813eaf 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -334,8 +334,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask deps -> -// final cfg = c.detachedConfiguration(deps.toArray() as Dependency[]) -// cfg.canBeConsumed = false -// cfg.canBeResolved = true -// cfg -// }.curry(project.configurations) as Function, Configuration> inputs.files { gemJarProviders }.withPathSensitivity(RELATIVE) inputs.property 'backends', { -> backends() } From bc07f638633d2717e0282b09bce38bf4793aec5c Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Thu, 20 Jun 2024 12:27:44 -0500 Subject: [PATCH 12/16] Add back asciidoctorj.configuration to the results of getReportableConfigurations() --- .../org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 acd813eaf..1f4390133 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -401,7 +401,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getReportableConfigurations() { - (/*[asciidoctorj.configuration] +*/ projectOperations.configurations.asConfigurations(asciidocConfigurations)) + ([getAsciidoctorJExtension().configuration] + projectOperations.configurations.asConfigurations(asciidocConfigurations)) .toSet() } From 28147cf78be2342fcc79beab6be72f9b6c6f0591 Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Thu, 20 Jun 2024 15:43:20 -0500 Subject: [PATCH 13/16] Make attributeProviderProperty protected --- .../org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1f4390133..fc61b6130 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -110,7 +110,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask optionsProperty = project.objects.mapProperty(String, Object) protected final MapProperty attributesProperty = project.objects.mapProperty(String, Object) - public final ListProperty attributeProviderProperty = project.objects.listProperty(AsciidoctorAttributeProvider) + protected final ListProperty attributeProviderProperty = project.objects.listProperty(AsciidoctorAttributeProvider) protected FileCollection configurationsFileCollection protected final ListProperty fatalWarningsProperty = project.objects.listProperty(Pattern) protected final ListProperty requiresProperty = project.objects.listProperty(String) From 47262efb21c4eea0bf2fde9196f1e9a69bd978d1 Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Thu, 20 Jun 2024 15:48:24 -0500 Subject: [PATCH 14/16] Fix codenarc issues Shorten too-long lines Replace opt.isPresent() with opt.present Remove unnecessary getters Replace call to getAsciidoctorJExtension() with asciidoctorJExtension Remove unnecessary package reference Correct instance ordering --- .../gradle/jvm/AbstractAsciidoctorTask.groovy | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) 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 fc61b6130..8c9bcfd7d 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -110,7 +110,8 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask optionsProperty = project.objects.mapProperty(String, Object) protected final MapProperty attributesProperty = project.objects.mapProperty(String, Object) - protected final ListProperty attributeProviderProperty = project.objects.listProperty(AsciidoctorAttributeProvider) + protected final ListProperty attributeProviderProperty = project.objects + .listProperty(AsciidoctorAttributeProvider) protected FileCollection configurationsFileCollection protected final ListProperty fatalWarningsProperty = project.objects.listProperty(Pattern) protected final ListProperty requiresProperty = project.objects.listProperty(String) @@ -118,11 +119,6 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask safeModeProperty = project.objects.property(SafeMode) protected final ListProperty docExtensionsProperty = project.objects.listProperty(Object) - @Internal - private AsciidoctorJExtension getAsciidoctorJExtension() { - extensions.getByName(AsciidoctorJExtension.NAME) as AsciidoctorJExtension - } - private final Provider jrubyLessDependenciesProvider = project.provider { List deps = this.docExtensionsProperty.get().findAll { it instanceof Dependency @@ -136,21 +132,20 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask, Configuration> Configuration cfg = detachedConfigurationCreator.apply(deps) - getAsciidoctorJExtension().loadJRubyResolutionStrategy(cfg) + asciidoctorJExtension.loadJRubyResolutionStrategy(cfg) cfg } as Provider private final Provider>> attributesByLangProvider = project.provider { - def attributesByLang = new HashMap>() + def attributesByLang = [:] languagesAsOptionals.each { lang -> - if (lang.isPresent()) { - attributesByLang.put(lang.get(), getAsciidoctorJExtension().getAttributesForLang(lang.get())) + if (lang.present) { + attributesByLang.put(lang.get(), asciidoctorJExtension.getAttributesForLang(lang.get())) } } attributesByLang } as Provider>> - @Delegate private final DefaultAsciidoctorFileOperations asciidoctorTaskFileOperations @@ -297,12 +292,6 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getReportableConfigurations() { - ([getAsciidoctorJExtension().configuration] + projectOperations.configurations.asConfigurations(asciidocConfigurations)) - .toSet() + ([asciidoctorJExtension.configuration] + projectOperations.configurations + .asConfigurations(asciidocConfigurations)).toSet() } /** @@ -523,13 +512,13 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getSerializableAsciidoctorJExtensions() { asciidoctorJExtensions.findAll { !(it instanceof Dependency) }.collect { getSerializableAsciidoctorJExtension(it) @@ -788,7 +788,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask Date: Fri, 12 Apr 2024 15:10:43 -0500 Subject: [PATCH 15/16] Set version to 4.0.2-local --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 32fb4bd44..8bb0a45bd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version = 4.0.2 +version = 4.0.2-local group = org.asciidoctor copyrightYear = 2013-2024 From 680a6df81fae3ef9ad1737c0c456b9d5a5e3e34a Mon Sep 17 00:00:00 2001 From: Tyler Bertrand Date: Mon, 15 Jul 2024 16:39:58 -0500 Subject: [PATCH 16/16] Update properties that were moved from AsciidoctorJExtension to AbstractAsciidoctorTask to be private There is no reason for them to be protected --- .../gradle/jvm/AbstractAsciidoctorTask.groovy | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 8c9bcfd7d..d17b84636 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -108,16 +108,16 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask jvmClasspath private final List> gemJarProviders = [] - protected final MapProperty optionsProperty = project.objects.mapProperty(String, Object) - protected final MapProperty attributesProperty = project.objects.mapProperty(String, Object) - protected final ListProperty attributeProviderProperty = project.objects + private final MapProperty optionsProperty = project.objects.mapProperty(String, Object) + private final MapProperty attributesProperty = project.objects.mapProperty(String, Object) + private final ListProperty attributeProviderProperty = project.objects .listProperty(AsciidoctorAttributeProvider) - protected FileCollection configurationsFileCollection - protected final ListProperty fatalWarningsProperty = project.objects.listProperty(Pattern) - protected final ListProperty requiresProperty = project.objects.listProperty(String) - protected final Property logLevelProperty = project.objects.property(LogLevel) - protected final Property safeModeProperty = project.objects.property(SafeMode) - protected final ListProperty docExtensionsProperty = project.objects.listProperty(Object) + private FileCollection configurationsFileCollection + private final ListProperty fatalWarningsProperty = project.objects.listProperty(Pattern) + private final ListProperty requiresProperty = project.objects.listProperty(String) + private final Property logLevelProperty = project.objects.property(LogLevel) + private final Property safeModeProperty = project.objects.property(SafeMode) + private final ListProperty docExtensionsProperty = project.objects.listProperty(Object) private final Provider jrubyLessDependenciesProvider = project.provider { List deps = this.docExtensionsProperty.get().findAll {