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.
29 lines
1018 B
C#
29 lines
1018 B
C#
namespace Semmle.Autobuild
|
|
{
|
|
/// <summary>
|
|
/// Execute the build_command rule.
|
|
/// </summary>
|
|
class BuildCommandRule : IBuildRule
|
|
{
|
|
public BuildScript Analyse(Autobuilder builder, bool auto)
|
|
{
|
|
if (builder.Options.BuildCommand == null)
|
|
return BuildScript.Failure;
|
|
|
|
// Custom build commands may require a specific .NET Core version
|
|
return DotNetRule.WithDotNet(builder, dotNet =>
|
|
{
|
|
var command = new CommandBuilder(builder.Actions, null, dotNet?.Environment);
|
|
|
|
// Custom build commands may require a specific Visual Studio version
|
|
var vsTools = MsBuildRule.GetVcVarsBatFile(builder);
|
|
if (vsTools != null)
|
|
command.CallBatFile(vsTools.Path);
|
|
command.IndexCommand(builder.Odasa, builder.Options.BuildCommand);
|
|
|
|
return command.Script;
|
|
});
|
|
}
|
|
}
|
|
}
|