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

Reuse more Microsoft.Interop.SourceGeneration code in JS generators #74949

Merged
merged 4 commits into from
Sep 9, 2022

Conversation

jkoritzinsky
Copy link
Member

Reuse more of the code in Microsoft.Interop.SourceGeneration in the JavaScript source generators instead of duplicating the logic.

Refactor the JavaScript generators to use the GeneratedStatements type instead of providing its own JSGeneratedStatements type.

Refactor the JSSignatureContext type to wrap a SignatureContext instead of providing a very similar surface area with a lot of duplicated code.

This PR also enhances the API surface of types in Microsoft.Interop.SourceGeneration to enable these sorts of scenarios.

@jkoritzinsky
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lewing
Copy link
Member

lewing commented Sep 2, 2022

the wasm built test failures are likely from #74897

@ericstj @danmoseley can you verify?

@ericstj
Copy link
Member

ericstj commented Sep 2, 2022

Yes:

        [Debug_ts3wnijw.n3w] CSC : warning CS8784: Generator 'JSExportGenerator' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.Interop.SourceGeneration, Version=42.42.42.42, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.' [C:\helix\work\workitem\e\Debug_ts3wnijw.n3w\Debug_ts3wnijw.n3w.csproj]

That's been fixed now, we can retrigger the pipeline.

@ericstj
Copy link
Member

ericstj commented Sep 2, 2022

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(GeneratorVersion)))
}))))));
}
string stubTypeFullName = method.ContainingType.ToDisplayString(new SymbolDisplayFormat(typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces));
Copy link
Member

Choose a reason for hiding this comment

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

NameAndContainingTypesAndNamespaces is better than what we have in the GetFullyQualifiedMethodName and s_typeNameFormat, please unify it.

Copy link
Member

Choose a reason for hiding this comment

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

If we use NameAndContainingTypesAndNamespaces in GetFullyQualifiedMethodName, how do we determine which "." separate class names and which namespace names?

Context: mono special naming convention requires to separate class names with / and namespaces with '.'.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think to meet the Mono naming requirements with NameAndContainingTypesAndNamespaces would require us to go back to using ToDisplayParts(). I'll leave that for now since we just moved away from that.

Copy link
Member

@pavelsavara pavelsavara left a comment

Choose a reason for hiding this comment

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

love it!

@jkoritzinsky
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky
Copy link
Member Author

Failures are #75329 and #75378

Merging this in

@jkoritzinsky jkoritzinsky merged commit c746b8b into dotnet:main Sep 9, 2022
@jkoritzinsky jkoritzinsky deleted the pinned-marshal-jsgen branch September 9, 2022 22:08
@ghost ghost locked as resolved and limited conversation to collaborators Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime.InteropServices.JavaScript source-generator Indicates an issue with a source generator feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants