Skip to content

Commit d1d8450

Browse files
committed
integrated CodeQL command into tool.
1 parent f23ce79 commit d1d8450

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

src/CodeQLToolkit.Features/CodeQL/Commands/CodeQLCommandFeature.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public void Register(Command parentCommand)
3939
parentCommand.Add(runCommand);
4040

4141
var installCommand = new Command("install", "Installs CodeQL (bundle or release distribution) locally.");
42-
var useCommand = new Command("use", "Switches tooling to use a different CodeQL version and updates the paths accordingly.");
43-
var listCommand = new Command("list", "Lists versions of CodeQL available locally.");
42+
//var useCommand = new Command("use", "Switches tooling to use a different CodeQL version and updates the paths accordingly.");
43+
//var listCommand = new Command("list", "Lists versions of CodeQL available locally.");
4444

4545
runCommand.Add(installCommand);
46-
runCommand.Add(useCommand);
46+
//runCommand.Add(useCommand);
4747
//runCommand.Add(listCommand);
4848

4949

src/CodeQLToolkit.Features/Test/Commands/Targets/Actions/ExecuteUnitTestsCommandTarget.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using CodeQLToolkit.Features.Test.Lifecycle.Models;
2+
using CodeQLToolkit.Shared.CodeQL;
23
using CodeQLToolkit.Shared.Utils;
34
using System;
45
using System.Collections.Generic;
@@ -70,9 +71,19 @@ public override void Run()
7071
Log<ExecuteUnitTestsCommandTarget>.G().LogInformation($"Slice: {slice} of {NumThreads}");
7172
Log<ExecuteUnitTestsCommandTarget>.G().LogInformation($"Report File: {outFileReport}...");
7273

74+
75+
// Get A Copy of the installation
76+
var installation = CodeQLInstallation.LoadFromConfig(Base);
77+
78+
if(!installation.IsInstalled())
79+
{
80+
DieWithError($"Requested CodeQL Version ({CLIVersion}) Not Installed. Run `qlt codeql run install` before running this step.");
81+
}
82+
83+
7384
using (Process process = new Process())
7485
{
75-
process.StartInfo.FileName = "codeql";
86+
process.StartInfo.FileName = installation.CodeQLToolBinary;
7687
process.StartInfo.WorkingDirectory = workingDirectory;
7788
process.StartInfo.UseShellExecute = false;
7889
process.StartInfo.RedirectStandardOutput = true;

src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public string PlatformExtension
9898
}
9999
}
100100

101+
101102
public void Install()
102103
{
103104
// each time we download the file; however,
@@ -256,13 +257,19 @@ public string GetInstallationDirectory(ArtifactKind k)
256257

257258
}
258259

259-
public string CodeQLHome { get {
260-
return "";
260+
public string CodeQLHome {
261+
get {
262+
return CodeQLDirectory;
261263
}
262264
}
263265

264-
public string CodeQLToolBinary { get {
265-
return Path.Combine("", "");
266+
public string CodeQLToolBinary {
267+
get {
268+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
269+
{
270+
return Path.Combine(CodeQLDirectory, "codeql.exe");
271+
}
272+
return Path.Combine(CodeQLDirectory, "codeql");
266273
}
267274
}
268275

0 commit comments

Comments
 (0)