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

Restructured CodeBehindGenerator pipeline #20524

Merged
merged 2 commits into from Feb 23, 2024
Merged

Conversation

mgoertz-msft
Copy link
Contributor

@mgoertz-msft mgoertz-msft commented Feb 12, 2024

Description of Change

  • Restructured CodeBehindGenerator pipeline to maximize SourceGen cachability
  • Split out CSS SourceGen, which does not depend on Compilation at all
  • Added TrackingNames to support new SourceGen unit test project

Before:

stateDiagram-v2
    classDef noisyState fill:red,color:white,font-weight:bold
    AdditionalTextsProvider --> ProjectItemProvider
    AnalyzerConfigOptionsProvider --> ProjectItemProvider   
    CompilationProvider --> XmlnsDefinitionsProvider:::noisyState
    CompilationProvider --> ReferenceTypeCacheProvider:::noisyState
    ProjectItemProvider --> SourceProvider
    XmlnsDefinitionsProvider --> SourceProvider
    ReferenceTypeCacheProvider --> SourceProvider
    CompilationProvider:::noisyState --> SourceProvider
    SourceProvider:::noisyState --> [*] : for Xaml and Css

    note left of CompilationProvider
        Changes constantly!
    end note

After:

stateDiagram-v2
    classDef noisyState fill:red,color:white,font-weight:bold
    AdditionalTextsProvider --> ProjectItemProvider
    AnalyzerConfigOptionsProvider --> ProjectItemProvider   
    ProjectItemProvider --> CssProjectItemProvider : where Kind == CSS
    CssProjectItemProvider --> CssSourceProvider
    CssSourceProvider --> [*]
    ProjectItemProvider --> XamlProjectItemProvider : where Kind == XAML
    CompilationProvider:::noisyState --> ReferenceCompilationProvider : with CompilationReferencesComparer
    ReferenceCompilationProvider --> XmlnsDefinitionsProvider
    ReferenceCompilationProvider --> ReferenceTypeCacheProvider
    XamlProjectItemProvider --> XamlSourceProvider
    XmlnsDefinitionsProvider --> XamlSourceProvider
    ReferenceTypeCacheProvider --> XamlSourceProvider
    ReferenceCompilationProvider --> XamlSourceProvider
    XamlSourceProvider --> [*]

    note left of CompilationProvider
        Changes constantly!
    end note

    note right of ReferenceCompilationProvider
        Rarely changes
    end note

Issues Fixed

…hability

- Split out CSS SourceGen, which does not depend on Compilation at all
- Added TrackingNames to support new SourceGen unit test project

Fixes Issue #12978 CodeBehindGenerator has improper pipeline
Fixes AB#1947659: `CodeBehindGenerator` has improper pipeline
Comment on lines 21 to 26
$@"
h1 {{color: purple;
background-color: lightcyan;
font-weight: 800;
}}
";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be good to use raw-string literals?

@@ -0,0 +1,16 @@
namespace Microsoft.Maui.Controls.SourceGen
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe file-scoped namespace would lead to unified code with the rest of PR

jsuarezruiz
jsuarezruiz previously approved these changes Feb 13, 2024
- Use raw string literals for SourceGen tests
@rmarinho rmarinho merged commit 4fa29bc into main Feb 23, 2024
47 of 49 checks passed
@rmarinho rmarinho deleted the dev/mgoertz/sourcegen branch February 23, 2024 16:02
rmarinho pushed a commit that referenced this pull request Feb 27, 2024
* - Restructured CodeBehindGenerator pipeline to maximize SourceGen cachability
- Split out CSS SourceGen, which does not depend on Compilation at all
- Added TrackingNames to support new SourceGen unit test project

Fixes Issue #12978 CodeBehindGenerator has improper pipeline
Fixes AB#1947659: `CodeBehindGenerator` has improper pipeline

* - Use file-scoped namespaces throughout PR
- Use raw string literals for SourceGen tests
@github-actions github-actions bot locked and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants