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] Do not pass the root binding context around. #21945

Merged
merged 7 commits into from
Jan 13, 2025

Conversation

mandel-macaque
Copy link
Member

@mandel-macaque mandel-macaque commented Jan 11, 2025

There is no need to pass the root binding around to be able to generate the Library.g.cs. What we can do is change the code to have to diff incremental code provides.

  1. A provider that will detect code changes.
  2. A provider that will detect changes that required a Library.g.cs change.

To achieve the above what we do is to add the library information when we detect code changes. This new fields that provide the library information are then collected to trigger a new generation event.

mandel-macaque and others added 2 commits January 11, 2025 14:40
There is no need to pass the root biding around to be able to gernerate
the Library.g.cs. What we can do is change the code to have to diff
incremental code provides.

1. A provider that will detect code changes.
2. A provider that will detect changes that required a Library.g.cs
   change.

To achieve the above what we do is to add the library information when
we detect code changes. This new fields that provide the library
information are then collected to trigger a new generation event.
Copy link
Contributor

⚠️ 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).

@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

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@mandel-macaque
Copy link
Member Author

/azp run xamarin-macios-pr

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 14 changed files in this pull request and generated no comments.

Files not reviewed (9)
  • src/rgen/Microsoft.Macios.Generator/Emitters/EnumEmitter.cs: Evaluated as low risk
  • src/rgen/Microsoft.Macios.Generator/Context/BindingContext.cs: Evaluated as low risk
  • tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/EnumMemberCodeChangesTests.cs: Evaluated as low risk
  • tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/EnumMembersEqualityComparerTests.cs: Evaluated as low risk
  • tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/CodeChangesEqualityComparerTests.cs: Evaluated as low risk
  • tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/CodeChangesComparerTests.cs: Evaluated as low risk
  • tests/rgen/Microsoft.Macios.Generator.Tests/SmartEnum/SmartEnumDiagnosticsTests.cs: Evaluated as low risk
  • tests/rgen/Microsoft.Macios.Generator.Tests/Context/RootBindingContextTests.cs: Evaluated as low risk
  • src/rgen/Microsoft.Macios.Generator/DataModel/EnumMember.cs: Evaluated as low risk
Comments suppressed due to low confidence (3)

src/rgen/Microsoft.Macios.Generator/BindingSourceGeneratorGenerator.cs:74

  • [nitpick] The variable name 'RootBindingContext' is ambiguous and inconsistent with its usage. It should be renamed to 'bindingContext' for clarity.
static (RootBindingContext RootBindingContext, CodeChanges Changes, bool BindingAttributeFound) GetChangesForSourceGen (GeneratorSyntaxContext context)

src/rgen/Microsoft.Macios.Generator/BindingSourceGeneratorGenerator.cs:148

  • The 'RootBindingContext' is being accessed from 'libraryChanges' but is not used consistently. Ensure that the context is used correctly and consistently throughout the code.
var rootBindingContext = libraryChanges [0].RootBindingContext;

src/rgen/Microsoft.Macios.Generator/DataModel/CodeChanges.cs:311

  • Ensure that the Skip method is comprehensive enough to handle all potential cases that might need to be skipped.
if (Skip (enumValueDeclaration, context.SemanticModel))
mandel-macaque added a commit that referenced this pull request Jan 12, 2025
We cannot use Export because we need to be ablet to pass the library
name to generate the property field correctly. This change moves from
using Export<Field> to Field<Property> which allows to mark a property
as a field AND will allow use to add the library name.

This change + the one in PR
#21945 improves the way
the Library.g.cs file is generated.
@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

✅ [PR Build] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 71ef2b387ad86599f86b2dede2546127d4dfe6d7 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 71ef2b387ad86599f86b2dede2546127d4dfe6d7 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET ( No breaking changes )

❗ API diff vs stable (Breaking changes)

.NET ( ❗ Breaking changes ❗ )

ℹ️ Generator diff

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

Pipeline on Agent
Hash: 71ef2b387ad86599f86b2dede2546127d4dfe6d7 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 71ef2b387ad86599f86b2dede2546127d4dfe6d7 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 71ef2b387ad86599f86b2dede2546127d4dfe6d7 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 71ef2b387ad86599f86b2dede2546127d4dfe6d7 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 71ef2b387ad86599f86b2dede2546127d4dfe6d7 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 71ef2b387ad86599f86b2dede2546127d4dfe6d7 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 71ef2b387ad86599f86b2dede2546127d4dfe6d7 [PR build]

@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] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

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

Failures

❌ cecil tests

🔥 Failed catastrophically on VSTS: test results - cecil (no summary found).

Html Report (VSDrops) Download

Successes

✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): 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 5 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 10 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 10 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 8 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: 71ef2b387ad86599f86b2dede2546127d4dfe6d7 [PR build]

@mandel-macaque
Copy link
Member Author

Cecil failures are due to bot issues. Unrelated with the PR.

@mandel-macaque mandel-macaque merged commit 5b2e265 into main Jan 13, 2025
46 of 48 checks passed
@mandel-macaque mandel-macaque deleted the dev/mandel/keep-track-libs-code-change branch January 13, 2025 17:54
mandel-macaque added a commit that referenced this pull request Jan 13, 2025
We cannot use Export because we need to be ablet to pass the library
name to generate the property field correctly. This change moves from
using Export<Field> to Field<Property> which allows to mark a property
as a field AND will allow use to add the library name.

This change + the one in PR
#21945 improves the way
the Library.g.cs file is generated.
mandel-macaque added a commit that referenced this pull request Jan 14, 2025
We cannot use Export because we need to be ablet to pass the library
name to generate the property field correctly. This change moves from
using Export<Field> to Field<Property> which allows to mark a property
as a field AND will allow use to add the library name.

This change + the one in PR
#21945 improves the way
the Library.g.cs file is generated.

---------

Co-authored-by: GitHub Actions Autoformatter <[email protected]>
mandel-macaque added a commit that referenced this pull request Jan 14, 2025
We cannot use Export because we need to be ablet to pass the library
name to generate the property field correctly. This change moves from
using Export<Field> to Field<Property> which allows to mark a property
as a field AND will allow use to add the library name.

This change + the one in PR
#21945 improves the way
the Library.g.cs file is generated.
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