We have a large project with many proto-files. Many of those contain messages that are no longer used anywhere, and hence I'd like to delete them. However, due to the size of the project, it's non-trivial to see, which of those messages are still necessary and which ones are not.
My initial approach was something like comment-out the message and comment back-in until the compiler is happy (Java, C++). Unfortunately, we also have significant amounts of python, where this approach doesn't work and always running all test-cases is too expensive.
Has anyone faced this kind of situation before? Are there any tools that can help detect unused protobuf-messages across Java, C++ and Python?
EDIT:
I should probably add, we currently (still) have all its usages under our control, so nobody outside our project is using them.
It's an interesting question but I suspect (!?) the challenge for a tool is that it's difficult (impossible?) to determine your protos' downstream dependencies.
The protobuf sources are compiled to at least one language's sources and these sources are then imported as dependencies into code. This code is itself (often) compiled and bundled (e.g. as a container image somewhere) and deployed into production.
Additionally, protos are often distributed to others (other teams, departments, organizations etc.) by way of defining software interfaces and each of these entities creates the same downstream digital chain.
Rather than "delete" (erase), you may wish to have a formal archival process either in-place by commenting out messages or moving protos to an archival directory.
Either of these approaches should permit you to detect future compilation errors and recover the messages if necessary.
It may be prudent to ensure that, when messages become redundant, the process includes the above archival mechanism as the formal archival mechanism rather than as a periodic "Let's go looking for redudnancies".
Find unused protobuf messages