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
WIP: C#: Generate source files from cshtml files in standalone
#13722
base: main
Are you sure you want to change the base?
Conversation
8bbe61a
to
4307f6d
Compare
| args.Append($"/additionalfile:{f} "); | ||
| } | ||
|
|
||
| var res = dotNet.Exec(args.ToString()); |
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 needs to be reworked. When the application is run through the codeql CLI, the tracer finds this dotnet exec csc call, and it gets extracted. We need a way to opt out of this.
csharp/tools/tracing-config.lua
Outdated
| @@ -138,6 +138,8 @@ function RegisterExtractorPack(id) | |||
| end | |||
|
|
|||
| local windowsMatchers = { | |||
| CreatePatternMatcher({ '^Semmle%.Extraction%.CSharp%.Standalone$' }, | |||
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.
Add %.exe
53ace85
to
78f3a38
Compare
135c032
to
3ac6f8d
Compare
| GenerateAnalyzerConfig(cshtmls, Path.Combine(sourceGeneratorFolder, analyzerConfig)); | ||
|
|
||
| var args = new StringBuilder(); | ||
| args.Append($"{cscPath} --do-not-trace /target:exe /generatedfilesout:{outputFolder} /out:{dllPath} /analyzerconfig:{analyzerConfig} "); |
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.
--do-not-trace is an ugly workaround to the issue I faced with 78f3a38. This call will only work if it is traced. The tracer will remove this argument. (When the standalone extractor is called directly (during debugging or semmle-extractor-options: --standalone), the call will fail.
3ac6f8d
to
8e7e564
Compare
|
After adding the references to the |
| @@ -0,0 +1,3 @@ | |||
| from create_database_utils import * | |||
|
|
|||
| run_codeql_database_create([], lang="csharp", extra_args=["--extractor-option=buildless=true", "--extractor-option=cil=false"]) | |||
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.
recently I changed run_codeql_database to have [] as default command, so to invoke the autobuilder you can simply write
| run_codeql_database_create([], lang="csharp", extra_args=["--extractor-option=buildless=true", "--extractor-option=cil=false"]) | |
| run_codeql_database_create(lang="csharp", extra_args=["--extractor-option=buildless=true", "--extractor-option=cil=false"]) |
| foreach (var f in Directory.GetFiles(sourceGeneratorFolder, "*.dll")) | ||
| { | ||
| args.Append($"/analyzer:{f} "); | ||
| } | ||
| foreach (var f in cshtmls) | ||
| { | ||
| args.Append($"/additionalfile:{f} "); | ||
| } | ||
| foreach (var f in references) | ||
| { | ||
| args.Append($"/reference:{f} "); | ||
| } |
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.
All the paths need to be quoted. (This is the reason why the integration tests fail)
No description provided.