Suppose we have a project in Android Studio (4.1) which is composed of two modules, an android app module and a module that contains a (Kotlin or Java) server application which is supposed to run on a non-android device (probably on localhost, in the first run). Both modules should use protocol buffers (protobuf). For the android app, this already works like a charme. Up to now, the corresponding protobuf definition (.proto) resides within the android module.
Now, I would like to reuse the protobuf definition in the server application module. I know how to make a module dependent on another, which is the way to go in case one would really want to reuse code from the other module. However, I just want to reuse the .proto and run protoc (generate the protobuf sources and headers) in both modules (protobuf-lite vs protobuf, maybe other language).
Maybe this is easy to answer, but I couldn't find a solution that allows sharing a single file between two modules. Can anyone give me hint?
I found this, Managing Shared Protocol Buffer library and using Gradle to Compile , but this solution assumes that the proto definition is somewhere on the net.
question from:https://stackoverflow.com/questions/65841346/how-to-share-a-proto-definition-file-between-an-android-module-and-a-non-android