mirror of
https://github.com/github/codeql.git
synced 2026-04-20 06:24:03 +02:00
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using Semmle.Autobuild.Shared;
|
|
|
|
namespace Semmle.Autobuild.CSharp
|
|
{
|
|
/// <summary>
|
|
/// Build using standalone extraction.
|
|
/// </summary>
|
|
internal class StandaloneBuildRule : IBuildRule<CSharpAutobuildOptions>
|
|
{
|
|
private readonly string? dotNetPath;
|
|
|
|
internal StandaloneBuildRule(string? dotNetPath)
|
|
{
|
|
this.dotNetPath = dotNetPath;
|
|
}
|
|
|
|
public BuildScript Analyse(IAutobuilder<CSharpAutobuildOptions> builder, bool auto)
|
|
{
|
|
if (builder.CodeQLExtractorLangRoot is null
|
|
|| builder.CodeQlPlatform is null)
|
|
{
|
|
return BuildScript.Failure;
|
|
}
|
|
|
|
var standalone = builder.Actions.PathCombine(builder.CodeQLExtractorLangRoot, "tools", builder.CodeQlPlatform, "Semmle.Extraction.CSharp.Standalone");
|
|
var cmd = new CommandBuilder(builder.Actions);
|
|
cmd.RunCommand(standalone);
|
|
|
|
if (!string.IsNullOrEmpty(this.dotNetPath))
|
|
{
|
|
cmd.Argument("--dotnet");
|
|
cmd.QuoteArgument(this.dotNetPath);
|
|
}
|
|
|
|
return cmd.Script;
|
|
}
|
|
}
|
|
}
|