diff --git a/build/PackageArchive.targets b/build/PackageArchive.targets index c92c5455d3e4..049338f962bb 100644 --- a/build/PackageArchive.targets +++ b/build/PackageArchive.targets @@ -8,7 +8,7 @@ - + DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath); diff --git a/build/RepositoryBuild.targets b/build/RepositoryBuild.targets index 428b35b65d6d..6457bbf13bc7 100644 --- a/build/RepositoryBuild.targets +++ b/build/RepositoryBuild.targets @@ -83,7 +83,8 @@ $(RepositoryBuildArguments) /p:BuildNumber=$(BuildNumber) $(RepositoryBuildArguments) /p:Configuration=$(Configuration) $(RepositoryBuildArguments) /p:IsFinalBuild=$(IsFinalBuild) - $(RepositoryBuildArguments) /noconsolelogger '/l:RepoTasks.FlowLogger,$(MSBuildThisFileDirectory)tasks\bin\publish\RepoTasks.dll;Summary;FlowId=$(RepositoryToBuild)' + + $(RepositoryBuildArguments) /p:DisableCodeSigning=true $(RepositoryBuildArguments) '/p:DotNetAssetRootAccessTokenSuffix=$(DotNetAssetRootAccessTokenSuffix)' $(RepositoryBuildArguments) '/p:DotNetAssetRootUrl=$(DotNetAssetRootUrl)' $(RepositoryBuildArguments) /p:SkipAspNetCoreRuntimeInstall=true diff --git a/build/artifacts.props b/build/artifacts.props index 5e6e21bed355..debe7bdcd4df 100644 --- a/build/artifacts.props +++ b/build/artifacts.props @@ -24,7 +24,6 @@ - diff --git a/build/external-dependencies.props b/build/external-dependencies.props index fa23f8968687..7cb96166b253 100644 --- a/build/external-dependencies.props +++ b/build/external-dependencies.props @@ -10,93 +10,80 @@ false - - - - - - - false - - false - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - diff --git a/build/lineups/Internal.AspNetCore.Universe.Lineup.nuspec b/build/lineups/Internal.AspNetCore.Universe.Lineup.nuspec deleted file mode 100644 index 1209016b0456..000000000000 --- a/build/lineups/Internal.AspNetCore.Universe.Lineup.nuspec +++ /dev/null @@ -1,16 +0,0 @@ - - - - Internal.AspNetCore.Universe.Lineup - $version$ - Microsoft - This package used to unify ASP.NET Core package versions across all ASP.NET Core repos. Internal use only. - - - - - - - - - diff --git a/build/repo.beforecommon.props b/build/repo.beforecommon.props deleted file mode 100644 index f470e9b2a653..000000000000 --- a/build/repo.beforecommon.props +++ /dev/null @@ -1,10 +0,0 @@ - - - - true - - diff --git a/build/repo.props b/build/repo.props index 2c9111294dc9..73cec397f5b4 100644 --- a/build/repo.props +++ b/build/repo.props @@ -54,7 +54,7 @@ + Exclude=" + @(ProjectToExclude); + $(RepositoryRoot)**\bin\**\*; + $(RepositoryRoot)**\obj\**\*; + $(RepositoryRoot)**\AutobahnTestApp\**\*;" /> diff --git a/build/repo.targets b/build/repo.targets index 2a7778a14f7d..340b8ff9a6b2 100644 --- a/build/repo.targets +++ b/build/repo.targets @@ -5,9 +5,7 @@ - - - + $(IntermediateDir)dependencies.g.props @@ -67,7 +65,7 @@ - + MicrosoftNETCoreAppPackageVersion=$(MicrosoftNETCoreAppPackageVersion); @@ -154,18 +152,6 @@ - - - - NuGetPackage - Internal.AspNetCore.Universe.Lineup - $(PackageVersion) - noship - true - - - - <_LineupPackages Include="@(ExternalDependency)" /> @@ -209,13 +195,6 @@ - - - - @@ -223,26 +202,6 @@ - - <_RepositoriesToInclude Include="$(KOREBUILD_REPOSITORY_INCLUDE)" /> - - - - - - <_RepositoriesToExclude Include="$(KOREBUILD_REPOSITORY_EXCLUDE)" /> - - - - - @@ -252,36 +211,20 @@ - + - - <_UndeclaredPackageArtifact Include="%(ArtifactInfo.PackageId)" Condition="'%(ArtifactInfo.ArtifactType)' == 'NuGetPackage'" /> <_UndeclaredPackageArtifact Remove="@(PackageArtifact)" /> + - - - - - diff --git a/build/tasks/AnalyzeBuildGraph.cs b/build/tasks/AnalyzeBuildGraph.cs deleted file mode 100644 index c70d1d8a56c1..000000000000 --- a/build/tasks/AnalyzeBuildGraph.cs +++ /dev/null @@ -1,299 +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; -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.Versioning; -using RepoTools.BuildGraph; -using RepoTasks.ProjectModel; -using RepoTasks.Utilities; - -namespace RepoTasks -{ - public class AnalyzeBuildGraph : Task, ICancelableTask - { - private readonly CancellationTokenSource _cts = new CancellationTokenSource(); - - /// - /// Repositories that we are building new versions of. - /// - [Required] - public ITaskItem[] Solutions { get; set; } - - [Required] - public ITaskItem[] Artifacts { get; set; } - - [Required] - public ITaskItem[] Repositories { get; set; } - - [Required] - public ITaskItem[] Dependencies { get; set; } - - [Required] - public string Properties { get; set; } - - public string StartGraphAt { get; set; } - - /// - /// The order in which to build repositories - /// - [Output] - public ITaskItem[] RepositoryBuildOrder { get; set; } - - public void Cancel() - { - _cts.Cancel(); - } - - public override bool Execute() - { - var packageArtifacts = Artifacts.Select(ArtifactInfo.Parse) - .OfType() - .Where(p => !p.IsSymbolsArtifact); - - var factory = new SolutionInfoFactory(Log, BuildEngine5); - var props = MSBuildListSplitter.GetNamedProperties(Properties); - - Log.LogMessage(MessageImportance.High, $"Beginning cross-repo analysis on {Solutions.Length} solutions. Hang tight..."); - - if (!props.TryGetValue("Configuration", out var defaultConfig)) - { - defaultConfig = "Debug"; - } - - var solutions = factory.Create(Solutions, props, defaultConfig, _cts.Token); - Log.LogMessage($"Found {solutions.Count} and {solutions.Sum(p => p.Projects.Count)} projects"); - - var policies = new Dictionary(); - foreach (var repo in Repositories) - { - policies.Add(repo.ItemSpec, Enum.Parse(repo.GetMetadata("PatchPolicy"))); - } - - foreach (var solution in solutions) - { - var repoName = Path.GetFileName(solution.Directory); - solution.PatchPolicy = policies[repoName]; - } - - if (_cts.IsCancellationRequested) - { - return false; - } - - EnsureConsistentGraph(packageArtifacts, solutions); - RepositoryBuildOrder = GetRepositoryBuildOrder(packageArtifacts, solutions.Where(s => s.ShouldBuild)); - - return !Log.HasLoggedErrors; - } - - private struct VersionMismatch - { - public SolutionInfo Solution; - public ProjectInfo Project; - public string PackageId; - public string ActualVersion; - public NuGetVersion ExpectedVersion; - } - - private void EnsureConsistentGraph(IEnumerable packages, IEnumerable solutions) - { - // ensure versions cascade - var buildPackageMap = packages.ToDictionary(p => p.PackageInfo.Id, p => p, StringComparer.OrdinalIgnoreCase); - var dependencyMap = new Dictionary>(StringComparer.OrdinalIgnoreCase); - foreach (var dep in Dependencies) - { - if (dep.GetMetadata("IsExtensionsPackage") == "true") - { - buildPackageMap.Add(dep.ItemSpec, new ArtifactInfo.Package - { - PackageInfo = new PackageInfo(dep.ItemSpec, new NuGetVersion(dep.GetMetadata("Version")), null, null), - }); - } - else - { - if (!dependencyMap.TryGetValue(dep.ItemSpec, out var versions)) - { - dependencyMap[dep.ItemSpec] = versions = new List(); - } - - versions.Add(new ExternalDependency - { - PackageId = dep.ItemSpec, - Version = dep.GetMetadata("Version"), - }); - } - } - - var inconsistentVersions = new List(); - - foreach (var solution in solutions) - foreach (var project in solution.Projects) - foreach (var tfm in project.Frameworks) - foreach (var dependency in tfm.Dependencies) - { - if (!buildPackageMap.TryGetValue(dependency.Key, out var package)) - { - var idx = -1; - // This dependency is not one of the packages that will be compiled by this run of Universe. - if (!dependencyMap.TryGetValue(dependency.Key, out var externalVersions) - || (idx = externalVersions.FindIndex(0, externalVersions.Count, i => i.Version == dependency.Value.Version)) < 0) - { - Log.LogKoreBuildError( - project.FullPath, - KoreBuildErrors.UndefinedExternalDependency, - message: $"Undefined external dependency on {dependency.Key}/{dependency.Value.Version}"); - } - - if (idx >= 0) - { - externalVersions[idx].IsReferenced = true; - } - continue; - } - - var refVersion = VersionRange.Parse(dependency.Value.Version); - if (refVersion.IsFloating && refVersion.Float.Satisfies(package.PackageInfo.Version)) - { - continue; - } - else if (package.PackageInfo.Version.Equals(refVersion.MinVersion)) - { - continue; - } - - var shouldCascade = (solution.PatchPolicy & PatchPolicy.CascadeVersions) != 0; - if (!solution.ShouldBuild && !solution.IsPatching && shouldCascade) - { - var repoName = Path.GetFileName(Path.GetDirectoryName(solution.FullPath)); - Log.LogError($"{repoName} should not be marked 'IsPatching=false'. Version changes in other repositories mean it should be patched to perserve cascading version upgrades."); - - } - - if (shouldCascade) - { - inconsistentVersions.Add(new VersionMismatch - { - Solution = solution, - Project = project, - PackageId = dependency.Key, - ActualVersion = dependency.Value.Version, - ExpectedVersion = package.PackageInfo.Version, - }); - } - } - - if (inconsistentVersions.Count != 0) - { - var sb = new StringBuilder(); - sb.AppendLine(); - sb.AppendLine($"Repos are inconsistent. The following projects have PackageReferences that should be updated"); - foreach (var solution in inconsistentVersions.GroupBy(p => p.Solution.FullPath)) - { - sb.Append(" - ").AppendLine(Path.GetFileName(solution.Key)); - foreach (var project in solution.GroupBy(p => p.Project.FullPath)) - { - sb.Append(" - ").AppendLine(Path.GetFileName(project.Key)); - foreach (var mismatchedReference in project) - { - sb.AppendLine($" + {mismatchedReference.PackageId}/{{{mismatchedReference.ActualVersion} => {mismatchedReference.ExpectedVersion}}}"); - } - } - } - sb.AppendLine(); - Log.LogMessage(MessageImportance.High, sb.ToString()); - Log.LogError("Package versions are inconsistent. See build log for details."); - } - - foreach (var versions in dependencyMap.Values) - { - foreach (var item in versions.Where(i => !i.IsReferenced)) - { - // See https://github.com/aspnet/Universe/wiki/Build-warning-and-error-codes#potentially-unused-external-dependency for details - Log.LogMessage(MessageImportance.Normal, $"Potentially unused external dependency: {item.PackageId}/{item.Version}. See https://github.com/aspnet/Universe/wiki/Build-warning-and-error-codes for details."); - } - } - } - - private ITaskItem[] GetRepositoryBuildOrder(IEnumerable artifacts, IEnumerable solutions) - { - var repositories = solutions.Select(s => - { - var repoName = Path.GetFileName(Path.GetDirectoryName(s.FullPath)); - var repo = new Repository(repoName) - { - RootDir = Path.GetDirectoryName(s.FullPath) - }; - - var packages = artifacts - .Where(a => string.Equals(a.RepoName, repoName, StringComparison.OrdinalIgnoreCase)) - .ToDictionary(p => p.PackageInfo.Id, p => p, StringComparer.OrdinalIgnoreCase); - - foreach (var proj in s.Projects) - { - IList projectGroup; - if (packages.ContainsKey(proj.PackageId)) - { - // this project is a package producer and consumer - packages.Remove(proj.PackageId); - projectGroup = repo.Projects; - } - else - { - // this project is a package consumer - projectGroup = repo.SupportProjects; - } - - - projectGroup.Add(new Project(proj.PackageId) - { - Repository = repo, - PackageReferences = new HashSet(proj - .Frameworks - .SelectMany(f => f.Dependencies.Keys) - .Concat(proj.Tools.Select(t => t.Id)), StringComparer.OrdinalIgnoreCase), - }); - } - - foreach (var packageId in packages.Keys) - { - // these packages are produced from something besides a csproj. e.g. .Sources packages - repo.Projects.Add(new Project(packageId) { Repository = repo }); - } - - return repo; - }).ToList(); - - var graph = GraphBuilder.Generate(repositories, StartGraphAt, Log); - var repositoriesWithOrder = new List<(ITaskItem repository, int order)>(); - foreach (var repository in repositories) - { - var graphNodeRepository = graph.FirstOrDefault(g => g.Repository.Name == repository.Name); - if (graphNodeRepository == null) - { - // StartGraphAt was specified so the graph is incomplete. - continue; - } - - var order = TopologicalSort.GetOrder(graphNodeRepository); - var repositoryTaskItem = new TaskItem(repository.Name); - repositoryTaskItem.SetMetadata("Order", order.ToString()); - repositoryTaskItem.SetMetadata("RootPath", repository.RootDir); - repositoriesWithOrder.Add((repositoryTaskItem, order)); - } - - return repositoriesWithOrder - .OrderBy(r => r.order) - .Select(r => r.repository) - .ToArray(); - } - } -} diff --git a/build/tasks/BuildGraph/ExternalDependency.cs b/build/tasks/BuildGraph/ExternalDependency.cs deleted file mode 100644 index 5bdc67d02793..000000000000 --- a/build/tasks/BuildGraph/ExternalDependency.cs +++ /dev/null @@ -1,12 +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 RepoTools.BuildGraph -{ - internal class ExternalDependency - { - public string PackageId { get; set; } - public string Version { get; set; } - public bool IsReferenced { get; set; } - } -} diff --git a/build/tasks/BuildGraph/GraphBuilder.cs b/build/tasks/BuildGraph/GraphBuilder.cs deleted file mode 100644 index d70b1ba45d00..000000000000 --- a/build/tasks/BuildGraph/GraphBuilder.cs +++ /dev/null @@ -1,74 +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.Utilities; - -namespace RepoTools.BuildGraph -{ - public static class GraphBuilder - { - public static IList Generate(IList repositories, string root, TaskLoggingHelper log) - { - // Build global list of primary projects - var primaryProjects = repositories.SelectMany(c => c.Projects) - .ToDictionary(p => p.Name, StringComparer.OrdinalIgnoreCase); - var graphNodes = repositories.Select(r => new GraphNode { Repository = r }) - .ToDictionary(r => r.Repository); - - GraphNode searchRoot = null; - - foreach (var project in repositories.SelectMany(r => r.AllProjects)) - { - var thisProjectRepositoryNode = graphNodes[project.Repository]; - if (!string.IsNullOrEmpty(root) && string.Equals(root, project.Repository.Name, StringComparison.OrdinalIgnoreCase)) - { - searchRoot = thisProjectRepositoryNode; - } - - foreach (var packageDependency in project.PackageReferences) - { - if (primaryProjects.TryGetValue(packageDependency, out var dependencyProject)) - { - var dependencyRepository = dependencyProject.Repository; - var dependencyNode = graphNodes[dependencyRepository]; - - if (ReferenceEquals(thisProjectRepositoryNode, dependencyNode)) - { - log.LogWarning("{0} has a package reference to a package produced in the same repo. {1} -> {2}", project.Repository.Name, Path.GetFileName(project.Path), packageDependency); - } - else - { - thisProjectRepositoryNode.Incoming.Add(dependencyNode); - } - - dependencyNode.Outgoing.Add(thisProjectRepositoryNode); - } - } - } - - var results = new HashSet(); - if (searchRoot != null) - { - Visit(results, searchRoot); - return results.ToList(); - } - - return graphNodes.Values.ToList(); - } - - private static void Visit(HashSet results, GraphNode searchRoot) - { - if (results.Add(searchRoot)) - { - foreach (var node in searchRoot.Outgoing) - { - Visit(results, node); - } - } - } - } -} diff --git a/build/tasks/BuildGraph/GraphNode.cs b/build/tasks/BuildGraph/GraphNode.cs deleted file mode 100644 index b7197e8b38aa..000000000000 --- a/build/tasks/BuildGraph/GraphNode.cs +++ /dev/null @@ -1,18 +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.Collections.Generic; -using System.Diagnostics; - -namespace RepoTools.BuildGraph -{ - [DebuggerDisplay("{Repository.Name}")] - public class GraphNode - { - public Repository Repository { get; set; } - - public ISet Incoming { get; } = new HashSet(); - - public ISet Outgoing { get; } = new HashSet(); - } -} diff --git a/build/tasks/BuildGraph/Project.cs b/build/tasks/BuildGraph/Project.cs deleted file mode 100644 index ad03468a6131..000000000000 --- a/build/tasks/BuildGraph/Project.cs +++ /dev/null @@ -1,28 +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.Diagnostics; - -namespace RepoTools.BuildGraph -{ - [DebuggerDisplay("{Name}")] - public class Project - { - public Project(string name) - { - Name = name; - } - - public string Name { get; } - - public string Version { get; set; } - - public string Path { get; set; } - - public Repository Repository { get; set; } - - public ISet PackageReferences { get; set; } = new HashSet(StringComparer.OrdinalIgnoreCase); - } -} diff --git a/build/tasks/BuildGraph/Repository.cs b/build/tasks/BuildGraph/Repository.cs deleted file mode 100644 index e5bdaf414e91..000000000000 --- a/build/tasks/BuildGraph/Repository.cs +++ /dev/null @@ -1,33 +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.Diagnostics; -using System.Linq; - -namespace RepoTools.BuildGraph -{ - [DebuggerDisplay("{Name}")] - public class Repository : IEquatable - { - public Repository(string name) - { - Name = name; - } - - public string Name { get; private set; } - - public string RootDir { get; set; } - - public IList Projects { get; } = new List(); - - public IList SupportProjects { get; } = new List(); - - public IEnumerable AllProjects => Projects.Concat(SupportProjects); - - public bool Equals(Repository other) => string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase); - - public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Name); - } -} diff --git a/build/tasks/BuildGraph/TopologicalSort.cs b/build/tasks/BuildGraph/TopologicalSort.cs deleted file mode 100644 index 161a9913d7cf..000000000000 --- a/build/tasks/BuildGraph/TopologicalSort.cs +++ /dev/null @@ -1,46 +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.Linq; - -namespace RepoTools.BuildGraph -{ - public class TopologicalSort : IComparer - { - public static readonly TopologicalSort Instance = new TopologicalSort(); - - public int Compare(GraphNode x, GraphNode y) - { - var xScore = GetOrder(x); - var yScore = GetOrder(y); - return xScore.CompareTo(yScore); - } - - public static int GetOrder(GraphNode node) - { - var visited = new List(); - return GetOrder(node, visited); - } - - private static int GetOrder(GraphNode node, List visited) - { - if (visited.Contains(node)) - { - var cycle = string.Join(" -> ", visited.Select(v => v.Repository.Name)); - throw new Exception($"Cycle detected in the build graph: {cycle} -> {node.Repository.Name}."); - } - - var score = 0; - visited.Add(node); - foreach (var dependentNode in node.Incoming) - { - score = Math.Max(score, GetOrder(dependentNode, visited)); - } - visited.RemoveAt(visited.Count - 1); - - return score + 1; - } - } -} diff --git a/build/tasks/CheckRepoGraph.cs b/build/tasks/CheckRepoGraph.cs deleted file mode 100644 index eecd32580e30..000000000000 --- a/build/tasks/CheckRepoGraph.cs +++ /dev/null @@ -1,223 +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; -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() - .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(); - - 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(), - Array.Empty(), - 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]; - - var policy = Enum.Parse(repo.GetMetadata("PatchPolicy")); - - if ((policy & PatchPolicy.AlwaysUpdate) != 0 && !src.IsPatching) - { - Log.LogError($"{repoName} is not currently set to patch, but it should because the policy is set to always include this in servicing updates. Update the configuration in submodule.props."); - continue; - } - - var srcShouldCascade = (policy & PatchPolicy.CascadeVersions) != 0; - 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 (srcShouldCascade && !src.IsPatching && target.IsPatching) - { - Log.LogError($"{repoName} should be patching because it depend on {targetRepoName} and its patch policy is to cascade version changes. 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; - } - } - } -} diff --git a/build/tasks/Logger/FlowLogger.cs b/build/tasks/Logger/FlowLogger.cs deleted file mode 100644 index e6a214fdffa8..000000000000 --- a/build/tasks/Logger/FlowLogger.cs +++ /dev/null @@ -1,61 +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.Linq; -using Microsoft.Build.Framework; -using Microsoft.Build.Logging; - -namespace RepoTasks -{ - public class FlowLogger : ConsoleLogger - { - private volatile bool _initialized; - - public FlowLogger() - { - } - - public override void Initialize(IEventSource eventSource, int nodeCount) - { - PreInit(eventSource); - base.Initialize(eventSource, nodeCount); - } - - public override void Initialize(IEventSource eventSource) - { - PreInit(eventSource); - base.Initialize(eventSource); - } - - private void PreInit(IEventSource eventSource) - { - if (_initialized) return; - _initialized = true; - - var flowId = GetFlowId(); - var prefix = $"{flowId,-22}| "; - var write = WriteHandler; - WriteHandler = msg => write(prefix + msg); - - eventSource.BuildStarted += (o, e) => - { - WriteHandler(e.Message + Environment.NewLine); - }; - } - - private string GetFlowId() - { - var parameters = Parameters?.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); - if (parameters == null || parameters.Length == 0) - { - return null; - } - - const string flowIdParamName = "FlowId="; - return parameters - .FirstOrDefault(p => p.StartsWith(flowIdParamName, StringComparison.Ordinal)) - ?.Substring(flowIdParamName.Length); - } - } -} diff --git a/build/tasks/ProjectModel/DotNetCliReferenceInfo.cs b/build/tasks/ProjectModel/DotNetCliReferenceInfo.cs deleted file mode 100644 index c490dab999b6..000000000000 --- a/build/tasks/ProjectModel/DotNetCliReferenceInfo.cs +++ /dev/null @@ -1,24 +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; - -namespace RepoTasks.ProjectModel -{ - internal class DotNetCliReferenceInfo - { - public DotNetCliReferenceInfo(string id, string version) - { - if (string.IsNullOrEmpty(id)) - { - throw new ArgumentException(nameof(id)); - } - - Id = id; - Version = version; - } - - public string Id { get; } - public string Version { get; } - } -} diff --git a/build/tasks/ProjectModel/PackageInfo.cs b/build/tasks/ProjectModel/PackageInfo.cs deleted file mode 100644 index bb499a1b219e..000000000000 --- a/build/tasks/ProjectModel/PackageInfo.cs +++ /dev/null @@ -1,44 +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 NuGet.Frameworks; -using NuGet.Packaging; -using NuGet.Versioning; - -namespace RepoTasks.ProjectModel -{ - internal class PackageInfo - { - public PackageInfo(string id, - NuGetVersion version, - IReadOnlyList dependencyGroups, - string source, - string packageType = "Dependency") - { - if (string.IsNullOrEmpty(id)) - { - throw new ArgumentException(nameof(id)); - } - - Id = id; - Version = version ?? throw new ArgumentNullException(nameof(version)); - PackageType = packageType; - Source = source; - DependencyGroups = dependencyGroups ?? Array.Empty(); - } - - public string Id { get; } - public NuGetVersion Version { get; } - public string PackageType { get; } - /// - /// Can be a https feed or a file path. May be null. - /// - public string Source { get; } - public IReadOnlyList DependencyGroups { get; } - - public override string ToString() => $"{Id}/{Version}"; - } -} diff --git a/build/tasks/ProjectModel/PackageReferenceInfo.cs b/build/tasks/ProjectModel/PackageReferenceInfo.cs deleted file mode 100644 index cea7d566ef80..000000000000 --- a/build/tasks/ProjectModel/PackageReferenceInfo.cs +++ /dev/null @@ -1,27 +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; - -namespace RepoTasks.ProjectModel -{ - internal class PackageReferenceInfo - { - public PackageReferenceInfo(string id, string version, bool isImplicitlyDefined) - { - if (string.IsNullOrEmpty(id)) - { - throw new ArgumentException(nameof(id)); - } - - Id = id; - Version = version; - IsImplicitlyDefined = isImplicitlyDefined; - } - - public string Id { get; } - public string Version { get; } - public bool IsImplicitlyDefined { get; } - } -} diff --git a/build/tasks/ProjectModel/PatchPolicy.cs b/build/tasks/ProjectModel/PatchPolicy.cs deleted file mode 100644 index a28451cabb38..000000000000 --- a/build/tasks/ProjectModel/PatchPolicy.cs +++ /dev/null @@ -1,31 +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.Linq; -using NuGet.Frameworks; - -namespace RepoTasks.ProjectModel -{ - [Flags] - internal enum PatchPolicy - { - /// - /// Only produce new package versions if there were changes to product code. - /// - ProductChangesOnly = 1 << 0, - - /// - /// Packages should update in every patch. - /// - AlwaysUpdate = 1 << 1, - - /// - /// Produce new package versions if there were changes to product code, or if one of the package dependencies has updated. - /// - CascadeVersions = 1 << 2, - - AlwaysUpdateAndCascadeVersions = CascadeVersions | AlwaysUpdate, - } -} diff --git a/build/tasks/ProjectModel/ProjectFrameworkInfo.cs b/build/tasks/ProjectModel/ProjectFrameworkInfo.cs deleted file mode 100644 index 35a212f9a12a..000000000000 --- a/build/tasks/ProjectModel/ProjectFrameworkInfo.cs +++ /dev/null @@ -1,22 +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.Linq; -using NuGet.Frameworks; - -namespace RepoTasks.ProjectModel -{ - internal class ProjectFrameworkInfo - { - public ProjectFrameworkInfo(NuGetFramework targetFramework, IReadOnlyDictionary dependencies) - { - TargetFramework = targetFramework ?? throw new ArgumentNullException(nameof(targetFramework)); - Dependencies = dependencies ?? throw new ArgumentNullException(nameof(dependencies)); - } - - public NuGetFramework TargetFramework { get; } - public IReadOnlyDictionary Dependencies { get; } - } -} diff --git a/build/tasks/ProjectModel/ProjectInfo.cs b/build/tasks/ProjectModel/ProjectInfo.cs deleted file mode 100644 index 4f4b7a3a9c04..000000000000 --- a/build/tasks/ProjectModel/ProjectInfo.cs +++ /dev/null @@ -1,47 +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; - -namespace RepoTasks.ProjectModel -{ - internal class ProjectInfo - { - public ProjectInfo(string fullPath, - IReadOnlyList frameworks, - IReadOnlyList tools, - bool isPackable, - string packageId, - string packageVersion) - { - if (!Path.IsPathRooted(fullPath)) - { - throw new ArgumentException("Path must be absolute", nameof(fullPath)); - } - - Frameworks = frameworks ?? throw new ArgumentNullException(nameof(frameworks)); - Tools = tools ?? throw new ArgumentNullException(nameof(tools)); - - FullPath = fullPath; - FileName = Path.GetFileName(fullPath); - Directory = Path.GetDirectoryName(FullPath); - IsPackable = isPackable; - PackageId = packageId; - PackageVersion = packageVersion; - } - - public string FullPath { get; } - public string FileName { get; } - public string Directory { get; } - public string PackageId { get; } - public string PackageVersion { get; } - public bool IsPackable { get; } - - public SolutionInfo SolutionInfo { get; set; } - - public IReadOnlyList Frameworks { get; } - public IReadOnlyList Tools { get; } - } -} diff --git a/build/tasks/ProjectModel/ProjectInfoFactory.cs b/build/tasks/ProjectModel/ProjectInfoFactory.cs deleted file mode 100644 index 40592f30faeb..000000000000 --- a/build/tasks/ProjectModel/ProjectInfoFactory.cs +++ /dev/null @@ -1,137 +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.Construction; -using Microsoft.Build.Evaluation; -using Microsoft.Build.Execution; -using NuGet.Frameworks; -using RepoTasks.Utilities; -using Microsoft.Build.Utilities; - -namespace RepoTasks.ProjectModel -{ - internal class ProjectInfoFactory - { - private readonly TaskLoggingHelper _logger; - - public ProjectInfoFactory(TaskLoggingHelper logger) - { - _logger = logger ?? throw new ArgumentNullException(nameof(logger)); - } - - public ProjectInfo Create(string path, ProjectCollection projectCollection) - { - var project = GetProject(path, projectCollection); - var instance = project.CreateProjectInstance(ProjectInstanceSettings.ImmutableWithFastItemLookup); - - var targetFrameworks = instance.GetPropertyValue("TargetFrameworks"); - var targetFramework = instance.GetPropertyValue("TargetFramework"); - - var frameworks = new List(); - if (!string.IsNullOrEmpty(targetFrameworks) && string.IsNullOrEmpty(targetFramework)) - { - // multi targeting - foreach (var tfm in targetFrameworks.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) - { - project.SetGlobalProperty("TargetFramework", tfm); - var innerBuild = project.CreateProjectInstance(ProjectInstanceSettings.ImmutableWithFastItemLookup); - - var tfmInfo = new ProjectFrameworkInfo(NuGetFramework.Parse(tfm), GetDependencies(innerBuild)); - - frameworks.Add(tfmInfo); - } - - project.RemoveGlobalProperty("TargetFramework"); - } - else if (!string.IsNullOrEmpty(targetFramework)) - { - var tfmInfo = new ProjectFrameworkInfo(NuGetFramework.Parse(targetFramework), GetDependencies(instance)); - - frameworks.Add(tfmInfo); - } - - var projectDir = Path.GetDirectoryName(path); - - var tools = GetTools(instance).ToArray(); - bool.TryParse(instance.GetPropertyValue("IsPackable"), out var isPackable); - - if (isPackable) - { - // the default packable setting is disabled for projects referencing this package. - isPackable = !frameworks.SelectMany(f => f.Dependencies.Keys).Any(d => d.Equals("Microsoft.NET.Test.Sdk", StringComparison.OrdinalIgnoreCase)); - } - - var packageId = instance.GetPropertyValue("PackageId"); - var packageVersion = instance.GetPropertyValue("PackageVersion"); - - return new ProjectInfo(path, - frameworks, - tools, - isPackable, - packageId, - packageVersion); - } - - private static object _projLock = new object(); - - private static Project GetProject(string path, ProjectCollection projectCollection) - { - var projects = projectCollection.GetLoadedProjects(path); - foreach(var proj in projects) - { - if (proj.GetPropertyValue("DesignTimeBuild") == "true") - { - return proj; - } - } - - var xml = ProjectRootElement.Open(path, projectCollection); - var globalProps = new Dictionary() - { - ["DesignTimeBuild"] = "true", - // Isolate the project from post-restore side effects - ["ExcludeRestorePackageImports"] = "true", - }; - - var project = new Project(xml, - globalProps, - toolsVersion: "15.0", - projectCollection: projectCollection) - { - IsBuildEnabled = false - }; - - return project; - } - - private IReadOnlyDictionary GetDependencies(ProjectInstance project) - { - var references = new Dictionary(StringComparer.OrdinalIgnoreCase); - foreach (var item in project.GetItems("PackageReference")) - { - bool.TryParse(item.GetMetadataValue("IsImplicitlyDefined"), out var isImplicit); - - var info = new PackageReferenceInfo(item.EvaluatedInclude, item.GetMetadataValue("Version"), isImplicit); - - if (references.ContainsKey(info.Id)) - { - _logger.LogKoreBuildWarning(project.ProjectFileLocation.File, KoreBuildErrors.DuplicatePackageReference, $"Found a duplicate PackageReference for {info.Id}. Restore results may be unpredictable."); - } - - references[info.Id] = info; - } - - return references; - } - - private static IEnumerable GetTools(ProjectInstance project) - { - return project.GetItems("DotNetCliToolReference").Select(item => - new DotNetCliReferenceInfo(item.EvaluatedInclude, item.GetMetadataValue("Version"))); - } - } -} diff --git a/build/tasks/ProjectModel/SolutionInfo.cs b/build/tasks/ProjectModel/SolutionInfo.cs deleted file mode 100644 index cacc5213671c..000000000000 --- a/build/tasks/ProjectModel/SolutionInfo.cs +++ /dev/null @@ -1,44 +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; - -namespace RepoTasks.ProjectModel -{ - internal class SolutionInfo - { - public SolutionInfo(string fullPath, string configName, IReadOnlyList projects, bool shouldBuild, bool isPatching) - { - if (string.IsNullOrEmpty(fullPath)) - { - throw new ArgumentException(nameof(fullPath)); - } - - if (string.IsNullOrEmpty(configName)) - { - throw new ArgumentException(nameof(configName)); - } - - FullPath = fullPath; - Directory = Path.GetDirectoryName(fullPath); - ConfigName = configName; - Projects = projects ?? throw new ArgumentNullException(nameof(projects)); - ShouldBuild = shouldBuild; - IsPatching = isPatching; - foreach (var proj in Projects) - { - proj.SolutionInfo = this; - } - } - - public string FullPath { get; } - public string Directory { get; } - public string ConfigName { get; } - public IReadOnlyList Projects { get; } - public bool ShouldBuild { get; } - public bool IsPatching { get; } - public PatchPolicy PatchPolicy { get; set; } - } -} diff --git a/build/tasks/ProjectModel/SolutionInfoFactory.cs b/build/tasks/ProjectModel/SolutionInfoFactory.cs deleted file mode 100644 index aac69cff0894..000000000000 --- a/build/tasks/ProjectModel/SolutionInfoFactory.cs +++ /dev/null @@ -1,136 +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.Concurrent; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Build.Construction; -using Microsoft.Build.Evaluation; -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using RepoTasks.Utilities; - -namespace RepoTasks.ProjectModel -{ - internal class SolutionInfoFactory - { - private readonly TaskLoggingHelper _logger; - private readonly IBuildEngine4 _buildEngine; - - public SolutionInfoFactory(TaskLoggingHelper logger, IBuildEngine4 buildEngine) - { - _logger = logger; - _buildEngine = buildEngine; - } - - public IReadOnlyList Create(IEnumerable solutionItems, IDictionary properties, string defaultConfig, CancellationToken ct) - { - var timer = Stopwatch.StartNew(); - - var solutions = new ConcurrentBag(); - - Parallel.ForEach(solutionItems, solution => - { - if (ct.IsCancellationRequested) - { - return; - } - - var solutionFile = solution.ItemSpec.Replace('\\', '/'); - var solutionProps = new Dictionary(properties, StringComparer.OrdinalIgnoreCase); - foreach (var prop in MSBuildListSplitter.GetNamedProperties(solution.GetMetadata("AdditionalProperties"))) - { - solutionProps[prop.Key] = prop.Value; - } - - if (!solutionProps.TryGetValue("Configuration", out var configName)) - { - solutionProps["Configuration"] = configName = defaultConfig; - } - - var key = $"SlnInfo:{solutionFile}:{configName}"; - var obj = _buildEngine.GetRegisteredTaskObject(key, RegisteredTaskObjectLifetime.Build); - - if (obj is SolutionInfo cachedSlnInfo) - { - solutions.Add(cachedSlnInfo); - return; - } - - _logger.LogMessage($"Analyzing {solutionFile} ({configName})"); - var projects = new ConcurrentBag(); - var projectFiles = GetProjectsForSolutionConfig(solutionFile, configName); - using (var projCollection = new ProjectCollection(solutionProps) { IsBuildEnabled = false }) - { - Parallel.ForEach(projectFiles, projectFile => - { - if (ct.IsCancellationRequested) - { - return; - } - - try - { - projects.Add(new ProjectInfoFactory(_logger).Create(projectFile, projCollection)); - } - catch (Exception ex) - { - _logger.LogErrorFromException(ex); - } - }); - } - - bool.TryParse(solution.GetMetadata("Build"), out var shouldBuild); - bool.TryParse(solution.GetMetadata("IsPatching"), out var isPatching); - - var solutionInfo = new SolutionInfo( - solutionFile, - configName, - projects.ToArray(), - shouldBuild, - isPatching); - - _buildEngine.RegisterTaskObject(key, solutionInfo, RegisteredTaskObjectLifetime.Build, allowEarlyCollection: true); - - solutions.Add(solutionInfo); - }); - - timer.Stop(); - _logger.LogMessage(MessageImportance.High, $"Finished design-time build in {timer.ElapsedMilliseconds}ms"); - return solutions.ToArray(); - } - - private IList GetProjectsForSolutionConfig(string filePath, string configName) - { - var sln = SolutionFile.Parse(filePath); - - if (string.IsNullOrEmpty(configName)) - { - configName = sln.GetDefaultConfigurationName(); - } - - var projects = new List(); - - var config = sln.SolutionConfigurations.FirstOrDefault(c => c.ConfigurationName == configName); - if (config == null) - { - throw new InvalidOperationException($"A solution configuration by the name of '{configName}' was not found in '{filePath}'"); - } - - foreach (var project in sln.ProjectsInOrder - .Where(p => - p.ProjectType == SolutionProjectType.KnownToBeMSBuildFormat // skips solution folders - && p.ProjectConfigurations.TryGetValue(config.FullName, out var projectConfig) - && projectConfig.IncludeInBuild)) - { - projects.Add(project.AbsolutePath.Replace('\\', '/')); - } - - return projects; - } - } -} diff --git a/build/tasks/RepoTasks.csproj b/build/tasks/RepoTasks.csproj index 20cbf6cce8ff..7f7ee6f701db 100644 --- a/build/tasks/RepoTasks.csproj +++ b/build/tasks/RepoTasks.csproj @@ -2,14 +2,15 @@ - netcoreapp2.0 + netcoreapp2.0 + net461 - - + + diff --git a/build/tasks/Utilities/ArtifactInfo.cs b/build/tasks/Utilities/ArtifactInfo.cs deleted file mode 100644 index 7116daae487f..000000000000 --- a/build/tasks/Utilities/ArtifactInfo.cs +++ /dev/null @@ -1,70 +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.Linq; -using NuGet.Frameworks; -using NuGet.Packaging; -using NuGet.Packaging.Core; -using NuGet.Versioning; -using Microsoft.Build.Framework; -using RepoTasks.ProjectModel; - -namespace RepoTasks.Utilities -{ - internal abstract class ArtifactInfo - { - public static ArtifactInfo Parse(ITaskItem item) - { - ArtifactInfo info; - switch (item.GetMetadata("ArtifactType").ToLowerInvariant()) - { - case "nugetpackage": - info = new Package { PackageInfo = GetPackageInfo(item) }; - break; - case "nugetsymbolspackage": - info = new Package { PackageInfo = GetPackageInfo(item), IsSymbolsArtifact = true }; - break; - default: - return UnknownType.Singleton; - } - - info.RepositoryRoot = item.GetMetadata("RepositoryRoot")?.TrimEnd(new [] { '\\', '/' }); - - if (!string.IsNullOrEmpty(info.RepositoryRoot)) - { - info.RepoName = Path.GetFileName(info.RepositoryRoot); - } - - return info; - } - - public string RepositoryRoot { get; private set; } - public string RepoName { get; private set; } - - public class UnknownType : ArtifactInfo - { - private UnknownType() { } - public static UnknownType Singleton { get; } = new UnknownType(); - } - - public class Package : ArtifactInfo - { - public PackageInfo PackageInfo { get; set; } - public bool IsSymbolsArtifact { get; set; } - } - - private static PackageInfo GetPackageInfo(ITaskItem item) - { - return new PackageInfo( - item.GetMetadata("PackageId"), - NuGetVersion.Parse(item.GetMetadata("Version")), - string.IsNullOrEmpty(item.GetMetadata("TargetFramework")) - ? MSBuildListSplitter.SplitItemList(item.GetMetadata("TargetFramework")).Select(s => new PackageDependencyGroup(NuGetFramework.Parse(s), Array.Empty())).ToArray() - : new [] { new PackageDependencyGroup(NuGetFramework.Parse(item.GetMetadata("TargetFramework")), Array.Empty()) }, - Path.GetDirectoryName(item.ItemSpec), - item.GetMetadata("PackageType")); - } - } -} diff --git a/korebuild-lock.txt b/korebuild-lock.txt index d38b7a9c0e74..a3f63230bd6d 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.1.3-rtm-15847 -commithash:08641cb93aa5a9d52dc56c7516828b73aa448690 +version:2.1.3-rtm-15848 +commithash:2f914eafadb434837324c4b5b30f6fdbe9b70ab6 diff --git a/korebuild.json b/korebuild.json index 7e75ef053ad7..4a2fc587c37c 100644 --- a/korebuild.json +++ b/korebuild.json @@ -1,10 +1,24 @@ { "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/release/2.1/tools/korebuild.schema.json", "channel": "release/2.1", + "msbuildType": "full", "toolsets": { "nodejs": { "minVersion": "8.0", "required": true + }, + "visualstudio": { + "required": [ + "Windows" + ], + "includePrerelease": true, + "versionRange": "[15.8, 16.0)", + "requiredWorkloads": [ + "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81", + "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", + "Microsoft.VisualStudio.Component.VC.ATL", + "Microsoft.VisualStudio.Component.Windows10SDK.15063.Desktop" + ] } } } diff --git a/scripts/GenerateTags.ps1 b/scripts/GenerateTags.ps1 deleted file mode 100755 index f0866ffcab6d..000000000000 --- a/scripts/GenerateTags.ps1 +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env pwsh - -<# -.SYNOPSIS - Generates a tag on this repo and adds a tag for each submodule that corresponds - to the value in version.props -.PARAMETER Push - Push the tag to origin -.PARAMETER OutFile - When specified, generate a .csv with repo names and tags -.PARAMETER WhatIf - Dry run -#> -[cmdletbinding(PositionalBinding = $false, SupportsShouldProcess = $true)] -param( - [switch]$Push, - [string]$OutFile -) - -$ErrorActionPreference = 'Stop' -Import-Module -Scope Local -Force "$PSScriptRoot/common.psm1" -Set-StrictMode -Version 1 - -function New-GitTag { - [cmdletbinding(SupportsShouldProcess = $true)] - param( - [Parameter(Mandatory = $true)] - [string]$Repo, - [Parameter(Mandatory = $true)] - [string]$Tag - ) - - Push-Location $Repo - try { - git show-ref --tags --verify "refs/tags/$Tag" -q - $existingTag = $? - - if ($existingTag) { - Write-Warning "${Repo}: Tag '$Tag' already exists. Skipped adding tag" - } - else { - if ($PSCmdlet.ShouldProcess($Repo, "Tag $Tag")) { - Invoke-Block { & git tag -m "v$Tag" $Tag HEAD } - Write-Host -f Magenta "${Repo}: added tag '$Tag'" - } - - if ($Push -and $PSCmdlet.ShouldProcess($Repo, "Push tag $Tag to origin")) { - Invoke-Block { & git push origin refs/tags/$Tag } - } - } - } - finally { - Pop-Location - } -} - -# -# Gets the package version by invoking KoreBuild on a repo with a custom target that spits out the package version -# -function Get-PackageVersion([string]$repoRoot) { - $buildScript = if (-not $IsCoreCLR -or $IsWindows) { 'build.ps1' } else { 'build.sh' } - $inspectTarget = "/p:CustomAfterKoreBuildTargets=$PSScriptRoot/GetPackageVersion.targets" - Write-Verbose "Running `"$repoRoot/$buildScript`" $inspectTarget /v:m /p:IsFinalBuild=true /t:Noop /t:GetPackageVersion" - # Add the /t:Noop target which may be used by the bootstrapper to skip unimportant initialization - $output = & "$repoRoot/$buildScript" $inspectTarget /v:m /p:IsFinalBuild=true /t:Noop /t:GetPackageVersion - $output | out-string | Write-Verbose - if (-not $? -or $LASTEXITCODE -ne 0) { - throw "$buildScript failed on $repoRoot. Exit code $LASTEXITCODE" - } - $packageVersion = $output | where-object { $_ -like '*PackageVersion=*' } | select-object -first 1 - $packageVersion = $packageVersion -replace 'PackageVersion=', '' - if ($packageVersion) { $packageVersion = $packageVersion.Trim() } - if (-not $packageVersion) { - throw "Could not determine final package version for $repoRoot" - } - return $packageVersion.Trim() -} - -$repoRoot = Resolve-Path "$PSScriptRoot/../" - -Write-Warning "Make sure you have run ``git submodule update`` first to pin the submodules to the correct commit" -if (-not $PSCmdlet.ShouldContinue("Continue?", "This will apply tags to all submodules")) { - Write-Host "Exiting" - exit 1 -} - - -$repoTag = Get-PackageVersion $repoRoot -New-GitTag $repoRoot $repoTag -WhatIf:$WhatIfPreference - -$tags = @([pscustomobject] @{ - repo = $(git config remote.origin.url) - tag = $repoTag - commit = $(git rev-parse HEAD) - }) - -Get-Submodules $repoRoot | ForEach-Object { - $modPath = $_.path - $module = $_.module - if (-not (Test-Path (Join-Path $_.path 'version.props'))) { - Write-Warning "$module does not have a version.props file. Skipping" - return - } - - try { - $tag = Get-PackageVersion $_.path - if ($tag -ne $repoTag) { - Write-Warning "${module}: version ($tag) does not match repo ($repoTag)" - } - $tags += [pscustomobject] @{ - repo = $_.remote - tag = $tag - commit = $_.commit - } - } - catch { - Write-Warning "${module}: Could not automatically determine tag for $modPath. Skipping" - return - } - - New-GitTag $_.path $tag -WhatIf:$WhatIfPreference -} - -$tags | Format-Table - -if ($OutFile) { - $tags | Select-Object -Property * | Export-Csv -Path $OutFile -WhatIf:$false -NoTypeInformation -} diff --git a/scripts/GetPackageVersion.targets b/scripts/GetPackageVersion.targets deleted file mode 100644 index 061c1140275b..000000000000 --- a/scripts/GetPackageVersion.targets +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/scripts/ListRepoVersions.ps1 b/scripts/ListRepoVersions.ps1 deleted file mode 100644 index 06ba39916684..000000000000 --- a/scripts/ListRepoVersions.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env pwsh - -<# -.SYNOPSIS - Lists the version of all submodules and this repo -.PARAMETER Shipping - Only list repos that are shipping -#> -[cmdletbinding(SupportsShouldProcess = $true)] -param( - [switch]$Shipping = $false -) - -Set-StrictMode -Version 2 -$ErrorActionPreference = 'Stop' - -Import-Module -Scope Local -Force "$PSScriptRoot/common.psm1" - -Assert-Git - -$RepoRoot = Resolve-Path "$PSScriptRoot/../" - -Get-Submodules $RepoRoot -Shipping:$Shipping | Format-Table -Property 'module','versionPrefix' diff --git a/scripts/PatchVersionPrefix.ps1 b/scripts/PatchVersionPrefix.ps1 deleted file mode 100755 index d8cce864876e..000000000000 --- a/scripts/PatchVersionPrefix.ps1 +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env pwsh -c - -<# -.SYNOPSIS - Updates the version.props file in repos to a newer patch version -.PARAMETER Repos - A list of the repositories that should be patched -.PARAMETER Mode - Version bump options: Major, Minor, Patch -.PARAMETER VersionSuffix - The version suffix to use -#> -[cmdletbinding(SupportsShouldProcess = $true)] -param( - [Parameter(Mandatory = $true)] - [string[]]$Repos, - [Parameter(Mandatory = $true)] - [ValidateSet('Major', 'Minor', 'Patch')] - [string]$Mode, - [string]$VersionSuffix = $null, - [switch]$NoCommit -) - -$ErrorActionPreference = 'Stop' - -Import-Module -Scope Local -Force "$PSScriptRoot/common.psm1" - -function SetVersionSuffix([System.Xml.XmlNode]$node) { - if (-not $node) { - return - } - $node.InnerText = $VersionSuffix - return "Setting $($node.Name) to $VersionSuffix" -} - -function BumpVersion([System.Xml.XmlNode]$node) { - if (-not $node) { - return - } - [version] $version = $node.InnerText - - $experimental = $version.Major -eq 0 - - switch ($mode) { - { ($_ -ne 'Patch') -and $experimental} { - $node.InnerText = "{0}.{1}.{2}" -f $version.Major, ($version.Minor + 1), 0 - } - { ($_ -eq 'Major') -and -not $experimental } { - $node.InnerText = "{0}.{1}.{2}" -f ($version.Major + 1), 0, 0 - } - { ($_ -eq 'Minor') -and -not $experimental } { - $node.InnerText = "{0}.{1}.{2}" -f $version.Major, ($version.Minor + 1), 0 - } - 'Patch' { - $node.InnerText = "{0}.{1}.{2}" -f $version.Major, $version.Minor, ($version.Build + 1) - } - default { - throw "Could not figure out how to apply patch policy $mode" - } - } - return "Bumping version from $version to $($node.InnerText)" -} - -foreach ($repo in $Repos) { - $repoPath = "$PSScriptRoot/../modules/$repo" - Push-Location $repoPath - try - { - $path = "$repoPath/version.props" - Write-Host -ForegroundColor Magenta "Updating $repo" - if (-not (Test-Path $path)) { - Write-Warning "$path does not exist" - continue - } - $path = Resolve-Path $path - Write-Verbose "$path" - [xml] $xml = LoadXml $path - - $suffix = $xml.SelectSingleNode('/Project/PropertyGroup/VersionSuffix') - if (-not $suffix) { - write-error "$path does not have VersionSuffix" - } - - if ($VersionSuffix) { - SetVersionSuffix $xml.SelectSingleNode('/Project/PropertyGroup/VersionSuffix') | write-host - SetVersionSuffix $xml.SelectSingleNode('/Project/PropertyGroup/ExperimentalProjectVersionSuffix') | write-host - SetVersionSuffix $xml.SelectSingleNode('/Project/PropertyGroup/ExperimentalVersionSuffix') | write-host - } - - $versionPrefix = $xml.SelectSingleNode('/Project/PropertyGroup/VersionPrefix') - $epxVersionPrefix = $xml.SelectSingleNode('/Project/PropertyGroup/ExperimentalProjectVersionPrefix') - $exVersionPrefix = $xml.SelectSingleNode('/Project/PropertyGroup/ExperimentalVersionPrefix') - BumpVersion $epxVersionPrefix | write-host - BumpVersion $exVersionPrefix | write-host - $message = BumpVersion $versionPrefix - Write-Host $message - - if ($PSCmdlet.ShouldProcess("Update $path")) { - SaveXml $xml $path - if (-not $NoCommit) { - Invoke-Block { & git add $path } - Invoke-Block { & git commit -m $message } - } - } - } - finally - { - Pop-Location - } -} - diff --git a/scripts/TagRepos.ps1 b/scripts/TagRepos.ps1 deleted file mode 100644 index 2bb595027c6b..000000000000 --- a/scripts/TagRepos.ps1 +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env pwsh - -<# -.SYNOPSIS - Tags each repo according to VersionPrefix in version.props of that repo -.PARAMETER Push - Push all updated tags -.PARAMETER ForceUpdateTag - This will call git tag --force -#> -[cmdletbinding(SupportsShouldProcess = $true)] -param( - [switch]$Push = $false, - [switch]$ForceUpdateTag = $false -) - -Set-StrictMode -Version 2 -$ErrorActionPreference = 'Stop' - -Import-Module -Scope Local -Force "$PSScriptRoot/common.psm1" - -Assert-Git - -$RepoRoot = Resolve-Path "$PSScriptRoot/../" - -Get-Submodules $RepoRoot -Shipping | % { - Push-Location $_.path | Out-Null - try { - - if (-not $_.versionPrefix) { - Write-Warning "Could not determine tag version for $(_.path)" - } - else { - $tag = $_.versionPrefix - Write-Host "$($_.module) => $tag" - - $gitTagArgs = @() - if ($ForceUpdateTag) { - $gitTagArgs += '--force' - } - - Invoke-Block { & git tag @gitTagArgs $tag } - - if ($Push) { - $gitPushArgs = @() - if ($WhatIfPreference) { - $gitPushArgs += '--dry-run' - } - Invoke-Block { & git push @gitPushArgs origin "refs/tags/${tag}" } - } - - if ($WhatIfPreference) { - Invoke-Block { & git tag -d $tag } | Out-Null - } - } - } - catch { - Write-Host -ForegroundColor Red "Could not update $_" - throw - } - finally { - Pop-Location - } -} - - diff --git a/scripts/UpdateDependenciesCoreFx.ps1 b/scripts/UpdateDependenciesCoreFx.ps1 deleted file mode 100644 index 3a4e2b9903c9..000000000000 --- a/scripts/UpdateDependenciesCoreFx.ps1 +++ /dev/null @@ -1,134 +0,0 @@ - -[CmdletBinding()] -param( - [switch]$NoCommit, - [string]$GithubEmail, - [string]$GithubUsername, - [string]$GithubToken -) -# This script only works against dev/master at the moment because only master prod-con builds allow you to access their results before the entire chain is finished. - -$ErrorActionPreference = 'Stop' -Import-Module -Scope Local -Force "$PSScriptRoot/common.psm1" -Set-StrictMode -Version 1 -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - -$githubRaw = "https://raw.githubusercontent.com" -$versionsRepo = "dotnet/versions" -$versionsBranch = "master" - -$coreSetupRepo = "dotnet/core-setup" -$coreFxRepo = "dotnet/corefx" - -$coreSetupVersions = "$githubRaw/$versionsRepo/$versionsBranch/build-info/$coreSetupRepo/master/Latest_Packages.txt" - -$tempDir = "$PSScriptRoot/../obj" - -mkdir -Path $tempDir -ErrorAction Ignore - -$localCoreSetupVersions = "$tempDir/coresetup.packages" -Write-Host "Downloading $coreSetupVersions to $localCoreSetupVersions" -Invoke-WebRequest -OutFile $localCoreSetupVersions -Uri $coreSetupVersions - -$msNetCoreAppPackageVersion = $null -$msNetCoreAppPackageName = "Microsoft.NETCore.App" - -Set-GitHubInfo $GithubToken $GithubUsername $GithubEmail - -$variables = @{} - -foreach ($line in Get-Content $localCoreSetupVersions) { - if ($line.StartsWith("$msNetCoreAppPackageName ")) { - $msNetCoreAppPackageVersion = $line.Trim("$msNetCoreAppPackageName ") - } - $parts = $line.Split(' ') - $packageName = $parts[0] - - $varName = "$packageName" + "PackageVersion" - $varName = $varName.Replace('.', '') - - $packageVersion = $parts[1] - if ($variables[$varName]) { - if ($variables[$varName].Where( {$_ -eq $packageVersion}, 'First').Count -eq 0) { - $variables[$varName] += $packageVersion - } - } - else { - $variables[$varName] = @($packageVersion) - } -} - -if (!$msNetCoreAppPackageVersion) { - Throw "$msNetCoreAppPackageName was not in $coreSetupVersions" -} - -$coreAppDownloadLink = "https://dotnet.myget.org/F/dotnet-core/api/v2/package/$msNetCoreAppPackageName/$msNetCoreAppPackageVersion" -$netCoreAppNupkg = "$tempDir/microsoft.netcore.app.zip" -Invoke-WebRequest -OutFile $netCoreAppNupkg -Uri $coreAppDownloadLink -$expandedNetCoreApp = "$tempDir/microsoft.netcore.app/" -Expand-Archive -Path $netCoreAppNupkg -DestinationPath $expandedNetCoreApp -Force -$versionsTxt = "$expandedNetCoreApp/$msNetCoreAppPackageName.versions.txt" - -$versionsCoreFxCommit = $null -foreach ($line in Get-Content $versionsTxt) { - if ($line.StartsWith("dotnet/versions/corefx")) { - $versionsCoreFxCommit = $line.Split(' ')[1] - break - } -} - -if (!$versionsCoreFxCommit) { - Throw "no 'dotnet/versions/corefx' in versions.txt of Microsoft.NETCore.App" -} - -$coreFxVersionsUrl = "$githubRaw/$versionsRepo/$versionsCoreFxCommit/build-info/$coreFxRepo/$versionsBranch/Latest_Packages.txt" -$localCoreFxVersions = "$tempDir/$corefx.packages" -Invoke-WebRequest -OutFile $localCoreFxVersions -Uri $coreFxVersionsUrl - -foreach ($line in Get-Content $localCoreFxVersions) { - $parts = $line.Split(' ') - - $packageName = $parts[0] - - $varName = "$packageName" + "PackageVersion" - $varName = $varName.Replace('.', '') - $packageVersion = $parts[1] - if ($variables[$varName]) { - if ($variables[$varName].Where( {$_ -eq $packageVersion}, 'First').Count -eq 0) { - $variables[$varName] += $packageVersion - } - } - else { - $variables[$varName] = @($packageVersion) - } -} - -$depsPath = Resolve-Path "$PSScriptRoot/../build/dependencies.props" -Write-Host "Loading deps from $depsPath" -[xml] $dependencies = LoadXml $depsPath - -if (-not $NoCommit) { - $baseBranch = "release/2.1" - Invoke-Block { & git fetch origin } - - $currentBranch = Invoke-Block { & git rev-parse --abbrev-ref HEAD } - $destinationBranch = "dotnetbot/UpdateCoreFxDeps" - - Invoke-Block { & git checkout -tb $destinationBranch "origin/$baseBranch" } -} - -try { - $updatedVars = UpdateVersions $variables $dependencies $depsPath - if (-not $NoCommit) { - $body = CommitUpdatedVersions $updatedVars $dependencies $depsPath - - if ($body) { - CreatePR "aspnet" $GithubUsername $baseBranch $destinationBranch $body $GithubToken - } - } -} -finally { - if (-not $NoCommit) { - Invoke-Block { & git checkout $currentBranch } - } -} diff --git a/scripts/UpdateRepos.ps1 b/scripts/UpdateRepos.ps1 deleted file mode 100755 index d45002e144ef..000000000000 --- a/scripts/UpdateRepos.ps1 +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env pwsh - -<# -.SYNOPSIS - Updates each submodule this repo builds to new dependencies.props. -.PARAMETER Source - The NuGet package source to find the lineup on. -.PARAMETER LineupID - The ID of the Lineup to determine which versions to use. -.PARAMETER LineupVersion - The version of the Lineup to be used. -.PARAMETER NoPush - Make commits without pusing. -.PARAMETER GitAuthorName - The author name to use in the commit message. (Optional) -.PARAMETER GitAuthorEmail - The author email to use in the commit message. (Optional) -.PARAMETER Force - Specified this to push commits without prompting. -.PARAMETER GitCommitArgs - Any remaining arguments are passed as arguments to 'git commit' actions in each repo. -#> -[cmdletbinding(SupportsShouldProcess = $true)] -param( - [Parameter(Mandatory = $true)] - [string]$Source, - [Parameter(Mandatory = $true)] - [string]$LineupID, - [Parameter(Mandatory = $true)] - [string]$LineupVersion, - [switch]$NoPush, - [string]$GitAuthorName = $null, - [string]$GitAuthorEmail = $null, - [switch]$Force, - [string[]]$GitCommitArgs = @() -) - -$ErrorActionPreference = 'Stop' -Set-StrictMode -Version 2 - -Import-Module "$PSScriptRoot/common.psm1" -Scope Local -Force - -$RepoRoot = Resolve-Path "$PSScriptRoot\.." -$ModuleDirectory = Join-Path $RepoRoot "modules" - -$gitConfigArgs = @() -if ($GitAuthorName) { - $gitConfigArgs += '-c', "user.name=$GitAuthorName" -} - -if ($GitAuthorEmail) { - $gitConfigArgs += '-c', "user.email=$GitAuthorEmail" -} - -Push-Location $ModuleDirectory -try { - - $build_errors = @() - $submodules = Get-Submodules $RepoRoot - foreach ($submodule in $submodules) { - Push-Location $submodule.path - try { - Invoke-Block { & git fetch } - Invoke-Block { & git checkout origin/$($submodule.branch) } - $depsFile = Join-Path (Join-Path $($submodule.path) "build") "dependencies.props" - - if (!(Test-Path $depsFile)) { - Write-Warning "No build\dependencies.props file exists for '$($submodule.module)'." - continue - } - - $koreBuildLock = "korebuild-lock.txt" - - $repoKoreBuildLock = (Join-Path $RepoRoot $koreBuildLock) - $submoduleKoreBuildLock = (Join-Path $submodule.path $koreBuildLock) - - Copy-Item $repoKoreBuildLock $submoduleKoreBuildLock -Force - - Write-Verbose "About to update dependencies.props for $($submodule.module)" - & .\run.ps1 upgrade deps --source $Source --id $LineupID --version $LineupVersion --deps-file $depsFile - - Invoke-Block { & git @gitConfigArgs add $depsFile $koreBuildLock } - - # If there were any changes test and push. - & git diff --cached --quiet ./ - if ($LASTEXITCODE -ne 0) { - Invoke-Block { & git @gitConfigArgs commit --quiet -m "Update dependencies.props`n`n[auto-updated: dependencies]" @GitCommitArgs } - - # Prepare this submodule for push - $sshUrl = "git@github.com:aspnet/$($submodule.module)" - Invoke-Block { & git remote set-url --push origin $sshUrl } - - # Test the submodule - try { - Invoke-Block { & .\run.ps1 default-build /p:SkipTests=true } - } - catch { - Write-Warning "Error in $($submodule.module): $_" - $build_errors += @{ - Repo = $submodule.module - Message = $_ - } - continue - } - - # Push the changes - if (-not $NoPush -and ($Force -or ($PSCmdlet.ShouldContinue("Pushing updates to repos.", 'Push the changes to these repos?')))) { - try { - Invoke-Block { & git @gitConfigArgs push origin HEAD:$($submodule.branch)} - } - catch { - Write-Warning "Error in pushing $($submodule.module): $_" - $build_errors += @{ - Repo = $submodule.module - Message = $_ - } - continue - } - } - } - else { - Write-Host "No changes in $($submodule.module)" - } - } - catch { - Write-Warning "Error in $($submodule.module): $_" - $build_errors += @{ - Repo = $submodule.module - Message = $_ - } - } - finally { - Pop-Location - } - } - - if ($build_errors.Count -gt 0 ) { - Write-Warning "The following repos failed:" - foreach ($error in $build_errors) { - Write-Warning " - $($error.Repo)" - } - throw "Failed to build" - } -} -finally { - Pop-Location -} diff --git a/scripts/requirements.txt b/scripts/requirements.txt deleted file mode 100644 index a550da3e6492..000000000000 --- a/scripts/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -PyYAML==3.12 -termcolor==1.1.0 diff --git a/scripts/update_travis_appveyor_yml.py b/scripts/update_travis_appveyor_yml.py deleted file mode 100755 index e77bcc25c3d1..000000000000 --- a/scripts/update_travis_appveyor_yml.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python3 - -import collections -import glob -import yaml -from os import path -from termcolor import colored, cprint -from yaml.constructor import Constructor - -def dump_format(dump, tag, mapping, flow_style=None): - """ - Better output formatting for YAML dictionaries - """ - value = [] - node = yaml.MappingNode(tag, value, flow_style=flow_style) - if dump.alias_key is not None: - dump.represented_objects[dump.alias_key] = node - best_style = True - if hasattr(mapping, 'items'): - mapping = mapping.items() - for item_key, item_value in mapping: - node_key = dump.represent_data(item_key) - node_value = dump.represent_data(item_value) - if not (isinstance(node_key, yaml.ScalarNode) and not node_key.style): - best_style = False - if not (isinstance(node_value, yaml.ScalarNode) and not node_value.style): - best_style = False - value.append((node_key, node_value)) - if flow_style is None: - if dump.default_flow_style is not None: - node.flow_style = dump.default_flow_style - else: - node.flow_style = best_style - return node - - -def add_bool_as_scalar(self, node): - """ - Don't auto-parse boolean values - """ - if node.value == 'true' or node.value == 'false' : - return self.construct_yaml_bool(node) - return self.construct_scalar(node) - -_mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG - -def dict_representer(dumper, data): - return dumper.represent_mapping(_mapping_tag, data.iteritems()) - - -def dict_constructor(loader, node): - return collections.OrderedDict(loader.construct_pairs(node)) - -def update(pattern, updater): - print('\n\n\n') - cprint(pattern, 'magenta') - - for f in glob.glob(path.join(repo_root, "modules", "*", pattern)): - yml = path.join(repo_root, f) - - if not path.exists(yml): - cprint("File does not exist: {}".format(yml), 'red') - continue - - print("Updating {}".format(yml)) - document = yaml.load(open(yml, 'r')) - document = updater(document) - yml_file = open(yml, 'w') - yml_file.write(yaml.safe_dump(document, default_flow_style=False, indent=2)) - yml_file.close() - -# -# Config yaml parser -# - -# Do not reorder keys in yaml file -yaml.add_representer(collections.OrderedDict, dict_representer) -yaml.add_constructor(_mapping_tag, dict_constructor) -# Pretty print dictionaries -yaml.SafeDumper.add_representer(collections.OrderedDict, - lambda dumper, value: dump_format(dumper, u'tag:yaml.org,2002:map', value)) -# Don't parse booleans - treat them as scalars -yaml.Loader.add_constructor(u'tag:yaml.org,2002:bool', add_bool_as_scalar) -yaml.SafeLoader.add_constructor(u'tag:yaml.org,2002:bool', add_bool_as_scalar) - -# -# Main -# - -repo_root = path.dirname(path.dirname(path.abspath(__file__))) - -def transform_yaml_doc(document): - if not 'branches' in document: - document['branches'] = {} - document['branches']['only'] = [ - 'dev', '/^release\/.*$/', '/^(.*\/)?ci-.*$/'] - return document - -update(".travis.yml", transform_yaml_doc) -update(".appveyor.yml", transform_yaml_doc) diff --git a/src/AADIntegration/build/repo.props b/src/AADIntegration/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/AADIntegration/build/repo.props +++ b/src/AADIntegration/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/Antiforgery/build/repo.props b/src/Antiforgery/build/repo.props index 6c9c88ab01ba..1dc8b8100d75 100644 --- a/src/Antiforgery/build/repo.props +++ b/src/Antiforgery/build/repo.props @@ -1,12 +1,6 @@ - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/AuthSamples/build/repo.props b/src/AuthSamples/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/AuthSamples/build/repo.props +++ b/src/AuthSamples/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/AzureIntegration/build/repo.props b/src/AzureIntegration/build/repo.props index 9c56de94ffad..556970f5b29a 100644 --- a/src/AzureIntegration/build/repo.props +++ b/src/AzureIntegration/build/repo.props @@ -5,11 +5,6 @@ Microsoft $(RepositoryRoot)test\Microsoft.AspNetCore.AzureAppServices.FunctionalTests\Microsoft.AspNetCore.AzureAppServices.FunctionalTests.csproj - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json diff --git a/src/CORS/build/repo.props b/src/CORS/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/CORS/build/repo.props +++ b/src/CORS/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/IISIntegration/build/repo.props b/src/IISIntegration/build/repo.props index c3e3c1c2275b..780afe4e43b3 100644 --- a/src/IISIntegration/build/repo.props +++ b/src/IISIntegration/build/repo.props @@ -16,13 +16,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/Identity/build/repo.props b/src/Identity/build/repo.props index b4c0d5f738f8..07b7cc25b04e 100644 --- a/src/Identity/build/repo.props +++ b/src/Identity/build/repo.props @@ -5,12 +5,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - diff --git a/src/JavaScriptServices/build/repo.props b/src/JavaScriptServices/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/JavaScriptServices/build/repo.props +++ b/src/JavaScriptServices/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/MetaPackages/build/repo.props b/src/MetaPackages/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/MetaPackages/build/repo.props +++ b/src/MetaPackages/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/MusicStore/build/repo.props b/src/MusicStore/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/MusicStore/build/repo.props +++ b/src/MusicStore/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/Mvc/build/repo.props b/src/Mvc/build/repo.props index 53e1be33f03d..d672599d6ade 100644 --- a/src/Mvc/build/repo.props +++ b/src/Mvc/build/repo.props @@ -10,12 +10,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - diff --git a/src/MvcPrecompilation/build/repo.props b/src/MvcPrecompilation/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/MvcPrecompilation/build/repo.props +++ b/src/MvcPrecompilation/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/PackageArchive/Directory.Build.props b/src/PackageArchive/Directory.Build.props index 3a70818a8df3..f1b37df068ee 100644 --- a/src/PackageArchive/Directory.Build.props +++ b/src/PackageArchive/Directory.Build.props @@ -1,6 +1,9 @@ - + + + + true diff --git a/src/Razor/build/VSIX.targets b/src/Razor/build/VSIX.targets index febfc39d48b3..09b73d8b8912 100644 --- a/src/Razor/build/VSIX.targets +++ b/src/Razor/build/VSIX.targets @@ -1,6 +1,6 @@  - true + false $(RestoreDependsOn);RestoreVSIX $(PackageDependsOn);PackageVSIX $(GetArtifactInfoDependsOn);GetVSIXArtifactInfo @@ -18,7 +18,7 @@ Condition="'$(OS)'=='Windows_NT'" /> - + diff --git a/src/Razor/build/repo.props b/src/Razor/build/repo.props index ec177662e45b..82355a1443f5 100644 --- a/src/Razor/build/repo.props +++ b/src/Razor/build/repo.props @@ -18,13 +18,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/ResponseCaching/build/repo.props b/src/ResponseCaching/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/ResponseCaching/build/repo.props +++ b/src/ResponseCaching/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/Routing/build/repo.props b/src/Routing/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/Routing/build/repo.props +++ b/src/Routing/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/Security/build/repo.props b/src/Security/build/repo.props index a4f86fb2f689..2ae30982a62f 100644 --- a/src/Security/build/repo.props +++ b/src/Security/build/repo.props @@ -4,12 +4,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - diff --git a/src/ServerTests/build/repo.props b/src/ServerTests/build/repo.props index c8bd413e1ed8..96c127058569 100644 --- a/src/ServerTests/build/repo.props +++ b/src/ServerTests/build/repo.props @@ -4,12 +4,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - diff --git a/src/Session/build/repo.props b/src/Session/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/Session/build/repo.props +++ b/src/Session/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/SignalR/build/repo.props b/src/SignalR/build/repo.props index 38e1626110d7..f00e5ccca051 100644 --- a/src/SignalR/build/repo.props +++ b/src/SignalR/build/repo.props @@ -12,12 +12,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - diff --git a/src/SignalR/clients/ts/common/package-lock.json b/src/SignalR/clients/ts/common/package-lock.json index baf3d32bb783..3ec871bf5e2f 100644 --- a/src/SignalR/clients/ts/common/package-lock.json +++ b/src/SignalR/clients/ts/common/package-lock.json @@ -2656,12 +2656,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2676,17 +2678,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -2803,7 +2808,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -2815,6 +2821,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -2829,6 +2836,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -2836,12 +2844,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -2860,6 +2870,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -2940,7 +2951,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -2952,6 +2964,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3073,6 +3086,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", diff --git a/src/SignalR/clients/ts/signalr-protocol-msgpack/package-lock.json b/src/SignalR/clients/ts/signalr-protocol-msgpack/package-lock.json index 74b1c0b8eb8c..366fdca0d521 100644 --- a/src/SignalR/clients/ts/signalr-protocol-msgpack/package-lock.json +++ b/src/SignalR/clients/ts/signalr-protocol-msgpack/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aspnet/signalr-protocol-msgpack", - "version": "1.0.3-rtm-t000", + "version": "1.0.4-rtm-t000", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/SignalR/clients/ts/signalr/package-lock.json b/src/SignalR/clients/ts/signalr/package-lock.json index 4782133c47cb..8c2bfa71f143 100644 --- a/src/SignalR/clients/ts/signalr/package-lock.json +++ b/src/SignalR/clients/ts/signalr/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aspnet/signalr", - "version": "1.0.3-rtm-t000", + "version": "1.0.4-rtm-t000", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/StaticFiles/build/repo.props b/src/StaticFiles/build/repo.props index dab1601c8832..1dc8b8100d75 100644 --- a/src/StaticFiles/build/repo.props +++ b/src/StaticFiles/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - 2.1.0-rc1-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - - diff --git a/src/Templating/build/repo.props b/src/Templating/build/repo.props index 8bc3037a4c10..c7f773eebc81 100644 --- a/src/Templating/build/repo.props +++ b/src/Templating/build/repo.props @@ -1,13 +1,6 @@ - - - Internal.AspNetCore.Universe.Lineup - $(VersionPrefix)-* - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json - -