Skip to content

Commit da9aa54

Browse files
committed
C#/C++: Use CODEQL_EXTRACTOR_CPP_* in autobuilder
1 parent 30d9c6b commit da9aa54

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

csharp/autobuilder/Semmle.Autobuild/AutobuildOptions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public AutobuildOptions(IBuildActions actions)
5454
NugetRestore = actions.GetEnvironmentVariable(prefix + "NUGET_RESTORE").AsBool("nuget_restore", true);
5555

5656
Language = actions.GetEnvironmentVariable("LGTM_PROJECT_LANGUAGE").AsLanguage();
57-
Indexing = !actions.GetEnvironmentVariable("CODEQL_AUTOBUILDER_CSHARP_NO_INDEXING").AsBool("no_indexing", false);
57+
58+
Indexing = !actions.GetEnvironmentVariable($"CODEQL_AUTOBUILDER_{Language.UpperCaseName}_NO_INDEXING").AsBool("no_indexing", false);
5859
}
5960
}
6061

csharp/autobuilder/Semmle.Autobuild/Autobuilder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ public Autobuilder(IBuildActions actions, AutobuildOptions options)
199199
throw new InvalidEnvironmentException("The environment variable CODEQL_EXTRACTOR_CSHARP_ROOT or SEMMLE_DIST has not been set.");
200200

201201
TrapDir =
202-
Actions.GetEnvironmentVariable("CODEQL_EXTRACTOR_CSHARP_TRAP_DIR") ??
202+
Actions.GetEnvironmentVariable($"CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_TRAP_DIR") ??
203203
Actions.GetEnvironmentVariable("TRAP_FOLDER") ??
204-
throw new InvalidEnvironmentException("The environment variable CODEQL_EXTRACTOR_CSHARP_TRAP_DIR or TRAP_FOLDER has not been set.");
204+
throw new InvalidEnvironmentException($"The environment variable CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_TRAP_DIR or TRAP_FOLDER has not been set.");
205205

206206
SourceArchiveDir =
207-
Actions.GetEnvironmentVariable("CODEQL_EXTRACTOR_CSHARP_SOURCE_ARCHIVE_DIR") ??
207+
Actions.GetEnvironmentVariable($"CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_SOURCE_ARCHIVE_DIR") ??
208208
Actions.GetEnvironmentVariable("SOURCE_ARCHIVE") ??
209-
throw new InvalidEnvironmentException("The environment variable CODEQL_EXTRACTOR_CSHARP_SOURCE_ARCHIVE_DIR or SOURCE_ARCHIVE has not been set.");
209+
throw new InvalidEnvironmentException($"The environment variable CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_SOURCE_ARCHIVE_DIR or SOURCE_ARCHIVE has not been set.");
210210
}
211211

212212
private string TrapDir { get; }

csharp/autobuilder/Semmle.Autobuild/Language.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
{
33
public sealed class Language
44
{
5-
public static readonly Language Cpp = new Language(".vcxproj");
6-
public static readonly Language CSharp = new Language(".csproj");
5+
public static readonly Language Cpp = new Language(".vcxproj", "CPP");
6+
public static readonly Language CSharp = new Language(".csproj", "CSHARP");
77

88
public bool ProjectFileHasThisLanguage(string path) =>
99
System.IO.Path.GetExtension(path) == ProjectExtension;
1010

1111
public readonly string ProjectExtension;
12+
public readonly string UpperCaseName;
1213

13-
private Language(string extension)
14+
private Language(string extension, string name)
1415
{
1516
ProjectExtension = extension;
17+
UpperCaseName = name;
1618
}
1719

1820
public override string ToString() =>

0 commit comments

Comments
 (0)