-
-
Notifications
You must be signed in to change notification settings - Fork 432
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
Conversation
src/bindings/Directory.Build.targets
Outdated
@@ -0,0 +1,6 @@ | |||
<Project> | |||
<ItemGroup> | |||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)silktouch.json" /> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing, dunno why.
There was a problem hiding this comment.
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.
src/bindings/silktouch.json
Outdated
"projects": { | ||
"Silk.NET.Vulkan": { | ||
"scraper": { | ||
|
||
} | ||
} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
src/generators/Silk.NET.SilkTouch.ClangSharp.Xml/Silk.NET.SilkTouch.ClangSharp.Xml.csproj
Outdated
Show resolved
Hide resolved
|
||
namespace Silk.NET.SilkTouch.Configuration | ||
{ | ||
public static class Config |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equals + IgnoreCase?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok fair enough.
There was a problem hiding this comment.
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.
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. |
There was a problem hiding this 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.
src/bindings/Directory.Build.targets
Outdated
@@ -0,0 +1,6 @@ | |||
<Project> | |||
<ItemGroup> | |||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)silktouch.json" /> |
There was a problem hiding this comment.
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.
src/bindings/silktouch.json
Outdated
"projects": { | ||
"Silk.NET.Vulkan": { | ||
"scraper": { | ||
|
||
} | ||
} | ||
} |
There was a problem hiding this comment.
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.
src/generators/Silk.NET.SilkTouch.ClangSharp.Xml/Silk.NET.SilkTouch.ClangSharp.Xml.csproj
Outdated
Show resolved
Hide resolved
|
||
namespace Silk.NET.SilkTouch.Configuration | ||
{ | ||
public static class Config |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
This is ready for another review. |
|
There was a problem hiding this 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
Very very wip
In-scope for this PR
for-contributors
markdownfor-contributors
markdownOut-of-scope for this PR
for-contributors
markdownfor-contributors
markdownfor-contributors
markdown