-
Notifications
You must be signed in to change notification settings - Fork 68
clang-format generated C bindings #736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Approach 1: Do not format generated bindings++ No requirement of clang-format tool Approach 2: Format using default config++ No config file required Approach 3: Copy .clang-format from
|
How about we try if we find Since we generate the code we could dictate the formatting. Do we need to copy the |
It's not strictly necessary. But imagine a situation
I think it's better to save the custom config than passing it as one time through command line. |
Yeah that's true. I wouldn't mind having a config file. I think it is good practise to specify the way code should be formatted, such file does exactly that. If anyone later on doesn't like it, we can always add a config option to not generate the the formatting file. |
* C bindings no longer use fully qualified names. Instead, it uses number-renamed simple names. The classes are sorted in the summarizer to ensure the order is deterministic. This enables shorter symbol names and less verbose bindings. * C bindings are formatted using same style as Dart SDK, using clang-format. If clang-format is not available, jnigen will issue a warning. Closes: #84 * C bindings return `JniResult`. The older `Jni.checkException` stopgap is removed. It reduces one line per function binding in dart. Lastly exceptions will work properly on android Closes: #56
…port. (dart-archive/jnigen#87) * C bindings no longer use fully qualified names. Instead, it uses number-renamed simple names. The classes are sorted in the summarizer to ensure the order is deterministic. This enables shorter symbol names and less verbose bindings. * C bindings are formatted using same style as Dart SDK, using clang-format. If clang-format is not available, jnigen will issue a warning. Closes: https://github.com/dart-lang/jnigen/issues/84 * C bindings return `JniResult`. The older `Jni.checkException` stopgap is removed. It reduces one line per function binding in dart. Lastly exceptions will work properly on android Closes: https://github.com/dart-lang/jnigen/issues/56
It's a good idea if generated bindings are formatted consistently.
In theory we can run
clang-format
on generated .c file once in the generator.In practice user may open the file in an editor with auto format (Eg VSCode with C++ plugin). Then it will reformat the file. (Yes user should not edit the generated file. But one might open the file and press Ctrl+S out of habit, which will reformat.)
Is it a good idea to copy the
.clang-format
file fromjni
package into generated c bindings folder, and format according to that?The text was updated successfully, but these errors were encountered: