Skip to content

Commit

Permalink
Rename asciidoctorj property to asciidoctorjDEPRECATED
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerbertrand committed Apr 12, 2024
1 parent aabbde6 commit 4fb70f9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
public final static Severity WARN = Severity.WARN
public final static Severity INFO = Severity.INFO

protected final AsciidoctorJExtension asciidoctorj
protected final AsciidoctorJExtension asciidoctorjDEPRECATED
private ExecutionMode inProcess
private Severity failureLevel = Severity.FATAL
private final List<Object> asciidocConfigurations = []
Expand Down Expand Up @@ -222,7 +222,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
*/
@Input
Map<String, Object> getOptions() {
resolveAsCacheable(asciidoctorj.options, projectOperations)
resolveAsCacheable(asciidoctorjDEPRECATED.options, projectOperations)
}

/** Apply a new set of Asciidoctor options, clearing any options previously set.
Expand All @@ -234,7 +234,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
* @param m Map with new options
*/
void setOptions(Map m) {
asciidoctorj.options = m
asciidoctorjDEPRECATED.options = m
}

/** Add additional asciidoctor options
Expand All @@ -246,7 +246,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
* @param m Map with new options
*/
void options(Map m) {
asciidoctorj.options(m)
asciidoctorjDEPRECATED.options(m)
}

/** Returns all of the Asciidoctor options.
Expand All @@ -256,7 +256,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
*/
@Input
Map<String, Object> getAttributes() {
resolveAsCacheable(asciidoctorj.attributes, projectOperations)
resolveAsCacheable(asciidoctorjDEPRECATED.attributes, projectOperations)
}

/** Apply a new set of Asciidoctor options, clearing any options previously set.
Expand All @@ -268,7 +268,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
* @param m Map with new options
*/
void setAttributes(Map m) {
asciidoctorj.attributes = m
asciidoctorjDEPRECATED.attributes = m
}

/** Add additional asciidoctor options
Expand All @@ -280,7 +280,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
* @param m Map with new options
*/
void attributes(Map m) {
asciidoctorj.attributes(m)
asciidoctorjDEPRECATED.attributes(m)
}

/** Additional providers of attributes.
Expand All @@ -292,7 +292,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
*/
@Internal
List<AsciidoctorAttributeProvider> getAttributeProviders() {
asciidoctorj.attributeProviders
asciidoctorjDEPRECATED.attributeProviders
}

/** Returns all of the specified configurations as a collections of files.
Expand All @@ -305,7 +305,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
@SuppressWarnings('Instanceof')
FileCollection getConfigurations() {
final precompiledExtensions = findDependenciesInExtensions()
FileCollection fc = this.asciidocConfigurations.inject(asciidoctorj.configuration) {
FileCollection fc = this.asciidocConfigurations.inject(asciidoctorjDEPRECATED.configuration) {
FileCollection seed, Object it ->
seed + projectOperations.configurations.asConfiguration(it)
}
Expand Down Expand Up @@ -348,7 +348,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
*/
@Override
Set<Configuration> getReportableConfigurations() {
([asciidoctorj.configuration] + projectOperations.configurations.asConfigurations(asciidocConfigurations))
([asciidoctorjDEPRECATED.configuration] + projectOperations.configurations.asConfigurations(asciidocConfigurations))
.toSet()
}

Expand Down Expand Up @@ -467,7 +467,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
asciidoctorTaskFileOperations
)
this.baseDirConfiguration = new DefaultAsciidoctorBaseDirConfiguration(project, this)
this.asciidoctorj = extensions.create(AsciidoctorJExtension.NAME, AsciidoctorJExtension, this)
this.asciidoctorjDEPRECATED = extensions.create(AsciidoctorJExtension.NAME, AsciidoctorJExtension, this)
this.projectDir = project.projectDir
this.rootDir = project.rootDir
this.jvmClasspath = project.objects.property(FileCollection)
Expand All @@ -479,11 +479,11 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
cfg
}.curry(project.configurations) as Function<List<Dependency>, Configuration>

inputs.files(this.asciidoctorj.configuration)
inputs.files(this.asciidoctorjDEPRECATED.configuration)
inputs.files { gemJarProviders }.withPathSensitivity(RELATIVE)
inputs.property 'backends', { -> backends() }
inputs.property 'asciidoctorj-version', { -> asciidoctorj.version }
inputs.property 'jruby-version', { -> asciidoctorj.jrubyVersion ?: '' }
inputs.property 'asciidoctorj-version', { -> asciidoctorjDEPRECATED.version }
inputs.property 'jruby-version', { -> asciidoctorjDEPRECATED.jrubyVersion ?: '' }
execSpec = new AsciidoctorJvmExecSpec(projectOperations)
entrypoint {
mainClass = AsciidoctorJavaExec.canonicalName
Expand Down Expand Up @@ -585,13 +585,13 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
),
backendName: backendName,
logDocuments: logDocuments,
fatalMessagePatterns: asciidoctorj.fatalWarnings,
fatalMessagePatterns: asciidoctorjDEPRECATED.fatalWarnings,
asciidoctorExtensions: serializableAsciidoctorJExtensions,
requires: asciidoctorj.requires,
requires: asciidoctorjDEPRECATED.requires,
copyResources: copyResources.present &&
(copyResources.get().empty || backendName in copyResources.get()),
executorLogLevel: ExecutorUtils.getExecutorLogLevel(asciidoctorj.logLevel),
safeModeLevel: asciidoctorj.safeMode.level
executorLogLevel: ExecutorUtils.getExecutorLogLevel(asciidoctorjDEPRECATED.logLevel),
safeModeLevel: asciidoctorjDEPRECATED.safeMode.level
)
}

Expand All @@ -601,7 +601,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
*/
@Internal
protected List<Object> getAsciidoctorJExtensions() {
asciidoctorj.docExtensions
asciidoctorjDEPRECATED.docExtensions
}

@Nested
Expand Down Expand Up @@ -703,7 +703,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe

@SuppressWarnings('Instanceof')
private FileCollection findDependenciesInExtensions() {
List<Dependency> deps = asciidoctorj.docExtensions.findAll {
List<Dependency> deps = asciidoctorjDEPRECATED.docExtensions.findAll {
it instanceof Dependency
} as List<Dependency>

Expand Down Expand Up @@ -753,23 +753,23 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
// TODO: Try to do this without a detached configuration
private FileCollection jrubyLessConfiguration(List<Dependency> deps) {
Configuration cfg = detachedConfigurationCreator.apply(deps)
asciidoctorj.loadJRubyResolutionStrategy(cfg)
asciidoctorjDEPRECATED.loadJRubyResolutionStrategy(cfg)
cfg
}

private Map<String, Object> preparePreserialisedAttributes(final File workingSourceDir, Optional<String> lang) {
prepareAttributes(
projectOperations.stringTools,
attributes,
(lang.present ? asciidoctorj.getAttributesForLang(lang.get()) : [:]),
(lang.present ? asciidoctorjDEPRECATED.getAttributesForLang(lang.get()) : [:]),
getTaskSpecificDefaultAttributes(workingSourceDir) as Map<String, ?>,
attributeProviders,
lang
)
}

private List<Closure> findExtensionClosures() {
asciidoctorj.docExtensions.findAll {
asciidoctorjDEPRECATED.docExtensions.findAll {
it instanceof Closure
} as List<Closure>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,16 @@ class AsciidoctorTaskSpec extends Specification {
}
}
final task = createTask {
asciidoctorj {
asciidoctorjDEPRECATED {
requires 'slim', 'tilt'
}
}
then:
!systemOut.toString().contains('deprecated')
task.asciidoctorj.requires[0] == 'asciidoctor-pdf'
task.asciidoctorj.requires[1] == 'slim'
task.asciidoctorj.requires[2] == 'tilt'
task.asciidoctorjDEPRECATED.requires[0] == 'asciidoctor-pdf'
task.asciidoctorjDEPRECATED.requires[1] == 'slim'
task.asciidoctorjDEPRECATED.requires[2] == 'tilt'
}
void "Allow setting of requires via assignment"() {
Expand All @@ -356,16 +356,16 @@ class AsciidoctorTaskSpec extends Specification {
}
}
final task = createTask {
asciidoctorj {
asciidoctorjDEPRECATED {
requires = ['slim', 'tilt']
}
}
then:
!systemOut.toString().contains('deprecated')
!task.asciidoctorj.requires.contains('asciidoctor-pdf')
task.asciidoctorj.requires.contains('tilt')
task.asciidoctorj.requires.contains('slim')
!task.asciidoctorjDEPRECATED.requires.contains('asciidoctor-pdf')
task.asciidoctorjDEPRECATED.requires.contains('tilt')
task.asciidoctorjDEPRECATED.requires.contains('slim')
}
void "Allow setting of sourceDir via method"() {
Expand Down Expand Up @@ -406,7 +406,7 @@ class AsciidoctorTaskSpec extends Specification {
void 'When attribute providers are registered on the task, then global ones will not be used.'() {
when:
final task = createTask {
asciidoctorj {
asciidoctorjDEPRECATED {
attributeProvider {
[:]
}
Expand Down

0 comments on commit 4fb70f9

Please sign in to comment.