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

consolidate source generation #140

Merged
merged 75 commits into from
Jan 23, 2024
Merged

consolidate source generation #140

merged 75 commits into from
Jan 23, 2024

Conversation

elringus
Copy link
Owner

@elringus elringus commented Jan 20, 2024

This moves as much logic as possible out of source generator into the build step, which removes lots of duplicated code between the generator and the builder, as well as allows implementing common build preferences affecting bindings in all the assemblies.

Example on using new preferences attribute to make all bindings declared under "Foo.Bar" C# namespace have "Baz" namespace in JavaScript:

[assembly: JSPreferences(
    Space = ["^Foo\.Bar\.(\S+)", "Baz.$1"]
)]

Resolves #50, resolves #72.

Breaking changes:

  • Removed [JSNamespace] attribute. Generated JS namespace is now customized via Space property of [JSPreferences] attribute.
  • C# class name is now included in generated JS namespaces for both binding objects and types.
  • Global is no longer prepended to the generated JS namespace when binding's type doesn't have namespace.
  • Removed properties from [JSExport] and [JSImport] attributes, that allowed customizing some of the generated content. Associated behaviour (and more) is now customized via [JSPreferences] attribute.
  • Main (entry) file name in generated JavaScript module changed to index.mjs.

Copy link

codecov bot commented Jan 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (33e9742) 100.00% compared to head (0e15293) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #140   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           47        42    -5     
  Lines         1457      1425   -32     
  Branches       235       246   +11     
=========================================
- Hits          1457      1425   -32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@elringus elringus changed the title consolidate source generation, add preferences consolidate source generation Jan 21, 2024
@elringus elringus merged commit 1e6b7e7 into main Jan 23, 2024
8 checks passed
@elringus elringus deleted the feat/intercept branch January 23, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detect when to emit nullable defines in auto-generated C# files Consolidate namespace override mechanism
1 participant