I used Sample structuring software projects as inspiration to structure my project but I have run into a problem on now best to decare file dependencies between module
I have a folder strukture like this (super psudo code but I hope you get the idea)
One way to do it is to create a new dependency configuration that uses variant attributes to select the resources (such a variant is produced by the java plugin).
Since inputSpec is a Property<String>, we can use a provider to transform our new dependency config into a single file.
plugins {
id 'java'
id "org.openapi.generator" version "6.0.0"
}
configurations {
openapi {
canBeConsumed = false
canBeResolved = true
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.RESOURCES))
}
}
}
dependencies {
openapi 'your.group:game-manager' // the module containing the openapi.yaml
}
openApiGenerate {
skipValidateSpec = true
generatorName = "spring"
inputSpec = providers.provider {
// find the first matching file, returning null if not found
configurations.openapi.asFileTree.files.find {
it.name == 'openapi.yaml'
}?.absolutePath
}
}
This could be more nicely abstracted out of the buildscript and into a plugin that is part of your project.