Skip to content

Pass 1 of SilkTouch Scraper - Joint Infrastructure and XML Generation #559

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

Merged
merged 10 commits into from
Jan 28, 2022

Conversation

Perksey
Copy link
Member

@Perksey Perksey commented Aug 5, 2021

Very very wip

In-scope for this PR

  • Barebones joint Roslyn/CLI infrastructure is working
    • Documented with for-contributors markdown
  • XML generation is working
    • Documented with for-contributors markdown

Out-of-scope for this PR

  • XML parsing is working
    • Documented with for-contributors markdown
  • XML mods are working
    • Documented with for-contributors markdown
  • XML transformation to C# code is working
    • Documented with for-contributors markdown
  • User documentation?

@Perksey Perksey added this to the 3.0 milestone Aug 5, 2021
@Perksey Perksey self-assigned this Aug 5, 2021
@Perksey Perksey changed the title SilkTouch Scraper Pass 1 of SilkTouch Scraper - Joint Infrastructure and XML Generation Aug 5, 2021
@@ -0,0 +1,6 @@
<Project>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)silktouch.json" />
Copy link
Member

Choose a reason for hiding this comment

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

That seems weird, why do all bindings share this file?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changing, dunno why.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to use one file per project with an optional "global file" for common config i.e. license header.

Comment on lines 5 to 11
"projects": {
"Silk.NET.Vulkan": {
"scraper": {

}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

have you considered, instead of doing this, doing the configuration in the actual project? like... this seems pointless.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changing to be per-project

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to use one file per project with an optional "global file" for common config i.e. license header.


namespace Silk.NET.SilkTouch.Configuration
{
public static class Config
Copy link
Member

Choose a reason for hiding this comment

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

please no
Microsoft.Extensions.Configuration > static class Config

Copy link
Member Author

@Perksey Perksey Aug 6, 2021

Choose a reason for hiding this comment

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

I don't think that package is applicable here. This is just a simple JSON configuration, we don't have massive infrastructure, extensibility concerns, or anything else that could possibly warrant a dedicated configuration package. I'm all for using smart libraries, but only when we actually need to do smart things. I'm not going to force packages into the codebase where they're not needed.

If you read the code for this particular class, these are just helpers and wrappers for loading configuration to reduce verbosity elsewhere in the codebase. It holds no state whatsoever.

Copy link
Member

Choose a reason for hiding this comment

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

The Configuration package is tiny and would allow us to use different configuration sources, use configuration sections, etc.
It would allow us to separate the configuration of the different stages entirely, which I think is very desirable.

Copy link
Member Author

Choose a reason for hiding this comment

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

The Configuration package in particular doesn't really make much sense outside of the hosting infrastructure or any other scenario where we might abstractions or injection. Moreover, it makes it far less obvious what's actually going on during configuration loading.

We really don't need this at all.

Copy link
Member Author

Choose a reason for hiding this comment

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

No change deemed necessary. If this is a requirement please close this PR.

// the performance is horrible but it's not too much a cause for concern as it is a "fixed cost".
// definitely improve it in the future though as we do have access to new string(char*), meaning we can
// come up with a Span-based solution it'll just be very very very verbose.
if (kvp[0].ToLower().Trim() == "hint" && Enum.TryParse
Copy link
Member

Choose a reason for hiding this comment

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

Equals + IgnoreCase?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to Equals + IgnoreCase.

{
public static class ScraperGenerationExtensions
{
public static async ValueTask<bool> RunScraperAsync<T>(this SilkTouchGenerator generator)
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't feel very ValueTask to me?

Copy link
Member Author

Choose a reason for hiding this comment

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

This has been changed to Task.

public sealed record SilkTouchContext
(
string AssemblyName,
IEnumerable<CSharpSyntaxTree> SyntaxTrees,
Copy link
Member

Choose a reason for hiding this comment

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

I need a compilation. Without a Compilation Overloads & Emitter probably won't work

Copy link
Member Author

Choose a reason for hiding this comment

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

What specifically do you need from the compilation though?

Copy link
Member

Choose a reason for hiding this comment

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

like the semantic model and stuff?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok fair enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now passing the Compilation to SilkTouchContext.

@Perksey Perksey mentioned this pull request Aug 10, 2021
13 tasks
@Perksey Perksey marked this pull request as ready for review August 10, 2021 18:43
@Perksey
Copy link
Member Author

Perksey commented Aug 10, 2021

This is as far as this PR will progress. It is 100% XML documented and has contributor documentation describing the general implementation design. This is ready for review.

Copy link
Member Author

@Perksey Perksey left a comment

Choose a reason for hiding this comment

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

Apparently I had review comments pending so forgive me if these are outdated and invalid, I can't be bothered to read through them lol.

@@ -0,0 +1,6 @@
<Project>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)silktouch.json" />
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to use one file per project with an optional "global file" for common config i.e. license header.

Comment on lines 5 to 11
"projects": {
"Silk.NET.Vulkan": {
"scraper": {

}
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to use one file per project with an optional "global file" for common config i.e. license header.


namespace Silk.NET.SilkTouch.Configuration
{
public static class Config
Copy link
Member Author

Choose a reason for hiding this comment

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

No change deemed necessary. If this is a requirement please close this PR.

// the performance is horrible but it's not too much a cause for concern as it is a "fixed cost".
// definitely improve it in the future though as we do have access to new string(char*), meaning we can
// come up with a Span-based solution it'll just be very very very verbose.
if (kvp[0].ToLower().Trim() == "hint" && Enum.TryParse
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to Equals + IgnoreCase.

public sealed record SilkTouchContext
(
string AssemblyName,
IEnumerable<CSharpSyntaxTree> SyntaxTrees,
Copy link
Member Author

Choose a reason for hiding this comment

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

Now passing the Compilation to SilkTouchContext.

{
public static class ScraperGenerationExtensions
{
public static async ValueTask<bool> RunScraperAsync<T>(this SilkTouchGenerator generator)
Copy link
Member Author

Choose a reason for hiding this comment

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

This has been changed to Task.

@Perksey Perksey requested a review from HurricanKai August 10, 2021 18:54
@Perksey Perksey assigned HurricanKai and unassigned Perksey Aug 23, 2021
@Perksey
Copy link
Member Author

Perksey commented Aug 27, 2021

This is ready for another review.

@Perksey
Copy link
Member Author

Perksey commented Nov 5, 2021

Copy link
Member

@HurricanKai HurricanKai left a comment

Choose a reason for hiding this comment

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

Merging to continue editing

@HurricanKai HurricanKai merged commit 3268e1b into develop/3.0 Jan 28, 2022
@HurricanKai HurricanKai deleted the feature/3.0/silktouch-scraper branch January 28, 2022 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants