Dariusz Kuc
02/08/2021, 7:42 PM// settings.gradle.kts
File(rootDir, "src/main/proto").listFiles()?.filter { directory ->
directory.isDirectory && java.nio.file.Files.walk(directory.toPath())
.filter { it.toString().endsWith(".proto") }
.findAny()
.isPresent
}?.forEach { service ->
include(":services:${service.name}-model")
}
And then in the build file
configure(subprojects.filter { it.name != "services" }) {
val service = this.name
tasks {
val serviceJar by registering(Jar::class) {
from(rootProject.sourceSets["main"].output) {
include("$service/**")
}
}
val sourcesJar by registering(Jar::class) {
archiveClassifier.set("sources")
from(rootProject.sourceSets.main.get().allSource) {
include("$service/**")
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
artifact(serviceJar)
artifact(sourcesJar)
}
}
}
}
}
Problems arise if I want to verify whether those smaller repackaged JARs are valid, i.e. proto definitions can reference some files from other (common) packages. I'm thinking that I could store those dependencies in build configuration, e.g. just a map of package to list of dependent packages which could then be used to populate POM dependencies.
The problem I'm trying to figure out id how to validate the resulting JARs at build time (whether it specifies all the necessary dependencies) - any ideas how to re-trigger compilation of the specific sources?tapchicoma
02/08/2021, 9:19 PMfinalizedBy
Dariusz Kuc
02/08/2021, 9:25 PMDariusz Kuc
02/08/2021, 9:27 PMtapchicoma
02/08/2021, 9:31 PMtapchicoma
02/08/2021, 9:31 PMDariusz Kuc
02/08/2021, 9:36 PM$service
from the above then it will fail if I am missing some inter module dependenciesDariusz Kuc
02/08/2021, 9:37 PMDariusz Kuc
02/08/2021, 9:38 PMDariusz Kuc
02/08/2021, 9:38 PMDariusz Kuc
02/08/2021, 9:39 PMtapchicoma
02/08/2021, 9:50 PM