Skip to content

Commit 5b97458

Browse files
authored
Merge pull request #8322 from hvitved/csharp/remove-odasa-legacy
C#: Remove legacy `odasa` support
2 parents dfb20f7 + 7f0fa15 commit 5b97458

File tree

27 files changed

+118
-651
lines changed

27 files changed

+118
-651
lines changed

csharp/autobuilder/Semmle.Autobuild.CSharp.Tests/BuildScripts.cs

Lines changed: 46 additions & 49 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ private static CommandBuilder GetRestoreCommand(IBuildActions actions, string? d
240240
private static BuildScript GetBuildScript(Autobuilder builder, string? dotNetPath, IDictionary<string, string>? environment, string projOrSln)
241241
{
242242
var build = new CommandBuilder(builder.Actions, null, environment);
243-
var script = builder.MaybeIndex(build, DotNetCommand(builder.Actions, dotNetPath)).
243+
var script = build.RunCommand(DotNetCommand(builder.Actions, dotNetPath)).
244244
Argument("build").
245245
Argument("--no-incremental");
246246

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ BuildScript GetCommand(string? solution)
1717
{
1818
standalone = builder.Actions.PathCombine(builder.CodeQLExtractorLangRoot, "tools", builder.CodeQlPlatform, "Semmle.Extraction.CSharp.Standalone");
1919
}
20-
else if (builder.SemmlePlatformTools is not null)
21-
{
22-
standalone = builder.Actions.PathCombine(builder.SemmlePlatformTools, "csharp", "Semmle.Extraction.CSharp.Standalone");
23-
}
2420
else
2521
{
2622
return BuildScript.Failure;

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

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,15 @@ protected Autobuilder(IBuildActions actions, AutobuildOptions options)
190190
});
191191

192192
CodeQLExtractorLangRoot = Actions.GetEnvironmentVariable($"CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_ROOT");
193-
SemmlePlatformTools = Actions.GetEnvironmentVariable("SEMMLE_PLATFORM_TOOLS");
194-
195193
CodeQlPlatform = Actions.GetEnvironmentVariable("CODEQL_PLATFORM");
196194

197195
TrapDir =
198196
Actions.GetEnvironmentVariable($"CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_TRAP_DIR") ??
199-
Actions.GetEnvironmentVariable("TRAP_FOLDER") ??
200-
throw new InvalidEnvironmentException($"The environment variable CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_TRAP_DIR or TRAP_FOLDER has not been set.");
197+
throw new InvalidEnvironmentException($"The environment variable CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_TRAP_DIR has not been set.");
201198

202199
SourceArchiveDir =
203200
Actions.GetEnvironmentVariable($"CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_SOURCE_ARCHIVE_DIR") ??
204-
Actions.GetEnvironmentVariable("SOURCE_ARCHIVE") ??
205-
throw new InvalidEnvironmentException($"The environment variable CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_SOURCE_ARCHIVE_DIR or SOURCE_ARCHIVE has not been set.");
201+
throw new InvalidEnvironmentException($"The environment variable CODEQL_EXTRACTOR_{this.Options.Language.UpperCaseName}_SOURCE_ARCHIVE_DIR has not been set.");
206202
}
207203

208204
protected string TrapDir { get; }
@@ -264,34 +260,9 @@ protected BuildScript AutobuildFailure() =>
264260
/// </summary>
265261
public string? CodeQLExtractorLangRoot { get; }
266262

267-
/// <summary>
268-
/// Value of SEMMLE_PLATFORM_TOOLS environment variable.
269-
/// </summary>
270-
public string? SemmlePlatformTools { get; }
271-
272263
/// <summary>
273264
/// Value of CODEQL_PLATFORM environment variable.
274265
/// </summary>
275266
public string? CodeQlPlatform { get; }
276-
277-
/// <summary>
278-
/// The absolute path of the odasa executable.
279-
/// null if we are running in CodeQL.
280-
/// </summary>
281-
public string? Odasa
282-
{
283-
get
284-
{
285-
var semmleDist = Actions.GetEnvironmentVariable("SEMMLE_DIST");
286-
return semmleDist is null ? null : Actions.PathCombine(semmleDist, "tools", "odasa");
287-
}
288-
}
289-
290-
/// <summary>
291-
/// Construct a command that executed the given <paramref name="cmd"/> wrapped in
292-
/// an <code>odasa --index</code>, unless indexing has been disabled, in which case
293-
/// <paramref name="cmd"/> is run directly.
294-
/// </summary>
295-
public CommandBuilder MaybeIndex(CommandBuilder builder, string cmd) => Odasa is null ? builder.RunCommand(cmd) : builder.IndexCommand(Odasa, cmd);
296267
}
297268
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public BuildScript Analyse(Autobuilder builder, bool auto)
5858
if (vsTools is not null)
5959
command.CallBatFile(vsTools.Path);
6060

61-
builder.MaybeIndex(command, scriptPath);
61+
command.RunCommand(scriptPath);
6262
return command.Script;
6363
});
6464
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public BuildScript Analyse(Autobuilder builder, bool auto)
2626
var vsTools = MsBuildRule.GetVcVarsBatFile(builder);
2727
if (vsTools is not null)
2828
command.CallBatFile(vsTools.Path);
29-
builder.MaybeIndex(command, builder.Options.BuildCommand);
29+
command.RunCommand(builder.Options.BuildCommand);
3030

3131
return command.Script;
3232
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public BuildCommand(string exe, string? argumentsOpt, bool silent, string? worki
7070
this.environment = environment;
7171
}
7272

73-
public override string ToString() => exe + " " + arguments;
73+
public override string ToString() => arguments.Length > 0 ? exe + " " + arguments : exe;
7474

7575
public override int Run(IBuildActions actions, Action<string, bool> startCallback, Action<int, string, bool> exitCallBack)
7676
{

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ public CommandBuilder(IBuildActions actions, string? workingDirectory = null, ID
4545
this.silent = silent;
4646
}
4747

48-
private void OdasaIndex(string odasa)
49-
{
50-
RunCommand(odasa, "index --auto");
51-
}
52-
5348
public CommandBuilder CallBatFile(string batFile, string? argumentsOpt = null)
5449
{
5550
NextCommand();
@@ -59,21 +54,6 @@ public CommandBuilder CallBatFile(string batFile, string? argumentsOpt = null)
5954
return this;
6055
}
6156

62-
/// <summary>
63-
/// Perform odasa index on a given command or BAT file.
64-
/// </summary>
65-
/// <param name="odasa">The odasa executable.</param>
66-
/// <param name="command">The command to run.</param>
67-
/// <param name="argumentsOpt">Additional arguments.</param>
68-
/// <returns>this for chaining calls.</returns>
69-
public CommandBuilder IndexCommand(string odasa, string command, string? argumentsOpt = null)
70-
{
71-
OdasaIndex(odasa);
72-
QuoteArgument(command);
73-
Argument(argumentsOpt);
74-
return this;
75-
}
76-
7757
private static readonly char[] specialChars = { ' ', '\t', '\n', '\v', '\"' };
7858
private static readonly char[] cmdMetacharacter = { '(', ')', '%', '!', '^', '\"', '<', '>', '&', '|' };
7959

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ BuildScript GetNugetRestoreScript() =>
9595
command.RunCommand("set Platform=&& type NUL", quoteExe: false);
9696
}
9797

98-
builder.MaybeIndex(command, msBuild);
98+
command.RunCommand(msBuild);
9999
command.QuoteArgument(projectOrSolution.FullPath);
100100

101101
command.Argument("/p:UseSharedCompilation=false");

csharp/config/tracer/linux/csharp-compiler-settings

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)