Skip to content

Commit 223d942

Browse files
committed
C#: autobuild: fix buildless mode for CodeQL
1 parent f406072 commit 223d942

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

csharp/autobuilder/Semmle.Autobuild.CSharp/StandaloneBuildRule.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ public BuildScript Analyse(Autobuilder builder, bool auto)
1111
{
1212
BuildScript GetCommand(string? solution)
1313
{
14-
if (builder.SemmlePlatformTools is null)
14+
string standalone;
15+
if (!(builder.CodeQLExtractorLangRoot is null) && !(builder.CodeQlPlatform is null)) {
16+
standalone = builder.Actions.PathCombine(builder.CodeQLExtractorLangRoot, "tools", builder.CodeQlPlatform, "Semmle.Extraction.CSharp.Standalone");
17+
} else if (!(builder.SemmlePlatformTools is null)) {
18+
standalone = builder.Actions.PathCombine(builder.SemmlePlatformTools, "csharp", "Semmle.Extraction.CSharp.Standalone");
19+
} else {
1520
return BuildScript.Failure;
21+
}
1622

17-
var standalone = builder.Actions.PathCombine(builder.SemmlePlatformTools, "csharp", "Semmle.Extraction.CSharp.Standalone");
1823
var cmd = new CommandBuilder(builder.Actions);
1924
cmd.RunCommand(standalone);
2025

csharp/autobuilder/Semmle.Autobuild.Shared/Autobuilder.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ public Autobuilder(IBuildActions actions, AutobuildOptions options)
193193
SemmleDist = Actions.GetEnvironmentVariable("SEMMLE_DIST");
194194
SemmlePlatformTools = Actions.GetEnvironmentVariable("SEMMLE_PLATFORM_TOOLS");
195195

196+
CodeQlPlatform = Actions.GetEnvironmentVariable("CODEQL_PLATFORM");
197+
196198
JavaHome =
197199
Actions.GetEnvironmentVariable("CODEQL_JAVA_HOME") ??
198200
Actions.GetEnvironmentVariable("SEMMLE_JAVA_HOME") ??
@@ -271,7 +273,7 @@ protected BuildScript AutobuildFailure() =>
271273
/// <summary>
272274
/// Value of CODEQL_EXTRACTOR_<LANG>_ROOT environment variable.
273275
/// </summary>
274-
private string? CodeQLExtractorLangRoot { get; }
276+
public string? CodeQLExtractorLangRoot { get; }
275277

276278
/// <summary>
277279
/// Value of SEMMLE_DIST environment variable.
@@ -287,6 +289,11 @@ protected BuildScript AutobuildFailure() =>
287289
/// </summary>
288290
public string? SemmlePlatformTools { get; }
289291

292+
/// <summary>
293+
/// Value of CODEQL_PLATFORM environment variable.
294+
/// </summary>
295+
public string? CodeQlPlatform { get; }
296+
290297
/// <summary>
291298
/// The absolute path of the odasa executable.
292299
/// null if we are running in CodeQL.

0 commit comments

Comments
 (0)