-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve Gradle Configuration Caching Issues When Executing AsciidoctorTask #1
base: development-4.x
Are you sure you want to change the base?
Conversation
… to replace references to asciidoctorj.options and asciidoctorj.attributes
…e an input annotation
…to within the jrubyLessDependenciesProvider
2d63794
to
bc07f63
Compare
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
a756f4a
to
47262ef
Compare
@@ -750,26 +807,19 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe | |||
} | |||
} | |||
|
|||
// TODO: Try to do this without a detached configuration | |||
private FileCollection jrubyLessConfiguration(List<Dependency> deps) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just FYI, in a recent conversation with the BT team, they mentioned:
detached configurations are probably not what you want. "detached" means that almost everything that
comes from project state is separate. We were going to deprecate detached configurations from extending
project configurations,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking great, just some minor questions!
@@ -719,19 +776,19 @@ class AbstractAsciidoctorTask extends AbstractJvmModelExecTask<AsciidoctorJvmExe | |||
if (deps.empty && closurePaths.empty) { | |||
projectOperations.fsOperations.emptyFileCollection() | |||
} else if (closurePaths.empty) { | |||
jrubyLessConfiguration(deps) | |||
jrubyLessDependenciesProvider.get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have to pass deps
to this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deps
doesn't need to be passed in here as it has been moved to within the provider
private final Property<FileCollection> jvmClasspath | ||
private final List<Provider<File>> gemJarProviders = [] | ||
|
||
protected final MapProperty<String, Object> optionsProperty = project.objects.mapProperty(String, Object) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these protected
instead of private
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had run into some unknown property exception issues that I thought were resolved by this, but after testing now, it works just fine with them private
, so I've made that change.
this.asciidoctorj = extensions.create(AsciidoctorJExtension.NAME, AsciidoctorJExtension, this) | ||
|
||
def asciidoctorj = extensions.create(AsciidoctorJExtension.NAME, AsciidoctorJExtension, this) | ||
this.optionsProperty.set(asciidoctorj.options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we setting default values here? what does this block do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, setting default values
…actAsciidoctorTask to be private There is no reason for them to be protected
Fixes the Gradle configuration caching issues originating from this project when executing
org.asciidoctor.gradle.jvm.AsciidoctorTask
. There are some remaining issues, but those are caused by the grolifant library.The configuration caching issues in this project were primarily tasks referencing types incompatible with configuration caching. The references to these types were mostly held by
AsciidoctorJExtension
, whichAbstractAsciidoctorTask
held a reference to. To resolve this, the individual properties ofAsciidoctorJExtension
were moved directly toAbstractAsciidoctorTask
in a configuration cache-compatible way. No input annotations were added to these properties to maintain parity with the current task behavior. The property values are wired from the extension to the task properties inAbstractAsciidoctorTask
's constructor. In such cases where providers are used and referencingAsciidoctorJExtension
is required, an@Internal
getter is used to access theAsciidoctorJExtension
instance. This@Internal
getter prevents Gradle from attempting to serializeAsciidoctorJExtension
to the configuration cache.One behavioral change is that
AbstractAsciidoctorTask
no longer has the ability to write back toAsciidoctorJExtension
since the reference from the task to the extension was removed. The methods that allowed this were updated to write to the properties that now reside in the task. As it stands I'm not sure what the full impact of that change is. Additionally, since this reference was removed, some methods were copied fromAsciidoctorJExtension
toAbstractAsciidoctorTask
where needed. This should probably be done in a better way than just copying the methods, but I would like to get input first since this changes the relationship between the extension and the task.The remaining configuration caching issues are shown in the following report