mirror of
https://github.com/github/codeql.git
synced 2025-12-17 17:23:36 +01:00
The following environment variables are no longer supported: ``` ODASA_BUILD_ERROR_DIR ODASA_CSHARP_LAYOUT ODASA_SNAPSHOT SEMMLE_DIST SEMMLE_EXTRACTOR_OPTIONS SEMMLE_PLATFORM_TOOLS SEMMLE_PRESERVE_SYMLINKS SOURCE_ARCHIVE TRAP_FOLDER ```
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
namespace Semmle.Autobuild.Shared
|
|
{
|
|
/// <summary>
|
|
/// Execute the build_command rule.
|
|
/// </summary>
|
|
public class BuildCommandRule : IBuildRule
|
|
{
|
|
private readonly WithDotNet withDotNet;
|
|
|
|
public BuildCommandRule(WithDotNet withDotNet)
|
|
{
|
|
this.withDotNet = withDotNet;
|
|
}
|
|
|
|
public BuildScript Analyse(Autobuilder builder, bool auto)
|
|
{
|
|
if (builder.Options.BuildCommand is null)
|
|
return BuildScript.Failure;
|
|
|
|
// Custom build commands may require a specific .NET Core version
|
|
return withDotNet(builder, environment =>
|
|
{
|
|
var command = new CommandBuilder(builder.Actions, null, environment);
|
|
|
|
// Custom build commands may require a specific Visual Studio version
|
|
var vsTools = MsBuildRule.GetVcVarsBatFile(builder);
|
|
if (vsTools is not null)
|
|
command.CallBatFile(vsTools.Path);
|
|
command.RunCommand(builder.Options.BuildCommand);
|
|
|
|
return command.Script;
|
|
});
|
|
}
|
|
}
|
|
}
|