Merge branch 'release/2.1' into dev
This commit is contained in:
commit
33e4aa2f4b
|
|
@ -13,7 +13,7 @@
|
||||||
ResolveCommitHash;
|
ResolveCommitHash;
|
||||||
PrepareOutputPaths;
|
PrepareOutputPaths;
|
||||||
GetFilesToPublish;
|
GetFilesToPublish;
|
||||||
CopyToPublishArtifacts;
|
PublishToLocalFolder;
|
||||||
PublishToAzureFeed;
|
PublishToAzureFeed;
|
||||||
PublishToTransportFeed;
|
PublishToTransportFeed;
|
||||||
PublishToMyGet;
|
PublishToMyGet;
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
Overwrite="true" />
|
Overwrite="true" />
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<SharedFxVersionBadge Include="$(ArtifactsDir)$(SharedFxInstallerName)-%(AllSharedFxRIDs.Identity)-version-badge.svg" />
|
<SharedFxVersionBadge Include="$(IntermediateDir)$(SharedFxInstallerName)-%(AllSharedFxRIDs.Identity)-version-badge.svg" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<GenerateSvgBadge
|
<GenerateSvgBadge
|
||||||
|
|
@ -148,17 +148,10 @@
|
||||||
<Output TaskParameter="JoinResult" ItemName="_PackageArtifactInfoWithCategory" />
|
<Output TaskParameter="JoinResult" ItemName="_PackageArtifactInfoWithCategory" />
|
||||||
</RepoTasks.JoinItems>
|
</RepoTasks.JoinItems>
|
||||||
|
|
||||||
<RepoTasks.JoinItems
|
|
||||||
Left="@(_SymbolsPackageArtifactInfo->WithMetadataValue('Category',''))" LeftKey="PackageId" LeftMetadata="*" LeftItemSpec="Identity"
|
|
||||||
Right="@(PackageArtifact)" RightMetadata="Category">
|
|
||||||
<Output TaskParameter="JoinResult" ItemName="_SymbolsArtifactInfoWithCategory" />
|
|
||||||
</RepoTasks.JoinItems>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageToPublish Include="%(_PackageArtifactInfoWithCategory.ArtifactPath)" Category="%(_PackageArtifactInfoWithCategory.Category)" />
|
<PackageToPublish Include="%(_PackageArtifactInfoWithCategory.ArtifactPath)" Category="%(_PackageArtifactInfoWithCategory.Category)" />
|
||||||
<PackageToPublish Include="%(_PackageArtifactInfo.ArtifactPath)" Category="%(_PackageArtifactInfo.Category)" Condition="'%(_PackageArtifactInfo.Category)' != ''" />
|
<PackageToPublish Include="%(_PackageArtifactInfo.ArtifactPath)" Category="%(_PackageArtifactInfo.Category)" Condition="'%(_PackageArtifactInfo.Category)' != ''" />
|
||||||
<PackageToPublish Include="%(_SymbolsArtifactInfoWithCategory.ArtifactPath)" Category="%(_SymbolsArtifactInfoWithCategory.Category)" />
|
<PackageToPublish Include="%(_SymbolsPackageArtifactInfo.ArtifactPath)" Category="symbols" />
|
||||||
<PackageToPublish Include="%(_SymbolsPackageArtifactInfo.ArtifactPath)" Category="%(_SymbolsPackageArtifactInfo.Category)" Condition="'%(_SymbolsPackageArtifactInfo.Category)' != ''" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -170,8 +163,10 @@
|
||||||
<Error Text="Missing expected files:%0A - @(_MissingArtifactFile, '%0A - ')" Condition="@(_MissingArtifactFile->Count()) != 0" />
|
<Error Text="Missing expected files:%0A - @(_MissingArtifactFile, '%0A - ')" Condition="@(_MissingArtifactFile->Count()) != 0" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="CopyToPublishArtifacts" DependsOnTargets="GetFilesToPublish">
|
<Target Name="PublishToLocalFolder" DependsOnTargets="GetFilesToPublish">
|
||||||
<Copy SourceFiles="%(FilesToPublish.Identity)" DestinationFiles="$(ArtifactsDir)%(FilesToPublish.RelativeBlobPath)" Condition="'%(FilesToPublish.RelativeBlobPath)' != ''" />
|
<Copy SourceFiles="%(FilesToPublish.Identity)" DestinationFiles="$(ArtifactsDir)%(FilesToPublish.RelativeBlobPath)" Condition="'%(FilesToPublish.RelativeBlobPath)' != ''" />
|
||||||
|
<Copy SourceFiles="%(NpmPackageToPublish.Identity)" DestinationFolder="$(ArtifactsDir)npm\" />
|
||||||
|
<Copy SourceFiles="%(PackageToPublish.Identity)" DestinationFolder="$(ArtifactsDir)packages\%(PackageToPublish.Category)\" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="PublishToMyGet"
|
<Target Name="PublishToMyGet"
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<CleanDependsOn>$(CleanDependsOn);CleanArtifacts;CleanUniverseArtifacts</CleanDependsOn>
|
<CleanDependsOn>$(CleanDependsOn);CleanArtifacts;CleanUniverseArtifacts</CleanDependsOn>
|
||||||
<RestoreDependsOn>$(RestoreDependsOn);InstallDotNet</RestoreDependsOn>
|
<RestoreDependsOn>$(RestoreDependsOn);InstallDotNet</RestoreDependsOn>
|
||||||
<CompileDependsOn>$(CompileDependsOn);BuildRepositories</CompileDependsOn>
|
<CompileDependsOn>$(CompileDependsOn);BuildRepositories</CompileDependsOn>
|
||||||
<PackageDependsOn Condition="'$(TestOnly)' != 'true'">$(PackageDependsOn);BuildMetapackages;BuildTemplates;SplitPackages</PackageDependsOn>
|
<PackageDependsOn Condition="'$(TestOnly)' != 'true'">$(PackageDependsOn);BuildMetapackages;BuildTemplates;CheckExpectedPackagesExist</PackageDependsOn>
|
||||||
<TestDependsOn>$(TestDependsOn);_TestRepositories</TestDependsOn>
|
<TestDependsOn>$(TestDependsOn);_TestRepositories</TestDependsOn>
|
||||||
<VerifyDependsOn Condition="'$(TestOnly)' != 'true'">$(VerifyDependsOn);VerifyCoherentVersions</VerifyDependsOn>
|
<VerifyDependsOn Condition="'$(TestOnly)' != 'true'">$(VerifyDependsOn);VerifyCoherentVersions</VerifyDependsOn>
|
||||||
<GetArtifactInfoDependsOn>$(GetArtifactInfoDependsOn);ResolveRepoInfo;GetLineupPackageInfo</GetArtifactInfoDependsOn>
|
<GetArtifactInfoDependsOn>$(GetArtifactInfoDependsOn);ResolveRepoInfo;GetLineupPackageInfo</GetArtifactInfoDependsOn>
|
||||||
|
|
@ -164,18 +164,6 @@
|
||||||
</RepoTasks.AnalyzeBuildGraph>
|
</RepoTasks.AnalyzeBuildGraph>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="SplitPackages">
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageArtifactFile Include="$(BuildDir)*.nupkg" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<RepoTasks.CopyPackagesToSplitFolders
|
|
||||||
Packages="@(PackageArtifact)"
|
|
||||||
Files="@(PackageArtifactFile)"
|
|
||||||
DestinationFolder="$(ArtifactsDir)"
|
|
||||||
Overwrite="true" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="VerifyPackageArtifactConfig">
|
<Target Name="VerifyPackageArtifactConfig">
|
||||||
<Error Text="Invalid configuration of %(PackageArtifact.Identity). PackageArtifact must have the 'Category' metadata."
|
<Error Text="Invalid configuration of %(PackageArtifact.Identity). PackageArtifact must have the 'Category' metadata."
|
||||||
Condition="'%(PackageArtifact.Category)' == '' " />
|
Condition="'%(PackageArtifact.Category)' == '' " />
|
||||||
|
|
@ -212,6 +200,14 @@
|
||||||
ExternalDependencies="@(ExternalDependency);@(ShippedExternalDependency)" />
|
ExternalDependencies="@(ExternalDependency);@(ShippedExternalDependency)" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="CheckExpectedPackagesExist">
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageArtifactFile Include="$(BuildDir)*.nupkg" Exclude="$(BuildDir)*.symbols.nupkg" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<RepoTasks.CheckExpectedPackagesExist Packages="@(PackageArtifact)" Files="@(PackageArtifactFile)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
<Target Name="VerifyAllReposHaveNuGetPackageVerifier" DependsOnTargets="_PrepareRepositories">
|
<Target Name="VerifyAllReposHaveNuGetPackageVerifier" DependsOnTargets="_PrepareRepositories">
|
||||||
<Error Condition="!Exists('%(Repository.RootPath)NuGetPackageVerifier.json')"
|
<Error Condition="!Exists('%(Repository.RootPath)NuGetPackageVerifier.json')"
|
||||||
Text="Repository %(Repository.Identity) is missing NuGetPackageVerifier.json. Expected file to exist in %(Repository.RootPath)NuGetPackageVerifier.json" />
|
Text="Repository %(Repository.Identity) is missing NuGetPackageVerifier.json. Expected file to exist in %(Repository.RootPath)NuGetPackageVerifier.json" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
// 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.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Microsoft.Build.Framework;
|
||||||
|
using NuGet.Packaging;
|
||||||
|
using NuGet.Packaging.Core;
|
||||||
|
using RepoTasks.Utilities;
|
||||||
|
|
||||||
|
namespace RepoTasks
|
||||||
|
{
|
||||||
|
public class CheckExpectedPackagesExist : Microsoft.Build.Utilities.Task
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The item group containing the nuget packages to split in different folders.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public ITaskItem[] Packages { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public ITaskItem[] Files { get; set; }
|
||||||
|
|
||||||
|
public override bool Execute()
|
||||||
|
{
|
||||||
|
if (Files?.Length == 0)
|
||||||
|
{
|
||||||
|
Log.LogError("No packages were found.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var expectedPackages = new HashSet<string>(Packages.Select(i => i.ItemSpec), StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
foreach (var file in Files)
|
||||||
|
{
|
||||||
|
PackageIdentity identity;
|
||||||
|
using (var reader = new PackageArchiveReader(file.ItemSpec))
|
||||||
|
{
|
||||||
|
identity = reader.GetIdentity();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!expectedPackages.Contains(identity.Id))
|
||||||
|
{
|
||||||
|
Log.LogError($"Unexpected package artifact with id: {identity.Id}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
expectedPackages.Remove(identity.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expectedPackages.Count != 0)
|
||||||
|
{
|
||||||
|
var error = new StringBuilder();
|
||||||
|
foreach (var id in expectedPackages)
|
||||||
|
{
|
||||||
|
error.Append(" - ").AppendLine(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.LogError($"Expected the following packages, but they were not found:" + error.ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !Log.HasLoggedErrors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,116 +0,0 @@
|
||||||
// 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.IO;
|
|
||||||
using System.Text;
|
|
||||||
using Microsoft.Build.Framework;
|
|
||||||
using NuGet.Packaging;
|
|
||||||
using NuGet.Packaging.Core;
|
|
||||||
using RepoTasks.Utilities;
|
|
||||||
|
|
||||||
namespace RepoTasks
|
|
||||||
{
|
|
||||||
public class CopyPackagesToSplitFolders : Microsoft.Build.Utilities.Task
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The item group containing the nuget packages to split in different folders.
|
|
||||||
/// </summary>
|
|
||||||
[Required]
|
|
||||||
public ITaskItem[] Packages { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public ITaskItem[] Files { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The folder where packages should be copied. Subfolders will be created based on package category.
|
|
||||||
/// </summary>
|
|
||||||
[Required]
|
|
||||||
public string DestinationFolder { get; set; }
|
|
||||||
|
|
||||||
public bool Overwrite { get; set; }
|
|
||||||
|
|
||||||
public override bool Execute()
|
|
||||||
{
|
|
||||||
if (Files?.Length == 0)
|
|
||||||
{
|
|
||||||
Log.LogError("No packages were found.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var expectedPackages = PackageCollection.FromItemGroup(Packages);
|
|
||||||
|
|
||||||
Directory.CreateDirectory(DestinationFolder);
|
|
||||||
|
|
||||||
foreach (var file in Files)
|
|
||||||
{
|
|
||||||
PackageIdentity identity;
|
|
||||||
using (var reader = new PackageArchiveReader(file.ItemSpec))
|
|
||||||
{
|
|
||||||
identity = reader.GetIdentity();
|
|
||||||
}
|
|
||||||
|
|
||||||
var isSymbolsPackage = file.ItemSpec.EndsWith(".symbols.nupkg", StringComparison.OrdinalIgnoreCase);
|
|
||||||
PackageCategory category;
|
|
||||||
if (isSymbolsPackage)
|
|
||||||
{
|
|
||||||
category = PackageCategory.Symbols;
|
|
||||||
}
|
|
||||||
else if (!expectedPackages.TryGetCategory(identity.Id, out category))
|
|
||||||
{
|
|
||||||
Log.LogError($"Unexpected package artifact with id: {identity.Id}");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
string destDir;
|
|
||||||
switch (category)
|
|
||||||
{
|
|
||||||
case PackageCategory.Unknown:
|
|
||||||
throw new InvalidOperationException($"Package {identity} does not have a recognized package category.");
|
|
||||||
case PackageCategory.Shipping:
|
|
||||||
destDir = Path.Combine(DestinationFolder, "ship");
|
|
||||||
break;
|
|
||||||
case PackageCategory.NoShip:
|
|
||||||
destDir = Path.Combine(DestinationFolder, "noship");
|
|
||||||
break;
|
|
||||||
case PackageCategory.ShipOob:
|
|
||||||
destDir = Path.Combine(DestinationFolder, "shipoob");
|
|
||||||
break;
|
|
||||||
case PackageCategory.Symbols:
|
|
||||||
destDir = Path.Combine(DestinationFolder, "symbols");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
Directory.CreateDirectory(destDir);
|
|
||||||
|
|
||||||
var destFile = Path.Combine(destDir, Path.GetFileName(file.ItemSpec));
|
|
||||||
|
|
||||||
if (!Overwrite && File.Exists(destFile))
|
|
||||||
{
|
|
||||||
Log.LogError($"File already exists in {destFile}");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.LogMessage($"Copying {file.ItemSpec} to {destFile}");
|
|
||||||
File.Copy(file.ItemSpec, destFile, Overwrite);
|
|
||||||
expectedPackages.Remove(identity.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (expectedPackages.Count != 0)
|
|
||||||
{
|
|
||||||
var error = new StringBuilder();
|
|
||||||
foreach (var key in expectedPackages.Keys)
|
|
||||||
{
|
|
||||||
error.Append(" - ").AppendLine(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.LogError($"Expected the following packages, but they were not found:" + error.ToString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !Log.HasLoggedErrors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<UsingTask TaskName="RepoTasks.AddArchiveReferences" AssemblyFile="$(_RepoTaskAssembly)" />
|
<UsingTask TaskName="RepoTasks.AddArchiveReferences" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||||
<UsingTask TaskName="RepoTasks.AddMetapackageReferences" AssemblyFile="$(_RepoTaskAssembly)" />
|
<UsingTask TaskName="RepoTasks.AddMetapackageReferences" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||||
<UsingTask TaskName="RepoTasks.AnalyzeBuildGraph" AssemblyFile="$(_RepoTaskAssembly)" />
|
<UsingTask TaskName="RepoTasks.AnalyzeBuildGraph" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||||
<UsingTask TaskName="RepoTasks.CopyPackagesToSplitFolders" AssemblyFile="$(_RepoTaskAssembly)" />
|
<UsingTask TaskName="RepoTasks.CheckExpectedPackagesExist" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||||
<UsingTask TaskName="RepoTasks.CreateLzma" AssemblyFile="$(_RepoTaskAssembly)" />
|
<UsingTask TaskName="RepoTasks.CreateLzma" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||||
<UsingTask TaskName="RepoTasks.GenerateRestoreSourcesPropsFile" AssemblyFile="$(_RepoTaskAssembly)" />
|
<UsingTask TaskName="RepoTasks.GenerateRestoreSourcesPropsFile" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||||
<UsingTask TaskName="RepoTasks.JoinItems" AssemblyFile="$(_RepoTaskAssembly)" />
|
<UsingTask TaskName="RepoTasks.JoinItems" AssemblyFile="$(_RepoTaskAssembly)" />
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
// 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.
|
|
||||||
|
|
||||||
|
|
||||||
namespace RepoTasks.Utilities
|
|
||||||
{
|
|
||||||
public enum PackageCategory
|
|
||||||
{
|
|
||||||
Unknown = 0,
|
|
||||||
Shipping,
|
|
||||||
NoShip,
|
|
||||||
ShipOob,
|
|
||||||
Symbols,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
// 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.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.Build.Framework;
|
|
||||||
|
|
||||||
namespace RepoTasks.Utilities
|
|
||||||
{
|
|
||||||
public class PackageCollection
|
|
||||||
{
|
|
||||||
private readonly IDictionary<string, PackageCategory> _packages = new Dictionary<string, PackageCategory>(StringComparer.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
private PackageCollection()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryGetCategory(string packageId, out PackageCategory category) => _packages.TryGetValue(packageId, out category);
|
|
||||||
|
|
||||||
public void Remove(string packageId) => _packages.Remove(packageId);
|
|
||||||
|
|
||||||
public int Count => _packages.Count;
|
|
||||||
|
|
||||||
public IEnumerable<string> Keys => _packages.Keys;
|
|
||||||
|
|
||||||
public static PackageCollection FromItemGroup(ITaskItem[] items)
|
|
||||||
{
|
|
||||||
var list = new PackageCollection();
|
|
||||||
if (items == null)
|
|
||||||
{
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var item in items)
|
|
||||||
{
|
|
||||||
PackageCategory category;
|
|
||||||
switch (item.GetMetadata("Category")?.ToLowerInvariant())
|
|
||||||
{
|
|
||||||
case "ship":
|
|
||||||
category = PackageCategory.Shipping;
|
|
||||||
break;
|
|
||||||
case "noship":
|
|
||||||
category = PackageCategory.NoShip;
|
|
||||||
break;
|
|
||||||
case "shipoob":
|
|
||||||
category = PackageCategory.ShipOob;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
category = PackageCategory.Unknown;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (list._packages.ContainsKey(item.ItemSpec))
|
|
||||||
{
|
|
||||||
throw new InvalidDataException($"Duplicate package id detected: {item.ItemSpec}");
|
|
||||||
}
|
|
||||||
|
|
||||||
list._packages.Add(item.ItemSpec, category);
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue