Skip to content

Conversation

@DustinCampbell
Copy link
Member

This change converts RazorConfiguration, RazorLanguageVersion, and RazorExtension to sealed records and removes all extraneous subtypes. To achieve this, I've also removed the AssemblyExtension type along with ProvideRazorExtensionInitializerAttribute. After the compiler assembly merge, the set of Razor extensions is known. So, I've removed the reflection code that would initialize a Razor extension and just handle the extensions statically.

Now that the compiler assemblies have been merged, we can go avoid using assembly-level attributes and reflection to initialize Razor extensions.
@DustinCampbell DustinCampbell requested review from a team as code owners February 27, 2024 19:02
Copy link
Member

Choose a reason for hiding this comment

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

This is used in the SDK:

https://github.com/dotnet/sdk/blob/a307f6e91c797ddcdac0f6ef70997bae807e7ece/src/RazorSdk/Tool/GenerateCommand.cs#L91

Are you planning to update that as well?

(Note: it would be probably best to bring the whole RazorTool from sdk repo to this repo to avoid these kind of breaks.)

Copy link
Member Author

Choose a reason for hiding this comment

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

FWIW, it looks to me like that instantiation of AssemblyExtension is never even used. 😄

Copy link
Member Author

@DustinCampbell DustinCampbell Feb 28, 2024

Choose a reason for hiding this comment

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

Ah, no. it's likely used by this code, which I'm removing. I have no idea how to update the SDK with new packages, so I'm not really sure how to make the ultimate change. However, I'm cloning the repo and will have commits in a branch ready for when we flow into the SDK.

Copy link
Member Author

Choose a reason for hiding this comment

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

And yes, we should definitely bring all of that over to this repo. 👍

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've created DustinCampbell/sdk@6425721 to fix up the source breaks in the Razor SDK tools. However, these tools look even more suspect right now, since they take arguments to specify extension file paths and names that will effectively be ignored. I'm not sure how or if those are used though.

Copy link
Member

Choose a reason for hiding this comment

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

However, these tools look even more suspect right now, since they take arguments to specify extension file paths and names that will effectively be ignored. I'm not sure how or if those are used though.

They are not used anymore, there's a hardcoded mapping:

https://github.com/dotnet/sdk/blob/31a233ddc8afc91ae67f9ceb4f6d74e5707685d8/src/RazorSdk/Tool/DiscoverCommand.cs#L102-L137

I've created DustinCampbell/sdk@6425721 to fix up the source breaks in the Razor SDK tools.

LGTM, thanks.

@DustinCampbell
Copy link
Member Author

@jjonescz: Any other concerns? Just need a second sign off from the compiler team.

Copy link
Member

@jjonescz jjonescz left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

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.

6 participants