dropbox / djinni

A tool for generating cross-language type declarations and interface bindings.
Apache License 2.0
2.88k stars 487 forks source link

Raise an error when C++ header output folder is equal to JNI header output folder #380

Closed jonmcclung closed 6 years ago

jonmcclung commented 6 years ago

I'm trying to get started with Djinni and I couldn't figure out why I seemed not to have all the headers I needed until I realized the JNI headers were overwriting the C++ headers. This is because I had them set to output to the same directory and they are given the same names. My suggestion for how to address this would be to raise an error when both of these files are set to output to the same directory.

artwyman commented 6 years ago

I think generating them into the same directory isn't an error, though generating multiple files with the same path is. In the example apps (and in our real apps at Dropbox) we put the prefix Native on the name of the JNI C++ files, so the names don't collide.

It would be possible for Djinni to detect and avoid name collisions. It could be done by tracking the list of files created over a full generation run to look for duplicates. Right now all the files are generated independently, though.