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

[RGen] First inclusion of a roslyn generator for the bindings. #21389

Merged
merged 27 commits into from
Oct 15, 2024

Conversation

mandel-macaque
Copy link
Member

We are doing the following:

  1. Adding the rgen directory with the following solutions:
    • Analyzer: Analyzer that will catch errors in the bindings. At the moment it provides a single error when the BindingTypeAttribute is used in a nont partial type.
    • Analyzer Tests: Allows tests for the analyzer.
    • Analyzer Sample: Sample project to test the analyzer.
    • Code Generator: A code generator that adds the BindingTypeAttribute to the compilcation.
    • Code Generator Tests: Allows tests for the generator.
    • Code Sample: Sample project for the code generator.
  2. Make rule to build the roslyn code generator.
  3. Makefile changes to add the code generator as part as the second compilation of the bindings.

This changes add the starting gounds to move to roslyn.

We are doing the following:

1. Adding the rgen directory with the following solutions:
   * Analyzer: Analyzer that will catch errors in the bindings. At the
     moment it provides a single error when the BindingTypeAttribute is
     used in a nont partial type.
   * Analyzer Tests: Allows tests for the analyzer.
   * Analyzer Sample: Sample project to test the analyzer.
   * Code Generator: A code generator that adds the BindingTypeAttribute
     to the compilcation.
   * Code Generator Tests: Allows tests for the generator.
   * Code Sample: Sample project for the code generator.
2. Make rule to build the roslyn code generator.
3. Makefile changes to add the code generator as part as the second
   compilation of the bindings.

This changes add the starting gounds to move to roslyn.
Copy link
Contributor

github-actions bot commented Oct 8, 2024

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

protected CSharpGeneratorDriver _driver;
protected PortableExecutableReference [] _references;
// HACK: this is a hack to get the runtime dll for the attributes
const string RuntimeDll = "/Users/mandel/Xamarin/xamarin-macios/xamarin-macios/src/build/dotnet/ios/64/Microsoft.iOS.dll";
Copy link
Member Author

Choose a reason for hiding this comment

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

Ugh, I need to fix this for the tests. @haritha-mohan can you do the same trick you do with adr here?

src/Makefile Outdated Show resolved Hide resolved
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Member

@rolfbjarne rolfbjarne left a comment

Choose a reason for hiding this comment

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

The tests should be executed when the generator/bgen tests are executed in xharness as well.

@@ -0,0 +1,26 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

Either remove or uncomment/fix.

@@ -0,0 +1,32 @@
/*
Copy link
Member

Choose a reason for hiding this comment

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

Either remove or uncomment/fix.

Comment on lines 17 to 18
/// A sample code fix provider that renames classes with the company name in their definition.
/// All code fixes must be linked to specific analyzers.
Copy link
Member

Choose a reason for hiding this comment

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

This comment is out of date.

src/rgen/Microsoft.Macios.Generator/ExtraSources.cs Outdated Show resolved Hide resolved
src/Makefile.rgenerator Outdated Show resolved Hide resolved
src/Makefile Outdated Show resolved Hide resolved
Copy link
Member

@rolfbjarne rolfbjarne left a comment

Choose a reason for hiding this comment

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

The tests should be executed when the generator/bgen tests are executed in xharness as well.

Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build] Build failed 🔥

Build failed for the job 'Build packages'

Pipeline on Agent
Hash: cbeddc34fef102fa66bdf6cdea9dffda8ae9d6aa [PR build]

1. Allow the tests to use the compiled dlls for dotnet.
2. Added an example test for the code generator.
3. Added an example test for the analyzer.
4. Included the new test projects in xharness.
…arin-macios into dev/mandel/rgen-init-project
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: dcd362b1ff3fe6b120c9f16958ad2ed5f6e8dc2a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET (No breaking changes)

✅ API diff vs stable

.NET (No breaking changes)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: dcd362b1ff3fe6b120c9f16958ad2ed5f6e8dc2a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: dcd362b1ff3fe6b120c9f16958ad2ed5f6e8dc2a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: dcd362b1ff3fe6b120c9f16958ad2ed5f6e8dc2a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: dcd362b1ff3fe6b120c9f16958ad2ed5f6e8dc2a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 1 tests failed, 100 tests passed.

Failures

❌ dotnettests tests (macOS)

1 tests failed, 0 tests passed.
  • DotNet tests: Failed (Execution failed with exit code 1)

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 3 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 40 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 7 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 8 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 7 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: dcd362b1ff3fe6b120c9f16958ad2ed5f6e8dc2a [PR build]

@mandel-macaque mandel-macaque merged commit 0f35909 into main Oct 15, 2024
17 checks passed
@mandel-macaque mandel-macaque deleted the dev/mandel/rgen-init-project branch October 15, 2024 18:56
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.

4 participants