Merge branch 'release/2.1' into dev
This commit is contained in:
commit
a39e0b8d6d
|
|
@ -55,6 +55,7 @@
|
|||
<FSharpCorePackageVersion>4.2.1</FSharpCorePackageVersion>
|
||||
<GoogleProtobufPackageVersion>3.1.0</GoogleProtobufPackageVersion>
|
||||
<LibuvPackageVersion>1.10.0</LibuvPackageVersion>
|
||||
<MessagePackPackageVersion>1.7.3.4</MessagePackPackageVersion>
|
||||
<MicrosoftApplicationInsightsAspNetCorePackageVersion>2.1.1</MicrosoftApplicationInsightsAspNetCorePackageVersion>
|
||||
<MicrosoftAspNetIdentityEntityFrameworkPackageVersion>2.2.1</MicrosoftAspNetIdentityEntityFrameworkPackageVersion>
|
||||
<MicrosoftAspNetWebApiClientPackageVersion>5.2.6</MicrosoftAspNetWebApiClientPackageVersion>
|
||||
|
|
@ -80,7 +81,7 @@
|
|||
<MicrosoftNETCoreApp10PackageVersion>1.0.5</MicrosoftNETCoreApp10PackageVersion>
|
||||
<MicrosoftNETCoreApp11PackageVersion>1.1.2</MicrosoftNETCoreApp11PackageVersion>
|
||||
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
|
||||
<MicrosoftNETCoreApp21PackageVersion>2.1.0-rc1</MicrosoftNETCoreApp21PackageVersion>
|
||||
<MicrosoftNETCoreApp21PackageVersion>2.1.0</MicrosoftNETCoreApp21PackageVersion>
|
||||
<MicrosoftNETCoreWindowsApiSetsPackageVersion>1.0.1</MicrosoftNETCoreWindowsApiSetsPackageVersion>
|
||||
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
|
||||
<MicrosoftOwinSecurityCookiesPackageVersion>3.0.1</MicrosoftOwinSecurityCookiesPackageVersion>
|
||||
|
|
@ -105,7 +106,6 @@
|
|||
<MonoAddinsPackageVersion>1.3.8</MonoAddinsPackageVersion>
|
||||
<MonoDevelopSdkPackageVersion>1.0.1</MonoDevelopSdkPackageVersion>
|
||||
<MoqPackageVersion>4.7.49</MoqPackageVersion>
|
||||
<MessagePackPackageVersion>1.7.3.4</MessagePackPackageVersion>
|
||||
<NETStandard16PackageVersion>1.6.1</NETStandard16PackageVersion>
|
||||
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
|
||||
<NewtonsoftJsonBsonPackageVersion>1.0.1</NewtonsoftJsonBsonPackageVersion>
|
||||
|
|
|
|||
|
|
@ -165,6 +165,12 @@
|
|||
<Error Text="Undeclared package artifacts. Add these to artifacts.props:%0A - @(_UndeclaredPackageArtifact, '%0A - ')"
|
||||
Condition=" @(_UndeclaredPackageArtifact->Count()) != 0 " />
|
||||
|
||||
<RepoTasks.CheckRepoGraph Condition=" ! $([MSBuild]::IsOSUnixLike())"
|
||||
Solutions="@(Solution)"
|
||||
Artifacts="@(ArtifactInfo);@(ShippedArtifactInfo)"
|
||||
Repositories="@(Repository);@(ShippedRepository)"
|
||||
Properties="Configuration=$(Configuration);BuildNumber=$(BuildNumber);DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath);DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcePropsPath)" />
|
||||
|
||||
<!-- Skipped to workaround #1014. The order is hardcoded in buildorder.props -->
|
||||
<RepoTasks.AnalyzeBuildGraph Condition=" ! $([MSBuild]::IsOSUnixLike())"
|
||||
Solutions="@(Solution)"
|
||||
|
|
@ -197,6 +203,10 @@
|
|||
</Target>
|
||||
|
||||
<Target Name="VerifyExternalDependencyConfig">
|
||||
<RepoTasks.CheckVersionOverrides DotNetPackageVersionPropsPath="$(DotNetPackageVersionPropsPath)"
|
||||
DependenciesFile="$(MSBuildThisFileDirectory)dependencies.props"
|
||||
Condition="'$(DotNetPackageVersionPropsPath)' != ''" />
|
||||
|
||||
<Error Text="Missing Version metadata for the following external dependencies: %0A - @(ExternalDependency->WithMetadataValue('Version', ''), '%0A - '). "
|
||||
Condition=" @(ExternalDependency->WithMetadataValue('Version', '')->Count()) != 0 " />
|
||||
</Target>
|
||||
|
|
@ -207,7 +217,7 @@
|
|||
<Target Name="VerifyCoherentVersions" DependsOnTargets="ResolveRepoInfo">
|
||||
<ItemGroup>
|
||||
<ShippingPackageFiles Include="$(BuildDir)*.nupkg" Exclude="$(BuildDir)*.symbols.nupkg" />
|
||||
<ShippedExternalDependency Include="%(ShippedArtifactInfo.PackageId)" Version="%(Version)" />
|
||||
<ShippedExternalDependency Include="%(ShippedArtifactInfo.PackageId)" Version="%(ShippedArtifactInfo.Version)" Condition="'%(ShippedArtifactInfo.ArtifactType)' == 'NuGetPackage' " />
|
||||
</ItemGroup>
|
||||
|
||||
<RepoTasks.VerifyCoherentVersions
|
||||
|
|
|
|||
|
|
@ -0,0 +1,214 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using NuGet.Frameworks;
|
||||
using NuGet.Packaging.Core;
|
||||
using NuGet.Versioning;
|
||||
using RepoTools.BuildGraph;
|
||||
using RepoTasks.ProjectModel;
|
||||
using RepoTasks.Utilities;
|
||||
|
||||
namespace RepoTasks
|
||||
{
|
||||
public class CheckRepoGraph : Task, ICancelableTask
|
||||
{
|
||||
private readonly CancellationTokenSource _cts = new CancellationTokenSource();
|
||||
|
||||
[Required]
|
||||
public ITaskItem[] Solutions { get; set; }
|
||||
|
||||
[Required]
|
||||
public ITaskItem[] Artifacts { get; set; }
|
||||
|
||||
[Required]
|
||||
public ITaskItem[] Repositories { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Properties { get; set; }
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
_cts.Cancel();
|
||||
}
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
var packageArtifacts = Artifacts.Select(ArtifactInfo.Parse)
|
||||
.OfType<ArtifactInfo.Package>()
|
||||
.Where(p => !p.IsSymbolsArtifact)
|
||||
.ToDictionary(p => p.PackageInfo.Id, p => p, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var factory = new SolutionInfoFactory(Log, BuildEngine5);
|
||||
var props = MSBuildListSplitter.GetNamedProperties(Properties);
|
||||
|
||||
if (!props.TryGetValue("Configuration", out var defaultConfig))
|
||||
{
|
||||
defaultConfig = "Debug";
|
||||
}
|
||||
|
||||
var solutions = factory.Create(Solutions, props, defaultConfig, _cts.Token).OrderBy(f => f.Directory).ToList();
|
||||
Log.LogMessage($"Found {solutions.Count} and {solutions.Sum(p => p.Projects.Count)} projects");
|
||||
|
||||
if (_cts.IsCancellationRequested)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var repoGraph = new AdjacencyMatrix(solutions.Count);
|
||||
var packageToProjectMap = new Dictionary<PackageIdentity, ProjectInfo>();
|
||||
|
||||
for (var i = 0; i < solutions.Count; i++)
|
||||
{
|
||||
var sln = repoGraph[i] = solutions[i];
|
||||
|
||||
foreach (var proj in sln.Projects)
|
||||
{
|
||||
if (!proj.IsPackable
|
||||
|| proj.FullPath.Contains("samples")
|
||||
|| proj.FullPath.Contains("tools/Microsoft.VisualStudio.Web.CodeGeneration.Design"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var id = new PackageIdentity(proj.PackageId, new NuGetVersion(proj.PackageVersion));
|
||||
|
||||
if (packageToProjectMap.TryGetValue(id, out var otherProj))
|
||||
{
|
||||
Log.LogError($"Both {proj.FullPath} and {otherProj.FullPath} produce {id}");
|
||||
continue;
|
||||
}
|
||||
|
||||
packageToProjectMap.Add(id, proj);
|
||||
}
|
||||
|
||||
var sharedSrc = Path.Combine(sln.Directory, "shared");
|
||||
if (Directory.Exists(sharedSrc))
|
||||
{
|
||||
foreach (var dir in Directory.GetDirectories(sharedSrc, "*.Sources"))
|
||||
{
|
||||
var id = GetDirectoryName(dir);
|
||||
var artifactInfo = packageArtifacts[id];
|
||||
var sharedSrcProj = new ProjectInfo(dir,
|
||||
Array.Empty<ProjectFrameworkInfo>(),
|
||||
Array.Empty<DotNetCliReferenceInfo>(),
|
||||
true,
|
||||
artifactInfo.PackageInfo.Id,
|
||||
artifactInfo.PackageInfo.Version.ToNormalizedString());
|
||||
sharedSrcProj.SolutionInfo = sln;
|
||||
var identity = new PackageIdentity(artifactInfo.PackageInfo.Id, artifactInfo.PackageInfo.Version);
|
||||
packageToProjectMap.Add(identity, sharedSrcProj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Log.HasLoggedErrors)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < solutions.Count; i++)
|
||||
{
|
||||
var src = repoGraph[i];
|
||||
|
||||
foreach (var proj in src.Projects)
|
||||
{
|
||||
if (!proj.IsPackable
|
||||
|| proj.FullPath.Contains("samples"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var dep in proj.Frameworks.SelectMany(f => f.Dependencies.Values))
|
||||
{
|
||||
if (packageToProjectMap.TryGetValue(new PackageIdentity(dep.Id, new NuGetVersion(dep.Version)), out var target))
|
||||
{
|
||||
var j = repoGraph.FindIndex(target.SolutionInfo);
|
||||
repoGraph.SetLink(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var toolDep in proj.Tools)
|
||||
{
|
||||
if (packageToProjectMap.TryGetValue(new PackageIdentity(toolDep.Id, new NuGetVersion(toolDep.Version)), out var target))
|
||||
{
|
||||
var j = repoGraph.FindIndex(target.SolutionInfo);
|
||||
repoGraph.SetLink(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var repos = Repositories.ToDictionary(i => i.ItemSpec, i => i, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
for (var i = 0; i < repoGraph.Count; i++)
|
||||
{
|
||||
var src = repoGraph[i];
|
||||
var repoName = GetDirectoryName(src.Directory);
|
||||
var repo = repos[repoName];
|
||||
|
||||
for (var j = 0; j < repoGraph.Count; j++)
|
||||
{
|
||||
if (j == i) continue;
|
||||
if (repoGraph.HasLink(i, j))
|
||||
{
|
||||
var target = repoGraph[j];
|
||||
var targetRepoName = GetDirectoryName(target.Directory);
|
||||
var targetRepo = repos[targetRepoName];
|
||||
|
||||
if (src.Shipped && !target.Shipped)
|
||||
{
|
||||
Log.LogError($"{repoName} cannot depend on {targetRepoName}. Repos marked as 'Shipped' cannot depend on repos that are rebuilding. Update the configuration in submodule.props.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !Log.HasLoggedErrors;
|
||||
}
|
||||
|
||||
private static string GetDirectoryName(string path)
|
||||
=> Path.GetFileName(path.TrimEnd(new[] { '\\', '/' }));
|
||||
|
||||
private class AdjacencyMatrix
|
||||
{
|
||||
private readonly bool[,] _matrix;
|
||||
private readonly SolutionInfo[] _items;
|
||||
|
||||
public AdjacencyMatrix(int size)
|
||||
{
|
||||
_matrix = new bool[size, size];
|
||||
_items = new SolutionInfo[size];
|
||||
Count = size;
|
||||
}
|
||||
|
||||
public SolutionInfo this[int idx]
|
||||
{
|
||||
get => _items[idx];
|
||||
set => _items[idx] = value;
|
||||
}
|
||||
|
||||
public int FindIndex(SolutionInfo item)
|
||||
{
|
||||
return Array.FindIndex(_items, t => t.Equals(item));
|
||||
}
|
||||
|
||||
public int Count { get; }
|
||||
|
||||
public bool HasLink(int source, int target) => _matrix[source, target];
|
||||
|
||||
public void SetLink(int source, int target)
|
||||
{
|
||||
_matrix[source, target] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.Build.Construction;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace RepoTasks
|
||||
{
|
||||
public class CheckVersionOverrides : Task
|
||||
{
|
||||
[Required]
|
||||
public string DotNetPackageVersionPropsPath { get; set; }
|
||||
|
||||
[Required]
|
||||
public string DependenciesFile { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
Log.LogMessage($"Verifying versions set in {DotNetPackageVersionPropsPath} match expected versions set in {DependenciesFile}");
|
||||
|
||||
var versionOverrides = ProjectRootElement.Open(DotNetPackageVersionPropsPath);
|
||||
var dependencies = ProjectRootElement.Open(DependenciesFile);
|
||||
var pinnedVersions = dependencies.PropertyGroups
|
||||
.Where(p => !string.Equals("Package Versions: Auto", p.Label))
|
||||
.SelectMany(p => p.Properties)
|
||||
.ToDictionary(p => p.Name, p => p.Value, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
foreach (var prop in versionOverrides.Properties)
|
||||
{
|
||||
if (pinnedVersions.TryGetValue(prop.Name, out var pinnedVersion))
|
||||
{
|
||||
if (!string.Equals(pinnedVersion, prop.Value, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Log.LogError($"The imported package version props file conflicts with a pinned version variable {prop.Name}. Imported value: {prop.Value}, Pinned value: {pinnedVersion}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !Log.HasLoggedErrors;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,8 @@
|
|||
<UsingTask TaskName="RepoTasks.AddMetapackageReferences" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.AnalyzeBuildGraph" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.CheckExpectedPackagesExist" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.CheckRepoGraph" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.CheckVersionOverrides" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.CreateLzma" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.GenerateRestoreSourcesPropsFile" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
<UsingTask TaskName="RepoTasks.GenerateSubmoduleGraph" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue