Skip to content

Commit

Permalink
Convert safeModeProperty, fatalWarningsProperty, and logLevelProperty…
Browse files Browse the repository at this point in the history
… to providers
  • Loading branch information
tylerbertrand committed Jul 30, 2024
1 parent cfd02fa commit bc47b5d
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +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.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Input
Expand Down Expand Up @@ -111,10 +110,10 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
private final Provider<Map<String, Object>> attributesProvider
private final Provider<List<AsciidoctorAttributeProvider>> attributeProvidersProvider
private final Provider<FileCollection> configurationsFileCollectionProvider
private final ListProperty<Pattern> fatalWarningsProperty = project.objects.listProperty(Pattern)
private final Provider<List<Pattern>> fatalWarningsProvider
private final Provider<List<String>> requiresProvider
private final Property<LogLevel> logLevelProperty = project.objects.property(LogLevel)
private final Property<SafeMode> safeModeProperty = project.objects.property(SafeMode)
private final Provider<LogLevel> logLevelProvider
private final Provider<SafeMode> safeModeProvider
private final Provider<List<Object>> docExtensionsProvider

private final Provider<FileCollection> jrubyLessDependenciesProvider = project.provider {
Expand Down Expand Up @@ -509,13 +508,15 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe

def asciidoctorj = extensions.create(AsciidoctorJExtension.NAME, AsciidoctorJExtension, this)
this.optionsProvider = project.provider { asciidoctorj.options }
this.safeModeProperty.set(asciidoctorj.safeMode)
this.safeModeProvider = project.provider { asciidoctorj.safeMode }
this.attributesProvider = project.provider { asciidoctorj.attributes }
this.attributeProvidersProvider = project.provider { asciidoctorj.attributeProviders }
this.configurationsFileCollectionProvider = project.provider { getConfigurations(asciidoctorj) }
this.fatalWarningsProperty.set(asciidoctorj.fatalWarnings)
this.fatalWarningsProvider = project.provider { asciidoctorj.fatalWarnings }
this.requiresProvider = project.provider { asciidoctorj.requires }
this.logLevelProperty.set(asciidoctorj.logLevel != null ? asciidoctorj.logLevel : LogLevel.INFO)
this.logLevelProvider = project.provider {
asciidoctorj.logLevel != null ? asciidoctorj.logLevel : LogLevel.INFO
}
this.docExtensionsProvider = project.provider { asciidoctorj.docExtensions }

this.projectDir = project.projectDir
Expand Down Expand Up @@ -628,13 +629,13 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
),
backendName: backendName,
logDocuments: logDocuments,
fatalMessagePatterns: fatalWarningsProperty.get().stream().collect(Collectors.toList()),
fatalMessagePatterns: fatalWarningsProvider.get(),
asciidoctorExtensions: serializableAsciidoctorJExtensions,
requires: requiresProvider.get(),
copyResources: copyResources.present &&
(copyResources.get().empty || backendName in copyResources.get()),
executorLogLevel: ExecutorUtils.getExecutorLogLevel(logLevelProperty.get()),
safeModeLevel: safeModeProperty.get().level
executorLogLevel: ExecutorUtils.getExecutorLogLevel(logLevelProvider.get()),
safeModeLevel: safeModeProvider.get().level
)
}

Expand Down

0 comments on commit bc47b5d

Please sign in to comment.