After digging for a while, I found a solution myself. I don't know if it is the best, so please comment and let me know what you think.
I just moved my definition file out of the module subdirectory to the top level project directory, in src/main/proto
. From each module, I just add this directory to the proto srcSet. So for the android app:
android {
sourceSets {
main {
proto {
srcDir '../src/main/proto'
}
}
}
}
and for the Java/Kotlin non-android application
sourceSets {
main {
proto {
proto.srcDirs = ['../src/main/proto']
}
}
}
This works as aspected, and I don't have to maintain the .proto-file at different locations. However, are there any drawbacks to move code or code-like files to the top-level of a gradle project?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…