Skip to content

Commit db32a3a

Browse files
committed
improvements to JSON structure
1 parent cf42769 commit db32a3a

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

example/qlt.conf.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
"CodeQLCLIBundle": "codeql-bundle-v2.15.5",
55
"EnableCustomCodeQLBundles": true,
66
"CodeQLStandardLibraryIdent": "codeql-cli_v2.15.5",
7-
"CustomizationPacks" : [
7+
"CodeQLPackConfiguration" : [
88
{
99
"Name": "qlt/cpp-customizations",
10-
"Export" : true
10+
"Bundle" : true
1111
},
1212
{
1313
"Name": "qlt2/stuff2-tests",
14-
"Export" : false
14+
"Bundle" : false,
15+
"ReferencesBundle" : true
1516
}
1617
]
1718
}

src/CodeQLToolkit.Features/CodeQL/Commands/Targets/InstallCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ public override void Run()
2727
if (Packs!=null && Packs.Length > 0)
2828
{
2929
Log<InstallCommand>.G().LogInformation($"Overriding Packs on the command line. The following Packs will be packaged:");
30-
installation.CustomizationPacks = Packs.Select(p => new QLTCustomizationPack()
30+
installation.CodeQLPackConfiguration = Packs.Select(p => new CodeQLPackConfiguration()
3131
{
32-
Name = p
32+
Name = p,
33+
Bundle = true
3334
}).ToArray();
3435
}
3536
else

src/CodeQLToolkit.Features/Query/Commands/Targets/InstallQueryPacksCommandTarget.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ public override void Run()
4141
Log<InstallQueryPacksCommandTarget>.G().LogInformation("In bundle mode so filtering bundled packs...");
4242

4343

44-
foreach (var pack in config.CustomizationPacks)
44+
foreach (var pack in config.CodeQLPackConfiguration)
4545
{
4646
Log<InstallQueryPacksCommandTarget>.G().LogInformation($"Pack {pack.Name} will NOT installed because it is part of the bundle...");
4747
}
4848

4949
files = files.Where(f =>
5050
// all things that are part of the customization pack must be excluded.
5151
// if it is exported is not relevant here.
52-
!config.CustomizationPacks.Any(p => CodeQLPackReader.read(f).Name == p.Name)
52+
!config.CodeQLPackConfiguration.Any(p => CodeQLPackReader.read(f).Name == p.Name && (p.Bundle==true || p.ReferencesBundle==true))
5353
).ToArray();
5454

5555
Log<InstallQueryPacksCommandTarget>.G().LogInformation($"Got {files.Length} packs after filtering...");

src/CodeQLToolkit.Shared/CodeQL/CodeQLInstallation.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class CodeQLInstallation
2222
public string CLIBundle { get; set; }
2323
public string StandardLibraryIdent { get; set; }
2424
public bool EnableCustomCodeQLBundles { get; set; }
25-
public QLTCustomizationPack[] CustomizationPacks { get; set; }
25+
public CodeQLPackConfiguration[] CodeQLPackConfiguration { get; set; }
2626
public bool QuickBundle { get; set; }
2727
public string Base { get; set; }
2828

@@ -47,7 +47,7 @@ public static CodeQLInstallation LoadFromConfig(QLTConfig c)
4747
CLIBundle = config.CodeQLCLIBundle,
4848
StandardLibraryIdent = config.CodeQLStandardLibraryIdent,
4949
StandardLibraryVersion = config.CodeQLStandardLibrary,
50-
CustomizationPacks = config.CustomizationPacks,
50+
CodeQLPackConfiguration = config.CodeQLPackConfiguration,
5151
Base = config.Base,
5252
CodeQLConfiguration = config.CodeQLConfiguration
5353
};
@@ -57,9 +57,9 @@ public static CodeQLInstallation LoadFromConfig(QLTConfig c)
5757

5858
public void LogPacksToBeBuilt()
5959
{
60-
if(CustomizationPacks != null)
60+
if(CodeQLPackConfiguration != null)
6161
{
62-
foreach(var p in CustomizationPacks)
62+
foreach(var p in CodeQLPackConfiguration)
6363
{
6464
Log<CodeQLInstallation>.G().LogInformation($"Pack: {p}");
6565
}
@@ -278,14 +278,14 @@ private void CustomBundleInstall()
278278

279279
var workingDirectory = Path.GetFullPath(Base);
280280

281-
if(CustomizationPacks == null || CustomizationPacks.Length == 0)
281+
if(CodeQLPackConfiguration == null || CodeQLPackConfiguration.Length == 0)
282282
{
283283
throw new Exception("No packs are set to be exported. Please add at least one pack to export in your `qlt.conf.json` file under the property `ExportedCustomizationPacks`.");
284284
}
285285

286286
Log<CodeQLInstallation>.G().LogInformation($"Building custom bundle. This may take a while...");
287287

288-
var packsToExport = CustomizationPacks.Where(p => p.Export == true).Select(p => p.Name).ToArray();
288+
var packsToExport = CodeQLPackConfiguration.Where(p => p.Bundle == true).Select(p => p.Name).ToArray();
289289

290290
var packs = string.Join(" ", packsToExport);
291291
// next, we run the bundling tool.

src/CodeQLToolkit.Shared/Utils/QLTConfig.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,23 @@
77

88
namespace CodeQLToolkit.Shared.Utils
99
{
10-
public class QLTCustomizationPack
10+
public class CodeQLPackConfiguration
1111
{
1212
public string Name { get; set; }
13-
public bool Export { get; set; }
14-
}
13+
public bool Bundle { get; set; }
14+
public bool Publish { get; set;}
15+
public bool ReferencesBundle { get; set; }
16+
17+
}
1518

1619
public class QLTConfig
1720
{
1821
public string CodeQLCLI { get; set; }
1922
public string CodeQLStandardLibrary { get; set; }
2023
public string CodeQLCLIBundle { get; set; }
21-
2224
public string CodeQLConfiguration { get; set; }
2325

24-
public QLTCustomizationPack[] CustomizationPacks { get; set; }
26+
public CodeQLPackConfiguration[] CodeQLPackConfiguration { get; set; }
2527

2628
public string CodeQLStandardLibraryIdent {
2729
get {

0 commit comments

Comments
 (0)