Skip to content
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

Auto-generate C# ModuleDef bindings from Rust #1680

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

RReverser
Copy link
Member

Description of Changes

This PR marks entire ModuleDef type tree (with all its dependencies) with derive(SpacetimeType), so that it can be used in any SATS context.

Then, it's used to generate all the C# raw module types instead of us maintaining our own copies, so this PR is a net negative in terms of lines of code we need to maintain, despite the diff stats saying otherwise due to the Autogen folder.

This is the first part of migration to V9 (#1670) and makes the actual migration much easier, since we don't need to update types by hand or worry about mismatches between C# and Rust definitions. We should be able to reuse the same principle and derives to autogenerate type bindings to more languages in the future as well.

In the process I had to make a few semi-related fixes to the generate/csharp.rs, I'm happy to extract them out into their own PR if that's easier to review but it will be a dependency of this one.

API and ABI breaking changes

If this is an API or ABI breaking change, please apply the
corresponding GitHub label.

Expected complexity level and risk

1

How complicated do you think these changes are? Grade on a scale from 1 to 5,
where 1 is a trivial change, and 5 is a deep-reaching and complex change.

This complexity rating applies not only to the complexity apparent in the diff,
but also to its interactions with existing and future code.

If you answered more than a 2, explain what is complex about the PR,
and what other components it interacts with in potentially concerning ways.

Testing

Describe any testing you've done, and any testing you'd like your reviewers to do,
so that you're confident that all the changes work as expected!

  • Ran the usual C# tests.
  • Write a test you want a reviewer to do here, so they can check it off when they're satisfied.

@RReverser RReverser changed the title Move codegen parsing & generation into classes Auto-generate C# ModuleDef bindings from Rust Sep 5, 2024
@RReverser RReverser force-pushed the ingvar/derive-meta-types branch 4 times, most recently from ab0e7f1 to 0b6c0f0 Compare September 6, 2024 16:29
Copy link
Collaborator

@coolreader18 coolreader18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from the rust side

@RReverser RReverser force-pushed the ingvar/derive-meta-types branch from 0b6c0f0 to 0fddd55 Compare September 6, 2024 16:50
Those should just use `GroundSpacetimeType`.
@bfops bfops added the release-any To be landed in any release window label Sep 9, 2024
@RReverser
Copy link
Member Author

Tested with BitCraft; it will need some adjustments (they have some of the constructors that we now autogenerate here, so those manual copies will need to be removed), but otherwise seems to work.

@RReverser RReverser added this pull request to the merge queue Sep 9, 2024
Merged via the queue into master with commit 607f7ce Sep 9, 2024
9 checks passed
@RReverser RReverser deleted the ingvar/derive-meta-types branch September 9, 2024 20:14
RReverser added a commit that referenced this pull request Sep 11, 2024
I missed final regeneration in the ModuleDef generation PR (#1680).
@RReverser RReverser mentioned this pull request Sep 11, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-any To be landed in any release window
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants