Javi
07/17/2024, 1:42 PMNamedDomainObjectCollection?
This is returning a list with only metadata as target, but if I use configureEach, I know there are more targets
the<KotlinMultiplatformExtension>().targets.map(KotlinTarget::getName)Vampire
07/17/2024, 2:21 PMNamedDomainObjectCollection<X> is-a Collection<X>, so if you call map on it, it is the standard Kotlin map on Collection that only gives you what is currently there.
What is the use-case, what do you in the end want to do with that mapped collection?Javi
07/17/2024, 2:25 PMsrcDirs is not using lazy APIs tho... I am getting the targets inside a setProperty lambda, so it should be already lazy, but I am probably calling get too earlyVampire
07/17/2024, 2:27 PM...configureEach { ...srcDir(it...) }?Vampire
07/17/2024, 2:36 PM.elements on FileCollection with which you can make a lazy mapping for the live elements of a FileCollection as you get a Provider<Set<FileSystemLocation>>, so you could get a Provider<Set<X>> from a DomainObjectCollection<X> that you then can map lazily.Javi
07/17/2024, 2:39 PMconfigureEach should be the best approach, but I would still love to see all APIs migrated to accept Provider tho, it simplify a lot to work on any Gradle configurationVampire
07/17/2024, 2:43 PMI would still love to see all APIs migrated to acceptYou mean like this hopefully coming in Gradle 9: https://github.com/gradle/build-tool-roadmap/issues/28 ? 🙂 Still the mentioned feature request might make sense, as this is not about something not accepting a provider, but a way to transform a domain object collection into a live provider.thoProvider
Vampire
07/17/2024, 2:44 PMprovider { the<KotlinMultiplatformExtension>().targets.map(KotlinTarget::getName) } as long as you do not get() the Provider too soon, as usualVampire
07/17/2024, 2:45 PMJavi
07/17/2024, 2:47 PMJavi
07/17/2024, 2:48 PMprovider { the<KotlinMultiplatformExtension>().targets.map(KotlinTarget::getName) } (with setProperty), but the problem is what you mentioned, I was forced to call get(), and I was doing it too soon (something complicated to see in a convention plugin).Vampire
07/17/2024, 2:53 PMsrcDir does not accept a provider currently?Vampire
07/17/2024, 2:53 PMJavi
07/17/2024, 2:53 PMJavi
07/17/2024, 2:54 PMJavi
07/17/2024, 2:54 PMVampire
07/17/2024, 2:54 PMsrcDir and a provider providing one directory, and srcDirs with a provider providing a list of directoriesVampire
07/17/2024, 2:55 PMSetProperty?Vampire
07/17/2024, 2:55 PMSetProperty instanceVampire
07/17/2024, 2:56 PMSetProperty is a Provider<Set<*>>, so with srcDirs it should workJavi
07/17/2024, 2:56 PMVampire
07/17/2024, 2:57 PMVampire
07/17/2024, 2:58 PMval foo = objects.setProperty<String>()
foo.add("src/functionalTest")
sourceSets {
main {
java {
srcDirs(foo)
}
}
}
foo.add("src/functionalTest2")
And both directories were considered by compileJavaVampire
07/17/2024, 3:00 PMJavi
07/17/2024, 3:04 PMProvider<File>?) but who knowsVampire
07/17/2024, 3:05 PMJavi
07/17/2024, 3:05 PMYou should not close the issues as "completed", but as "not planned" ;-)Sadly I always forget that is the default behavior...
Vampire
07/17/2024, 3:05 PMsrcDir with SetProperty maybe (instead of srcDirs)Vampire
07/17/2024, 3:05 PMJavi
07/17/2024, 3:06 PMVampire
07/17/2024, 3:13 PMPhilip W
07/17/2024, 3:51 PMJavi
08/03/2024, 4:22 PMsrcDirs it is setSrcDirsVampire
08/03/2024, 5:04 PMsetSrcDirs to wipe and then use srcDirs in the meantimeVampire
08/03/2024, 5:05 PMval foo = objects.setProperty<String>()
foo.add("src/functionalTest")
sourceSets {
main {
java {
setSrcDirs(emptyList<Nothing>())
srcDirs(foo)
}
}
}
foo.add("src/functionalTest2")Javi
08/03/2024, 5:05 PM