Quick question. In the <release notes of 9.8.x >it...
# community-support
j
Quick question. In the release notes of 9.8.x it says: > Build authoring gets less verbose, with Gradle’s built-in services for working with files, objects, and processes now available directly in scripts and task actions In particular I want to use
zipTree
here in some form without breaking the config cache and without the hassle of injecting the FileOperations service in some complicated way:
Copy code
tasks.registerJar("fatJar") {
    from(configurations.runtimeClasspath.get().elements.map {
        jars -> jars.map { zipTree(it) }
    })
}
But I can’t find how this works. In the release notes it is not described (or I am blind). And I have trouble finding this in the docs. As usual, if you search for “gradle services” you get a lot of hits on other things as the term “service” is heavily overloaded. Anyone has the right pointer/link for me? Thanks!
t
Fwiw, the docs about creating a fatjar still uses a similar approach to yours (but puts it in a callable/lambda): docs.gradle.org/current/userguide/working_with_files.html#…
😱 1
j
But this is wrong, right? It would be a good doc for an anti-pattern. 😄 It uses Groovy/Kotlin
findAll
/
filter
which will implicitly resolve the Configuration eagerly at Configuration Time by turning it into an
IterableFile
. It’s also why
dependsOn(configurations.runtimeClasspath)
is needed in that setup (another anti-pattern imo). If these new APIs exist, this site should be updated. I can do an issue (or PR) once I know how these work.
t
What you’re asking for (IIUC): github.com/gradle/gradle/issues/32579
j
Yes. My understanding of the following sentence from the release notes is that something like that exists now.
Build authoring gets less verbose, with Gradle’s built-in services for working with files, objects, and processes now available directly in scripts
But then I probably misunderstood. But what else does that refer to? 🤔
🤷 1
t
github.com/gradle/gradle/commit/e6ea72ab3d1a… Looks like it was about the
service()
lookup, that was reverted before release: github.com/gradle/gradle/commit/86035f093fa8…
v
The release note are wrong
j
Uh. Thanks for the research. So the revert was not fully thorough. 👍
v
It was added in github.com/gradle/gradle/pull/38552, then documented separately and then reverted
👍 1
j
Thanks
Guess it was not re-added and reworked in 9.9 yet (as the comment suggests)…
v
here the revert commit with reasoning: github.com/gradle/gradle/commit/86035f093fa8…
will be reworked for 9.9.
Is obviously also not correct, it is not present in 9.9.1 either
👍 1
but it should have been
service<FileSystemOperations>()
and
service(FileSystemOperations)
👍 1
j
That’s unfortunate. I think the “fatJar” case is a real good example in an “introduction to Gradle concepts” for Java developers. I intended to use that in some material I am reworking right now. I had in the back of my head that I read it in the release notes and that I was ver happy to read it. But I never tried until today.
Seems like it is a more complex topic as it looks like.
@Reinhold Degenfellner or @Paul Merlin github.com/gradle/gradle/pull/39199 says:
Once
release
is merged back, the revert also lands on `master`; the 9.9 rework starts from there.
May I ask if this happened and what the status is? Is there a follow up issue I can follow to see when this lands in a release?
r
There is no current plan when we will land it exactly. We had some discussion and spikes, but it is not clear yet what the best path for this is.
v
May I ask if this happened
The revert to master happened in github.com/gradle/gradle/commit/888c692fc93f…
j
Okay thanks for the info.