提交 75d8b7f5 编写于 作者: J Jared Parsons

Changed the terminology to fixed over static

上级 68e4eb2d
......@@ -31,20 +31,20 @@ public bool Run(TextWriter writer, string[] args)
private JObject GoCore()
{
var obj = new JObject();
obj.Add(GetStaticPackages());
obj.Add(GetFixedPackages());
obj.Add(GetBuildPackages());
obj.Add(GetToolsetPackages());
return obj;
}
private JProperty GetStaticPackages()
private JProperty GetFixedPackages()
{
var obj = new JObject();
foreach (var pair in _repoData.StaticPackagesMap.OrderBy(x => x.Key))
foreach (var pair in _repoData.FixedPackagesMap.OrderBy(x => x.Key))
{
obj.Add(GetProperty(pair.Key, pair.Value));
}
return new JProperty("static", obj);
return new JProperty("fixed", obj);
}
private JProperty GetBuildPackages()
......
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RepoUtil
{
internal static class Data
{
/// <summary>
/// The dependencies in these project.json files are expected to be regularly updated by
/// repo full stack builds.
/// </summary>
private static readonly string[] s_floatingList = new[]
{
@"build\MSBuildToolset\project.json",
@"build\ToolsetPackages\project.json",
@"src\Compilers\Core\MSBuildTask\Desktop\project.json",
@"src\Compilers\Core\MSBuildTask\Portable\project.json",
@"src\Compilers\Core\MSBuildTaskTests\project.json",
@"src\Compilers\CSharp\csc\project.json",
@"src\Compilers\Extension\project.json",
@"src\Compilers\Server\VBCSCompilerTests\project.json",
@"src\Compilers\VisualBasic\vbc\project.json",
@"src\Dependencies\Composition\project.json",
@"src\Dependencies\DiaSymReader\project.json",
@"src\Dependencies\DiaSymReader.PortablePdb\project.json",
@"src\Dependencies\Immutable\project.json",
@"src\Dependencies\Metadata\project.json",
@"src\Dependencies\Moq.net\project.json",
@"src\Dependencies\VisualStudio\project.json",
@"src\Dependencies\VisualStudioEditor\project.json",
@"src\Dependencies\VisualStudioText\project.json",
@"src\Dependencies\xUnit.net\project.json",
@"src\EditorFeatures\Core\project.json",
@"src\EditorFeatures\Next\project.json",
@"src\EditorFeatures\Test\project.json",
@"src\ExpressionEvaluator\Core\Source\ResultProvider\NetFX20\project.json",
@"src\ExpressionEvaluator\Core\Test\ExpressionCompiler\project.json",
@"src\ExpressionEvaluator\Core\Test\ResultProvider\project.json",
@"src\ExpressionEvaluator\CSharp\Source\ResultProvider\NetFX20\project.json",
@"src\ExpressionEvaluator\CSharp\Test\ExpressionCompiler\project.json",
@"src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\NetFX20\project.json",
@"src\InteractiveWindow\EditorTest\project.json",
@"src\InteractiveWindow\VisualStudio\project.json",
@"src\Scripting\Core\project.json",
@"src\Scripting\CSharp\project.json",
@"src\Scripting\CSharpTest\project.json",
@"src\Scripting\CSharpTest.Desktop\project.json",
@"src\Scripting\VisualBasic\project.json",
@"src\Scripting\VisualBasicTest\project.json",
@"src\Test\DeployCoreClrTestRuntime\project.json",
@"src\Test\PdbUtilities\project.json",
@"src\Test\Perf\Runner\project.json",
@"src\Test\Utilities\Desktop\project.json",
@"src\Test\Utilities\Portable\project.json",
@"src\Test\Utilities\Portable.FX45\project.json",
@"src\VisualStudio\Core\Def\project.json",
@"src\VisualStudio\Core\Impl\project.json",
@"src\VisualStudio\Core\SolutionExplorerShim\project.json",
@"src\VisualStudio\Setup\project.json",
@"src\VisualStudio\TestSetup\project.json",
@"src\Workspaces\Core\Desktop\project.json",
@"src\Workspaces\Core\Portable\project.json",
};
/// <summary>
/// The dependencies listed in this file are not expected to change on repo builds. Only when
/// the tool itself needs to be updated.
/// </summary>
private static readonly string[] s_staticList = new[]
{
@"src\Tools\BuildUtil\BuildUtil\project.json",
@"src\Tools\CommonCoreClrRuntime\project.json",
@"src\Tools\CommonNetCoreReferences\project.json",
@"src\Tools\ProcessWatchdog\project.json",
@"src\Tools\RepoUtil\project.json",
@"src\Tools\SignRoslyn\project.json",
@"src\Tools\Source\CompilerGeneratorTools\DeployCompilerGeneratorToolsRuntime\project.json",
@"src\Tools\Source\CompilerGeneratorTools\Source\BoundTreeGenerator\project.json",
@"src\Tools\Source\CompilerGeneratorTools\Source\CSharpErrorFactsGenerator\project.json",
@"src\Tools\Source\CompilerGeneratorTools\Source\CSharpSyntaxGenerator\project.json",
@"src\Tools\Source\CompilerGeneratorTools\Source\VisualBasicErrorFactsGenerator\project.json",
@"src\Tools\Source\CompilerGeneratorTools\Source\VisualBasicSyntaxGenerator\project.json",
@"src\Tools\Source\RunTests\project.json",
};
internal static readonly ImmutableArray<string> FloatingList = s_floatingList.OrderBy(x => x).ToImmutableArray();
internal static readonly ImmutableArray<string> StaticList = s_staticList.OrderBy(x => x).ToImmutableArray();
internal static ImmutableArray<FileName> GetFloatingFileNames(string sourcesPath)
{
return s_floatingList.Select(x => new FileName(sourcesPath, x)).ToImmutableArray();
}
}
}
......@@ -13,7 +13,7 @@ namespace RepoUtil
/// <summary>
/// Packages in the repo fall into the following groups:
///
/// Static Packages:
/// Fixed Packages:
///
/// These are packages which should never change. In other words if there was a scenario where a new version of the
/// package was available the reference should not update to the new version. For all time it should remain at the
......@@ -37,27 +37,28 @@ namespace RepoUtil
/// </summary>
internal class RepoConfig
{
internal ImmutableArray<NuGetPackage> StaticPackages { get; }
internal ImmutableDictionary<string, ImmutableArray<string>> StaticPackagesMap { get; }
internal ImmutableArray<NuGetPackage> FixedPackages { get; }
// TODO: is this map needed?
internal ImmutableDictionary<string, ImmutableArray<string>> FixedPackagesMap { get; }
internal ImmutableArray<string> ToolsetPackages { get; }
internal ImmutableArray<Regex> NuSpecExcludes { get; }
internal GenerateData? MSBuildGenerateData { get; }
internal RepoConfig(
IEnumerable<NuGetPackage> staticPackages,
IEnumerable<NuGetPackage> fixedPackages,
IEnumerable<string> toolsetPackages,
IEnumerable<Regex> nuspecExcludes,
GenerateData? msbuildGenerateData)
{
MSBuildGenerateData = msbuildGenerateData;
StaticPackages = staticPackages.OrderBy(x => x.Name).ToImmutableArray();
FixedPackages = fixedPackages.OrderBy(x => x.Name).ToImmutableArray();
NuSpecExcludes = nuspecExcludes.ToImmutableArray();
// TODO: Validate duplicate names in the floating lists
ToolsetPackages = toolsetPackages.OrderBy(x => x).ToImmutableArray();
var map = new Dictionary<string, List<string>>();
foreach (var nugetRef in staticPackages)
foreach (var nugetRef in fixedPackages)
{
List<string> list;
if (!map.TryGetValue(nugetRef.Name, out list))
......@@ -69,10 +70,10 @@ internal class RepoConfig
list.Add(nugetRef.Version);
}
StaticPackagesMap = ImmutableDictionary<string, ImmutableArray<string>>.Empty;
FixedPackagesMap = ImmutableDictionary<string, ImmutableArray<string>>.Empty;
foreach (var pair in map)
{
StaticPackagesMap = StaticPackagesMap.Add(pair.Key, pair.Value.ToImmutableArray());
FixedPackagesMap = FixedPackagesMap.Add(pair.Key, pair.Value.ToImmutableArray());
}
}
......@@ -80,22 +81,22 @@ internal static RepoConfig ReadFrom(string jsonFilePath)
{
// Need to track any file that has dependencies
var obj = JObject.Parse(File.ReadAllText(jsonFilePath));
var staticPackages = (JObject)obj["staticPackages"];
var staticPackagesList = ImmutableArray.CreateBuilder<NuGetPackage>();
foreach (var prop in staticPackages.Properties())
var fixedPackages = (JObject)obj["fixedPackages"];
var fixedPackagesList = ImmutableArray.CreateBuilder<NuGetPackage>();
foreach (var prop in fixedPackages.Properties())
{
if (prop.Value.Type == JTokenType.String)
{
var version = (string)prop.Value;
var nugetRef = new NuGetPackage(prop.Name, version);
staticPackagesList.Add(nugetRef);
fixedPackagesList.Add(nugetRef);
}
else
{
foreach (var version in ((JArray)prop.Value).Values<string>())
{
var nugetRef = new NuGetPackage(prop.Name, version);
staticPackagesList.Add(nugetRef);
fixedPackagesList.Add(nugetRef);
}
}
}
......@@ -118,7 +119,7 @@ internal static RepoConfig ReadFrom(string jsonFilePath)
}
return new RepoConfig(
staticPackagesList,
fixedPackagesList,
toolsetPackages,
nuspecExcludes,
msbuildGenerateData);
......
......@@ -16,9 +16,9 @@ internal sealed class RepoData
internal ImmutableArray<NuGetPackage> FloatingBuildPackages { get; }
internal ImmutableArray<NuGetPackage> FloatingToolsetPackages { get; }
internal ImmutableArray<NuGetPackage> FloatingPackages { get; }
internal ImmutableArray<NuGetPackage> StaticPackages => RepoConfig.StaticPackages;
internal ImmutableArray<NuGetPackage> FixedPackages => RepoConfig.FixedPackages;
internal ImmutableArray<NuGetPackage> AllPackages { get; }
internal ImmutableDictionary<string, ImmutableArray<string>> StaticPackagesMap => RepoConfig.StaticPackagesMap;
internal ImmutableDictionary<string, ImmutableArray<string>> FixedPackagesMap => RepoConfig.FixedPackagesMap;
internal RepoData(RepoConfig config, string sourcesPath, IEnumerable<NuGetPackage> floatingPackages)
{
......@@ -35,7 +35,7 @@ internal RepoData(RepoConfig config, string sourcesPath, IEnumerable<NuGetPackag
FloatingPackages = floatingPackages
.OrderBy(x => x.Name)
.ToImmutableArray();
AllPackages = Combine(FloatingBuildPackages, FloatingToolsetPackages, StaticPackages);
AllPackages = Combine(FloatingBuildPackages, FloatingToolsetPackages, FixedPackages);
}
private static ImmutableArray<NuGetPackage> Combine(params ImmutableArray<NuGetPackage>[] args)
......@@ -47,7 +47,7 @@ private static ImmutableArray<NuGetPackage> Combine(params ImmutableArray<NuGetP
}
/// <summary>
/// The raw RepoData contains only the static + toolset packages that we need to track. This method will examine the current
/// The raw RepoData contains only the fixed + toolset packages that we need to track. This method will examine the current
/// state of the repo and add in the current data.
/// </summary>
internal static RepoData Create(RepoConfig config, string sourcesPath)
......@@ -57,7 +57,7 @@ internal static RepoData Create(RepoConfig config, string sourcesPath)
{
foreach (var nuget in ProjectJsonUtil.GetDependencies(fileName))
{
if (config.StaticPackagesMap.ContainsKey(nuget.Name))
if (config.FixedPackagesMap.ContainsKey(nuget.Name))
{
continue;
}
......
{
"staticPackages": {
"fixedPackages": {
"Microsoft.Build.Framework": [ "0.1.0-preview-00005", "0.1.0-preview-00023-160527" ],
"Microsoft.Build.Tasks.Core": [ "0.1.0-preview-00005", "0.1.0-preview-00023-160527" ],
"Microsoft.Build.Utilities.Core": [ "0.1.0-preview-00005", "0.1.0-preview-00023-160527" ],
......
......@@ -43,7 +43,6 @@
<Compile Include="ChangeCommand.cs" />
<Compile Include="Constants.cs" />
<Compile Include="ConsumesCommand.cs" />
<Compile Include="Data.cs" />
<Compile Include="FileName.cs" />
<Compile Include="GenerateData.cs" />
<Compile Include="GenerateUtil.cs" />
......
......@@ -48,7 +48,7 @@ private bool VerifyProjectJsonContents(TextWriter writer)
{
writer.WriteLine($"Verifying project.json contents");
var allGood = true;
var staticPackageSet = new HashSet<NuGetPackage>(_repoConfig.StaticPackages);
var staticPackageSet = new HashSet<NuGetPackage>(_repoConfig.FixedPackages);
var floatingPackageMap = new Dictionary<string, NuGetPackageSource>(Constants.NugetPackageNameComparer);
foreach (var filePath in ProjectJsonUtil.GetProjectJsonFiles(_sourcesPath))
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册