https://kotlinlang.org logo
g

GarouDan

02/08/2019, 6:14 PM
Hi guys, can we filter the packages to be considered inside of a source set? For example, are we able to do something like this?
Copy code
sourceSets {
		val jvmMain by getting {
			kotlin.srcDir("src/main/kotlin")
			resources.srcDir("src/main/resources")
			filterPackages("com.company.project.jvm") // filtering packages here
		}
My motivation is to try to join all sources in the same folder, for example
src/main/kotlin
. If we are to do this we could create some packages like:
com.company.project.common
,
com.company.project.js
,
com.company.project.jvm
Where all of them could be inside the
src/main/kotlin
.
😱 1
1
d

Dominaezzz

02/08/2019, 7:08 PM
This is indeed possible. Instead of filtering, just use the package folder as the source folder.
Wouldn't really recommend doing it though.
g

GarouDan

02/08/2019, 7:47 PM
Oh, thanks, I’ll give it a try. But why not? This is a dream for me. If organize things well we will neve try to use something that will not work. For example, everything in common should work to everything, everything in js should work only for js and everything in js.react, for example, should work only with js react applications.
d

Dominaezzz

02/08/2019, 7:51 PM
They should have different "packages", only different source sets. The platform specific code shouldn't have to be in a separate packages. It seems rather artificial.
2 Views