Writing extended update metadata to the query result JSON is now optional. This greatly reduces the JSON size when update applicability rules not required in the output.
This commit is contained in:
Родитель
f46d325f47
Коммит
576d0ef056
|
@ -283,6 +283,9 @@ namespace Microsoft.PackageGraph.Utilitites.Upsync
|
||||||
|
|
||||||
[Option("json-out-path", Required = false, HelpText = "Save results as JSON to the specified path")]
|
[Option("json-out-path", Required = false, HelpText = "Save results as JSON to the specified path")]
|
||||||
public string JsonOutPath { get; set; }
|
public string JsonOutPath { get; set; }
|
||||||
|
|
||||||
|
[Option("include-extended-metadata", Required = false, Default = false, HelpText = "Include extended metadata when saving to JSON query result.")]
|
||||||
|
public bool IncludeExtendedMetadata { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Verb("match-driver", HelpText = "Find drivers")]
|
[Verb("match-driver", HelpText = "Find drivers")]
|
||||||
|
|
|
@ -65,9 +65,18 @@ namespace Microsoft.PackageGraph.Utilitites.Upsync
|
||||||
{
|
{
|
||||||
var packagesList = filteredPackages.ToList();
|
var packagesList = filteredPackages.ToList();
|
||||||
|
|
||||||
|
if (!options.IncludeExtendedMetadata)
|
||||||
|
{
|
||||||
|
// Remove extended metadata unless explicitly requested.
|
||||||
|
// Applicability rules can be very large but of little interest
|
||||||
|
packagesList.ForEach(p => p.ApplicabilityRules.Clear());
|
||||||
|
}
|
||||||
|
|
||||||
Console.WriteLine("-----------------------------");
|
Console.WriteLine("-----------------------------");
|
||||||
Console.WriteLine($"Query returned {packagesList.Count} entries.");
|
Console.WriteLine($"Query returned {packagesList.Count} entries.");
|
||||||
|
|
||||||
|
if (!options.CountOnly)
|
||||||
|
{
|
||||||
Console.WriteLine($"Writing results to {options.JsonOutPath}.");
|
Console.WriteLine($"Writing results to {options.JsonOutPath}.");
|
||||||
|
|
||||||
using (var targetJsonFile = File.Create(options.JsonOutPath))
|
using (var targetJsonFile = File.Create(options.JsonOutPath))
|
||||||
|
@ -80,9 +89,9 @@ namespace Microsoft.PackageGraph.Utilitites.Upsync
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine($"Query result saved to {options.JsonOutPath}.");
|
Console.WriteLine($"Query result saved to {options.JsonOutPath}.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var categoriesLookup = allCategories.ToLookup(package => package.Id.ID);
|
var categoriesLookup = allCategories.ToLookup(package => package.Id.ID);
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
<Description></Description>
|
<Description></Description>
|
||||||
<BaseOutputPath>..\..\..\out\upsync</BaseOutputPath>
|
<BaseOutputPath>..\..\..\out\upsync</BaseOutputPath>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<FileVersion>3.0.2.0</FileVersion>
|
<FileVersion>3.0.3.0</FileVersion>
|
||||||
<AssemblyVersion>3.0.2.0</AssemblyVersion>
|
<AssemblyVersion>3.0.3.0</AssemblyVersion>
|
||||||
<ProductVersion>3.0.2.0</ProductVersion>
|
<ProductVersion>3.0.3.0</ProductVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче