mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
This commit fixes a few issues that were identified during the last dist upgrade,
and which were introduced/revealed on 836daaf07b.
- Expand environment variables that are passed from `lgtm.yml` to the autobuilder,
for example `solution: $LGTM_SRC/mysolution.sln`.
- Distinguish between when a build rule is applied automatically and when it is applied
manually via `lgtm.yml`.
- Catch `FileNotFoundException`s when parsing project files and solution files.
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using System.IO;
|
|
|
|
namespace Semmle.Autobuild
|
|
{
|
|
/// <summary>
|
|
/// Build using standalone extraction.
|
|
/// </summary>
|
|
class StandaloneBuildRule : IBuildRule
|
|
{
|
|
public BuildScript Analyse(Autobuilder builder, bool auto)
|
|
{
|
|
BuildScript GetCommand(string solution)
|
|
{
|
|
var standalone = builder.Actions.PathCombine(builder.SemmlePlatformTools, "csharp", "Semmle.Extraction.CSharp.Standalone");
|
|
var cmd = new CommandBuilder(builder.Actions);
|
|
cmd.RunCommand(standalone);
|
|
|
|
if (solution != null)
|
|
cmd.QuoteArgument(solution);
|
|
|
|
cmd.Argument("--references:.");
|
|
|
|
if (!builder.Options.NugetRestore)
|
|
{
|
|
cmd.Argument("--skip-nuget");
|
|
}
|
|
|
|
return cmd.Script;
|
|
}
|
|
|
|
if (!builder.Options.Buildless)
|
|
return BuildScript.Failure;
|
|
|
|
var solutions = builder.Options.Solution.Length;
|
|
|
|
if (solutions == 0)
|
|
return GetCommand(null);
|
|
|
|
var script = BuildScript.Success;
|
|
foreach (var solution in builder.Options.Solution)
|
|
script &= GetCommand(solution);
|
|
|
|
return script;
|
|
}
|
|
}
|
|
}
|