Skip to content

Conversation

@souryavarenya
Copy link
Contributor

@souryavarenya souryavarenya commented Aug 2, 2025

This PR attempts to resolve #6770

This PR takes inspiration from #8003, and adds a couple more improvements.

@github-actions github-actions bot added c++ codegen Involving generating code from schema labels Aug 2, 2025
@github-actions github-actions bot added the python label Aug 2, 2025
@souryavarenya
Copy link
Contributor Author

@aardappel Could you please review this?

A couple of notes:

  • The bazel flatc generation options for tests differ from the cmake flatc gen options. It is outside the scope of this PR, but might make sense to reconcile them both?
  • How is the tests/native_type_test_generated.h file generated? Is the purpose of this file to visualize codegen? I added this file to the generate_code script for safe measure. However this file seems to interfere with the CMake build since it prefers this committed file over the codegen from CMake. Is that the intended workflow?

@souryavarenya souryavarenya marked this pull request as ready for review August 3, 2025 09:35
@aardappel
Copy link
Collaborator

  • I am not too familiar with Bazel but yes it probably should.
  • Yes, part of the purpose of this project is to generate code, so we need the generated code as part of the repo to be able to see changes to it as part of a diff, as opposed to the common wisdom that generated files should not be in the repo.

@aardappel
Copy link
Collaborator

Please see the errors in CI, it is actually checking for differences between the python script and CMake which you are violating :)

@souryavarenya
Copy link
Contributor Author

@aardappel Gotcha! I removed --gen-compare option from the native_type_test to (hopefully) fix the CI errors.

@aardappel aardappel merged commit 34af7ff into google:master Aug 3, 2025
51 checks passed
@aardappel
Copy link
Collaborator

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++] Using native_type fields without native_inline generates broken code

2 participants