This message was deleted.
# configuration-cache
s
This message was deleted.
d
I’m almost certain that you have to use a
ValueSource
for the configuration cache enabled provider.
j
I am going to investigate about it, thank you šŸ™‚
v
As daniel said, you for example need a value source. The tasks state is persisted to and restored from the configuration cache, so the value is reused. You either need to make something relevant a configuration cache input or make sure the value is always recalculated. A value source is always recalculated and if changed discards the configuration cache entry. So all the state needs to be recalculated, including the value source a second time. Maybe better in your case is to make the file where the head commit sha is saved a configuration cache input. It maybe yet even better indeed calculate it at execution time
j
Problem with calculating it at execution time is the project is not matching the version calculated by the task
About the SHA, it is not enough because I am checking if the repo is clean too to change the project version via jgit.
I can't create a value source because I am checking with taskNames if a task is being executed and looks like it is incompatible so I will have to move to that strategy of finding all git files, the head one and I guess that the index one for the repo status
I am doomed, by using index file and refs/heads directory as properties in my plugin extension, I would be able to almost fix the issue, except the timestamp should be changing with the time and it isn't because with a dirty repo and changing nothing, nothing is recalculated. I think I have to drop timestamp support because it is just a waste of time rebuilding configuration cache if I get it working
after trying and even setting the entire
.git
as
DirectoryProperty
in my extension, it is not working šŸ˜•
Copy code
public abstract class SemverExtension @Inject constructor(objects: ObjectFactory) {

    public val tagPrefix: Property<String> = objects.property<String>().convention(DefaultTagPrefix)

    internal abstract val gitDirectory: DirectoryProperty

    public companion object {

        public const val extensionName: String = "semver"

        internal fun register(project: Project): SemverExtension =
            with(project) {
                extensions.create<SemverExtension>(extensionName).apply {
                    gitDirectory.convention(project.layout.dir(project.provider { gitDir }))
                }
            }
    }
}
it is reusing the cache when it shouldn't
I haven't see any extension which uses annotations like
@get:InputDirectory
, I am going to try that
Same (and
gitDirectory
is public now with that annotation
Tried
ConfigurableFileCollection
, no success
d
Sometimes it's tricky but you should be able to get it working. I got CocoaPods install done with support for configuration cache so I'm pretty sure you can get your use case working as well. Unfortunately, I don't have enough time to look at Kotlin code.
j
@daniel I think ValueSources has the same bug than build services, you can't use variables with starts with
is
...
Confirmed šŸ˜ž
v
Not really related to this topic, is it? šŸ™‚
j
Related to the workaround mentioned by Daniel