Roded Bahat
11/26/2024, 6:20 AMexclude
filters aren't taking affect in the bellow snippet and I have no clue why.
I also tried to create two `FileTree`s and minus
them which didn't work as expected either.
Any idea what I'm doing wrong?
Thanks!
val touchedFiles = mutableListOf<String>()
// ...
val fileTree = files(touchedFiles).asFileTree.matching {
include("**/*.yaml")
include("**/*.yml")
exclude("**/.idea/**")
exclude("**/secrets.yml")
}
Vampire
11/26/2024, 8:46 AM"**/.idea/"
seems to not work as expected.
As a work-around you could instead use include { ... }
and / or exclude { ... }
instead of the Ant-style patterns.Vampire
11/26/2024, 9:05 AMVampire
11/26/2024, 9:06 AMVampire
11/26/2024, 9:07 AMVampire
11/26/2024, 9:07 AMfiles(layout.buildDirectory.dir("foo"))
the relative path starts after foo
and so the directory exclude is matching.Vampire
11/26/2024, 9:10 AM**/build/
and then put your project under /my/code/build/foo/project/
all files would be excluded, if you put it in /my/code/foo/project/
then not.Vampire
11/26/2024, 9:12 AMRoded Bahat
11/26/2024, 11:27 AMRoded Bahat
11/26/2024, 11:28 AMVampire
11/26/2024, 12:11 PMRoded Bahat
11/26/2024, 1:01 PMFileTree
in general. touchedFiles
is a list of paths relative to the project's root directory. So I understand that calling files
on it creates a non-trivial file tree with the wrong relative path. I guess I should've done something like project.rootDir.files(touchedFiles).asFileTree
and then my Ant-style includes and excludes could work but that's just too many files to initiate a FileTree
with.Roded Bahat
11/26/2024, 1:02 PM