Skip to content

Commit

Permalink
Fixed detachedConfigurationCreator config cache issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerbertrand committed May 20, 2024
1 parent 38c4c9b commit 89b2fc0
Showing 1 changed file with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
private final File rootDir
private final File projectDir
private final File execConfigurationDataFile
private final Function<List<Dependency>, Configuration> detachedConfigurationCreator
// private final Function<List<Dependency>, Configuration> detachedConfigurationCreator
private final Property<FileCollection> jvmClasspath
private final List<Provider<File>> gemJarProviders = []

Expand All @@ -130,9 +130,18 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
List<Dependency> deps = this.docExtensionsProperty.get().findAll {
it instanceof Dependency
} as List<Dependency>

def detachedConfigurationCreator = { ConfigurationContainer c, List<Dependency> d ->
final cfg = c.detachedConfiguration(d.toArray() as Dependency[])
cfg.canBeConsumed = false
cfg.canBeResolved = true
cfg
}.curry(project.configurations) as Function<List<Dependency>, Configuration>

Configuration cfg = detachedConfigurationCreator.apply(deps)
getAsciidoctorJExtension().loadJRubyResolutionStrategy(cfg)
}
cfg
} as Provider<FileCollection>

private final Provider<Map<String, Map<String, Object>>> attributesByLangProvider = project.provider {
def attributesByLang = new HashMap<String, Map<String, Object>>()
Expand Down Expand Up @@ -531,12 +540,12 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
this.rootDir = project.rootDir
this.jvmClasspath = project.objects.property(FileCollection)
this.execConfigurationDataFile = getExecConfigurationDataFile(this)
this.detachedConfigurationCreator = { ConfigurationContainer c, List<Dependency> deps ->
final cfg = c.detachedConfiguration(deps.toArray() as Dependency[])
cfg.canBeConsumed = false
cfg.canBeResolved = true
cfg
}.curry(project.configurations) as Function<List<Dependency>, Configuration>
// this.detachedConfigurationCreator = { ConfigurationContainer c, List<Dependency> deps ->
// final cfg = c.detachedConfiguration(deps.toArray() as Dependency[])
// cfg.canBeConsumed = false
// cfg.canBeResolved = true
// cfg
// }.curry(project.configurations) as Function<List<Dependency>, Configuration>

inputs.files { gemJarProviders }.withPathSensitivity(RELATIVE)
inputs.property 'backends', { -> backends() }
Expand Down Expand Up @@ -819,7 +828,7 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe
prepareAttributes(
projectOperations.stringTools,
attributes,
(lang.present ? attributesByLangProvider.get().getOrDefault(lang.get(), [:]) : [:]), // THIS IS NULL
(lang.present ? attributesByLangProvider.get().getOrDefault(lang.get(), [:]) : [:]),
getTaskSpecificDefaultAttributes(workingSourceDir) as Map<String, ?>,
attributeProviders,
lang
Expand Down

0 comments on commit 89b2fc0

Please sign in to comment.