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 f01e65a28..2c0cffb74 100644 --- a/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy +++ b/jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AbstractAsciidoctorTask.groovy @@ -45,8 +45,6 @@ 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 import org.gradle.api.tasks.Input @@ -65,7 +63,6 @@ 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 @@ -108,19 +105,18 @@ 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) - private final 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> optionsProvider + private final Provider> attributesProvider + private final Provider> attributeProvidersProvider + private final Provider configurationsFileCollectionProvider + private final Provider> fatalWarningsProvider + private final Provider> requiresProvider + private final Provider logLevelProvider + private final Provider safeModeProvider + private final Provider> docExtensionsProvider private final Provider jrubyLessDependenciesProvider = project.provider { - List deps = this.docExtensionsProperty.get().findAll { + List deps = this.docExtensionsProvider.get().findAll { it instanceof Dependency } as List @@ -264,7 +260,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getOptions() { - resolveAsCacheable(optionsProperty.get(), projectOperations) + resolveAsCacheable(optionsProvider.get(), projectOperations) } /** Apply a new set of Asciidoctor options, clearing any options previously set. @@ -276,7 +272,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getAttributes() { - resolveAsCacheable(attributesProperty.get(), projectOperations) + resolveAsCacheable(attributesProvider.get(), projectOperations) } /** Apply a new set of Asciidoctor options, clearing any options previously set. @@ -311,7 +306,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getAttributeProviders() { - attributeProviderProperty.get().stream().collect(Collectors.toList()) + attributeProvidersProvider.get() } /** Returns all of the specified configurations as a collections of files. @@ -470,7 +465,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getAsciidoctorJExtensions() { - docExtensionsProperty.get().stream().collect(Collectors.toList()) + docExtensionsProvider.get() + } + + @Internal + protected AsciidoctorJExtension getAsciidoctorJExtension() { + extensions.getByName(AsciidoctorJExtension.NAME) as AsciidoctorJExtension } @Nested @@ -680,17 +682,6 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask getSerializableAsciidoctorJExtensions() { asciidoctorJExtensions.findAll { !(it instanceof Dependency) }.collect { getSerializableAsciidoctorJExtension(it) @@ -760,7 +751,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask deps = this.docExtensionsProperty.get().findAll { + List deps = this.docExtensionsProvider.get().findAll { it instanceof Dependency } as List @@ -819,7 +810,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask findExtensionClosures() { - this.docExtensionsProperty.get().findAll { + this.docExtensionsProvider.get().findAll { it instanceof Closure } as List } diff --git a/jvm/src/test/groovy/org/asciidoctor/gradle/jvm/AsciidoctorTaskSpec.groovy b/jvm/src/test/groovy/org/asciidoctor/gradle/jvm/AsciidoctorTaskSpec.groovy index 741733bc4..5c0103a22 100755 --- a/jvm/src/test/groovy/org/asciidoctor/gradle/jvm/AsciidoctorTaskSpec.groovy +++ b/jvm/src/test/groovy/org/asciidoctor/gradle/jvm/AsciidoctorTaskSpec.groovy @@ -50,7 +50,7 @@ class AsciidoctorTaskSpec extends Specification { project.allprojects { apply plugin: 'org.asciidoctor.jvm.base' } - + testRootDir = new File(System.getProperty('ROOT_PROJECT_DIR') ?: '.') srcDir = new File(testRootDir, ASCIIDOC_RESOURCES_DIR).absoluteFile outDir = new File(project.projectDir, ASCIIDOC_BUILD_DIR)