Slackbot
01/09/2024, 2:30 PMVampire
01/09/2024, 3:01 PMProject that has that method.
And also consider non-Project ways to access the method.
For example with configuration cache at execution time, you must not access Project.
So maybe provide a shared build service that consumers can get to use the method or something like that.Charlie Hubbard
01/09/2024, 3:04 PMzipTree() does today. It seems like extensions should cover something like this, but all examples are just about configuring properties on Interfaces instead of registering services to invoke and perform logic. Could you sketch out what you mean by those suggestions?Vampire
01/09/2024, 3:06 PMAdding extensions really only cover configuring dataNo, that's the most typical usage, but extensions can as well have methods that take arguments and return things
Charlie Hubbard
01/09/2024, 3:06 PMVampire
01/09/2024, 3:06 PMCharlie Hubbard
01/09/2024, 3:07 PMVampire
01/09/2024, 3:07 PMVampire
01/09/2024, 3:07 PMCharlie Hubbard
01/09/2024, 3:08 PMVampire
01/09/2024, 3:08 PMVampire
01/09/2024, 3:08 PMCharlie Hubbard
01/09/2024, 3:08 PMVampire
01/09/2024, 3:10 PMExtensionAware and you can get services you need injected and abstract properties implemented for you.Charlie Hubbard
01/09/2024, 3:13 PMAbstractArchiveFileTree. To implement the methods required from that class I’d need access to FileHasher implementation and DirectoryFileTreeFactory implementation. Where would I get those from?Vampire
01/09/2024, 3:14 PMCharlie Hubbard
01/09/2024, 3:16 PMCharlie Hubbard
01/09/2024, 3:18 PMAbstractArchiveFileTree implements FileSystemMirroringFileTree and that extends MinimalFileTree and MinimalFileCollection all of which are internal.Vampire
01/09/2024, 3:21 PMOctavia Togami
01/09/2024, 3:48 PMCallable implementation (but not a java lambda, it cannot be serialized reliably) to Project#files that unzips into a temporary directory / cache somewhere and returns the files from disk.Charlie Hubbard
01/09/2024, 4:26 PMtony
01/09/2024, 4:33 PMtony
01/09/2024, 4:34 PMOctavia Togami
01/09/2024, 4:34 PMCharlie Hubbard
01/09/2024, 4:38 PMCharlie Hubbard
01/09/2024, 4:56 PMzip4j.tree("…") it would return a FileCollection or FileTree based on the contents of the zip extracted already? So zip4j.tree("…") -> unzip to tempDir and return fileTree("${tempDir}")?Octavia Togami
01/09/2024, 4:57 PMCallable so it's only unpacked when needed.Octavia Togami
01/09/2024, 4:57 PMfileTree(tempDir))Charlie Hubbard
01/09/2024, 5:02 PMzip4j.tree("…")->return fileTree( { unzip( tempDir ) } ) ? I think I remember file(..) , files(..) , fileTree(…) can take in a Closure that returns a File or something along those lines.Octavia Togami
01/09/2024, 5:05 PMfileTree( { unzip( tempDir ); return tempDir; } ) to be clear about what it should return; but assuming Groovy/Kotlin yes this should work. They can take a Closure, Kotlin function, or Callable that resolves to a File, String, (in the case of files) Iterable, and more: https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html#file-java.lang.Object-