From 20a4ffcc9693d014a021f74bf68a3df816c543d3 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 15 Nov 2018 19:39:41 -0800 Subject: [PATCH 1/3] Flatten the nuget dependency graph of Microsoft.AspNetCore.App * Implements RID-split packages for Microsoft.AspNetCore.App * Remove all nuspec dependencies of Microsoft.AspNetCore.App and collect all references into the package * Update shared fx deps.json generation to only include entries for the RID-specific metapackages * Include platform-specific packages in publish output --- Directory.Build.props | 1 - Directory.Build.targets | 1 - build/Publish.targets | 7 +- build/SharedFx.targets | 2 +- build/artifacts.props | 2 +- build/dependencies.props | 2 +- build/tasks/ProcessSharedFrameworkDeps.cs | 115 ++++++++++-------- build/tasks/RepoTasks.tasks | 1 - build/tasks/ResolveVersionRange.cs | 68 ----------- build/tasks/Utilities/RuntimeGraphManager.cs | 3 +- build/tasks/Utilities/RuntimeReference.cs | 86 ------------- eng/targets/SharedFx.Common.props | 36 ------ src/Framework/Directory.Build.props | 20 --- src/Framework/Directory.Build.targets | 29 ----- src/Framework/Metapackage.targets | 51 -------- .../Microsoft.AspNetCore.App.props | 2 +- .../pkg/Microsoft.AspNetCore.App.pkgproj | 26 ---- .../Microsoft.AspNetCore.App.props | 21 ---- .../Microsoft.AspNetCore.App.targets | 18 --- .../src/Microsoft.AspNetCore.App.shfxproj | 20 --- src/Framework/pkg/Metapackage.targets | 72 +++++++++++ .../pkg/Microsoft.AspNetCore.App.pkgproj | 30 +++++ .../pkg/Microsoft.AspNetCore.App.targets | 7 ++ .../pkg/lib/netcoreapp3.0 => pkg}/_._ | 0 .../src/Microsoft.AspNetCore.App.shfxproj | 64 ++++++++++ .../Framework/src/SharedFx.targets | 50 +++++--- src/Framework/{ => src}/_._ | 0 src/Framework/{ => src}/runtime.fx.nuspec | 0 .../{Framework.UnitTests => test}/AssertEx.cs | 0 ...Microsoft.AspNetCore.App.UnitTests.csproj} | 2 +- .../SharedFxTests.cs | 39 +++++- .../{Framework.UnitTests => test}/TestData.cs | 0 .../TestDataAttribute.cs | 0 .../Archive/Archive.Internal.zipproj | 2 +- src/Installers/Archive/Archive.Redist.zipproj | 2 +- src/Installers/Debian/Runtime.debproj | 2 +- src/Installers/Rpm/Rpm.props | 2 +- .../lib/netcoreapp3.0/_._ | 0 .../lib/netcoreapp3.0/_._ | 0 39 files changed, 317 insertions(+), 466 deletions(-) delete mode 100644 build/tasks/ResolveVersionRange.cs delete mode 100644 build/tasks/Utilities/RuntimeReference.cs delete mode 100644 eng/targets/SharedFx.Common.props delete mode 100644 src/Framework/Directory.Build.targets delete mode 100644 src/Framework/Metapackage.targets rename src/Framework/{Microsoft.AspNetCore.App => }/Microsoft.AspNetCore.App.props (99%) delete mode 100644 src/Framework/Microsoft.AspNetCore.App/pkg/Microsoft.AspNetCore.App.pkgproj delete mode 100644 src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp3.0/Microsoft.AspNetCore.App.props delete mode 100644 src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp3.0/Microsoft.AspNetCore.App.targets delete mode 100644 src/Framework/Microsoft.AspNetCore.App/src/Microsoft.AspNetCore.App.shfxproj create mode 100644 src/Framework/pkg/Metapackage.targets create mode 100644 src/Framework/pkg/Microsoft.AspNetCore.App.pkgproj create mode 100644 src/Framework/pkg/Microsoft.AspNetCore.App.targets rename src/Framework/{Microsoft.AspNetCore.App/pkg/lib/netcoreapp3.0 => pkg}/_._ (100%) create mode 100644 src/Framework/src/Microsoft.AspNetCore.App.shfxproj rename eng/targets/SharedFx.Common.targets => src/Framework/src/SharedFx.targets (92%) rename src/Framework/{ => src}/_._ (100%) rename src/Framework/{ => src}/runtime.fx.nuspec (100%) rename src/Framework/{Framework.UnitTests => test}/AssertEx.cs (100%) rename src/Framework/{Framework.UnitTests/Framework.UnitTests.csproj => test/Microsoft.AspNetCore.App.UnitTests.csproj} (96%) rename src/Framework/{Framework.UnitTests => test}/SharedFxTests.cs (58%) rename src/Framework/{Framework.UnitTests => test}/TestData.cs (100%) rename src/Framework/{Framework.UnitTests => test}/TestDataAttribute.cs (100%) delete mode 100644 src/Packages/Microsoft.AspNetCore.All/lib/netcoreapp3.0/_._ delete mode 100644 src/Packages/Microsoft.AspNetCore.App/lib/netcoreapp3.0/_._ diff --git a/Directory.Build.props b/Directory.Build.props index b121675096d3..7d929489f51d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -97,7 +97,6 @@ - diff --git a/Directory.Build.targets b/Directory.Build.targets index 41ac8e2d2c80..60f510d3413f 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -54,6 +54,5 @@ - diff --git a/build/Publish.targets b/build/Publish.targets index 0795f9397e57..0b9c69a45252 100644 --- a/build/Publish.targets +++ b/build/Publish.targets @@ -58,7 +58,7 @@ Value="$(PackageVersion)" /> - + aspnetcore/Runtime/$(PackageVersion)/ aspnetcore/npm/ @@ -175,6 +175,11 @@ + + <_RidSpecificPackages Include="$(SupportedRuntimeIdentifiers)" Exclude="$(SharedFxRid)" /> + + + diff --git a/build/SharedFx.targets b/build/SharedFx.targets index f172eb93507a..3ee7a60b28df 100644 --- a/build/SharedFx.targets +++ b/build/SharedFx.targets @@ -1,6 +1,6 @@ - $(RepositoryRoot)src\Framework\Framework.UnitTests\Framework.UnitTests.csproj + $(RepositoryRoot)src\Framework\test\Microsoft.AspNetCore.App.UnitTests.csproj $([MSBuild]::NormalizePath($(UnitTestFxProject))) $(CodeSignDependsOn);GetSharedFxFilesToSign _BuildSharedFxProjects;TestSharedFx diff --git a/build/artifacts.props b/build/artifacts.props index 74cf76509ee8..0a22cdebd486 100644 --- a/build/artifacts.props +++ b/build/artifacts.props @@ -23,7 +23,7 @@ - + diff --git a/build/dependencies.props b/build/dependencies.props index e3c4a0b9ca49..17b2d0d75a49 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -142,7 +142,7 @@ 4.2.1 2.2.0-preview1-03124-01 - 2.0.0 + 2.1.0 8.7.0 4.2.1 2.3.0-preview1-update2 diff --git a/build/tasks/ProcessSharedFrameworkDeps.cs b/build/tasks/ProcessSharedFrameworkDeps.cs index 49189544f3a9..97afbd47344c 100644 --- a/build/tasks/ProcessSharedFrameworkDeps.cs +++ b/build/tasks/ProcessSharedFrameworkDeps.cs @@ -1,12 +1,10 @@ // 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. -// Sourced from https://github.com/dotnet/core-setup/tree/be8d8e3486b2bf598ed69d39b1629a24caaba45e/tools-local/tasks, needs to be kept in sync using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Security.Cryptography; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Microsoft.Extensions.DependencyModel; @@ -28,21 +26,22 @@ public class ProcessSharedFrameworkDeps : Task public string OutputPath { get; set; } [Required] - public string FrameworkName { get; set; } + public string TargetFramework { get; set; } - // When generating the .deps.json file, these files are used to replace "project" libraries with "packages". - public ITaskItem[] ResolvedPackageProjectReferences { get; set; } + [Required] + public string FrameworkName { get; set; } - public string[] PackagesToRemove { get; set; } + [Required] + public string FrameworkVersion { get; set; } [Required] - public string Runtime { get; set; } + public string BaseRuntimeIdentifier { get; set; } public override bool Execute() { ExecuteCore(); - return true; + return !Log.HasLoggedErrors; } private void ExecuteCore() @@ -61,23 +60,69 @@ private void ExecuteCore() var manager = new RuntimeGraphManager(); var graph = manager.Collect(lockFile); - var expandedGraph = manager.Expand(graph, Runtime); - - // Remove the runtime entry for the project which generates the original deps.json. For example, there is no Microsoft.AspNetCore.App.dll. - var trimmedRuntimeLibraries = RuntimeReference.RemoveSharedFxRuntimeEntry(context.RuntimeLibraries, FrameworkName); + var expandedGraph = manager.Expand(graph, BaseRuntimeIdentifier); - trimmedRuntimeLibraries = ResolveProjectsAsPackages(ResolvedPackageProjectReferences, trimmedRuntimeLibraries); + var runtimeFiles = new List(); + var nativeFiles = new List(); + var resourceAssemblies = new List(); - if (PackagesToRemove != null && PackagesToRemove.Any()) + foreach (var library in context.RuntimeLibraries) { - trimmedRuntimeLibraries = RuntimeReference.RemoveReferences(trimmedRuntimeLibraries, PackagesToRemove); + foreach (var file in library.RuntimeAssemblyGroups.SelectMany(g => g.RuntimeFiles)) + { + var path = $"runtimes/{context.Target.Runtime}/lib/{TargetFramework}/{Path.GetFileName(file.Path)}"; + runtimeFiles.Add( + new RuntimeFile( + path, + file.AssemblyVersion, + file.FileVersion)); + } + + foreach (var file in library.NativeLibraryGroups.SelectMany(g => g.RuntimeFiles)) + { + var path = $"runtimes/{context.Target.Runtime}/native/{Path.GetFileName(file.Path)}"; + nativeFiles.Add( + new RuntimeFile( + path, + file.AssemblyVersion, + file.FileVersion)); + } + + resourceAssemblies.AddRange( + library.ResourceAssemblies); } + var runtimePackageName = $"runtime.{context.Target.Runtime}.{FrameworkName}"; + + var runtimeLibrary = new RuntimeLibrary("package", + runtimePackageName, + FrameworkVersion, + string.Empty, + new[] { new RuntimeAssetGroup(string.Empty, runtimeFiles) }, + new[] { new RuntimeAssetGroup(string.Empty, nativeFiles) }, + resourceAssemblies, + Array.Empty(), + hashPath: null, + path: $"{runtimePackageName.ToLowerInvariant()}/{FrameworkVersion}", + serviceable: true); + + var targetingPackLibrary = new RuntimeLibrary("package", + FrameworkName, + FrameworkVersion, + string.Empty, + Array.Empty(), + Array.Empty(), + resourceAssemblies, + new[] { new Dependency(runtimeLibrary.Name, runtimeLibrary.Version) }, + hashPath: null, + path: $"{FrameworkName.ToLowerInvariant()}/{FrameworkVersion}", + serviceable: true); + context = new DependencyContext( context.Target, CompilationOptions.Default, Array.Empty(), - trimmedRuntimeLibraries, + new[] { targetingPackLibrary, runtimeLibrary }, expandedGraph ); @@ -86,43 +131,5 @@ private void ExecuteCore() new DependencyContextWriter().Write(context, depsStream); } } - - private IEnumerable ResolveProjectsAsPackages(ITaskItem[] resolvedProjects, IEnumerable compilationLibraries) - { - var projects = resolvedProjects.ToDictionary(k => k.GetMetadata("PackageId"), k => k, StringComparer.OrdinalIgnoreCase); - - foreach (var library in compilationLibraries) - { - if (projects.TryGetValue(library.Name, out var project)) - { - Log.LogMessage("Replacing the library entry for {0}", library.Name); - - var packagePath = project.ItemSpec; - var packageId = library.Name; - var version = library.Version; - string packageHash; - using (var sha512 = SHA512.Create()) - { - packageHash = "sha512-" + sha512.ComputeHashAsBase64(File.OpenRead(packagePath), leaveStreamOpen: false); - } - - yield return new RuntimeLibrary("package", - library.Name, - library.Version, - packageHash, - library.RuntimeAssemblyGroups, - library.NativeLibraryGroups, - library.ResourceAssemblies, - library.Dependencies, - serviceable: true, - path: $"{library.Name}/{library.Version}".ToLowerInvariant(), - hashPath: $"{library.Name}.{library.Version}.nupkg.sha512".ToLowerInvariant()); - } - else - { - yield return library; - } - } - } } } diff --git a/build/tasks/RepoTasks.tasks b/build/tasks/RepoTasks.tasks index 5df75df38555..8bb46081f56b 100644 --- a/build/tasks/RepoTasks.tasks +++ b/build/tasks/RepoTasks.tasks @@ -11,7 +11,6 @@ - diff --git a/build/tasks/ResolveVersionRange.cs b/build/tasks/ResolveVersionRange.cs deleted file mode 100644 index cedc94b40472..000000000000 --- a/build/tasks/ResolveVersionRange.cs +++ /dev/null @@ -1,68 +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 Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using NuGet.Versioning; -using RepoTasks.Utilities; - -namespace RepoTasks -{ - public class ResolveVersionRange : Task - { - [Required] - [Output] - public ITaskItem[] Items { get; set; } - - [Required] - public string Version { get; set; } - - [Required] - public string RangeType { get; set; } - - // MSBuild doesn't allow binding to enums directly. - private enum VersionRangeType - { - Minimum, // [1.1.1, ) - MajorMinor, // [1.1.1, 1.2.0) - } - - public override bool Execute() - { - if (!Enum.TryParse(RangeType, out var rangeType)) - { - Log.LogError("Unexpected value {0} for RangeType", RangeType); - return false; - } - - var versionRange = GetVersionRange(rangeType, Version); - - foreach (var item in Items) - { - item.SetMetadata("_OriginalVersion", Version); - item.SetMetadata("Version", versionRange); - } - - return !Log.HasLoggedErrors; - } - - private string GetVersionRange(VersionRangeType rangeType, string packageVersion) - { - switch (rangeType) - { - case VersionRangeType.MajorMinor: - if (!NuGetVersion.TryParse(packageVersion, out var nugetVersion)) - { - Log.LogError("Invalid NuGet version '{0}'", packageVersion); - return null; - } - return $"[{packageVersion}, {nugetVersion.Major}.{nugetVersion.Minor + 1}.0)"; - case VersionRangeType.Minimum: - return packageVersion; - default: - throw new NotImplementedException(); - } - } - } -} diff --git a/build/tasks/Utilities/RuntimeGraphManager.cs b/build/tasks/Utilities/RuntimeGraphManager.cs index d3552f36beee..82f373ef8dfd 100644 --- a/build/tasks/Utilities/RuntimeGraphManager.cs +++ b/build/tasks/Utilities/RuntimeGraphManager.cs @@ -7,7 +7,6 @@ using System.IO; using System.Linq; using Microsoft.Extensions.DependencyModel; -using NuGet.Frameworks; using NuGet.Packaging; using NuGet.ProjectModel; using NuGet.RuntimeModel; @@ -63,4 +62,4 @@ private IEnumerable FindImporters(RuntimeGraph runtimeGraph, string runt } } } -} \ No newline at end of file +} diff --git a/build/tasks/Utilities/RuntimeReference.cs b/build/tasks/Utilities/RuntimeReference.cs deleted file mode 100644 index 8f682eaa52fb..000000000000 --- a/build/tasks/Utilities/RuntimeReference.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// Sourced from https://github.com/dotnet/core-setup/tree/be8d8e3486b2bf598ed69d39b1629a24caaba45e/tools-local/tasks, needs to be kept in sync - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.Extensions.DependencyModel; - -namespace RepoTasks.Utilities -{ - internal class RuntimeReference - { - public static IEnumerable RemoveSharedFxRuntimeEntry(IEnumerable runtimeLibraries, string fxName) - { - foreach (var runtimeLib in runtimeLibraries) - { - if (string.Equals(runtimeLib.Name, fxName, StringComparison.OrdinalIgnoreCase)) - { - yield return new RuntimeLibrary(runtimeLib.Type, - runtimeLib.Name, - runtimeLib.Version, - runtimeLib.Hash, - Array.Empty(), // runtimeLib.RuntimeAssemblyGroups, - runtimeLib.NativeLibraryGroups, - runtimeLib.ResourceAssemblies, - runtimeLib.Dependencies, - runtimeLib.Serviceable); - } - else - { - yield return runtimeLib; - } - } - } - - public static List RemoveReferences(IEnumerable runtimeLibraries, IEnumerable packages) - { - List result = new List(); - - foreach (var runtimeLib in runtimeLibraries) - { - if (string.IsNullOrEmpty(packages.FirstOrDefault(elem => runtimeLib.Name.Equals(elem, StringComparison.OrdinalIgnoreCase)))) - { - List toRemoveDependecy = new List(); - foreach (var dependency in runtimeLib.Dependencies) - { - if (!string.IsNullOrEmpty(packages.FirstOrDefault(elem => dependency.Name.Equals(elem, StringComparison.OrdinalIgnoreCase)))) - { - toRemoveDependecy.Add(dependency); - } - } - - if (toRemoveDependecy.Count > 0) - { - List modifiedDependencies = new List(); - foreach (var dependency in runtimeLib.Dependencies) - { - if (!toRemoveDependecy.Contains(dependency)) - { - modifiedDependencies.Add(dependency); - } - } - - - result.Add(new RuntimeLibrary(runtimeLib.Type, - runtimeLib.Name, - runtimeLib.Version, - runtimeLib.Hash, - runtimeLib.RuntimeAssemblyGroups, - runtimeLib.NativeLibraryGroups, - runtimeLib.ResourceAssemblies, - modifiedDependencies, - runtimeLib.Serviceable)); - - } - else if (string.IsNullOrEmpty(packages.FirstOrDefault(elem => runtimeLib.Name.Equals(elem, StringComparison.OrdinalIgnoreCase)))) - { - result.Add(runtimeLib); - } - } - } - return result; - } - } -} diff --git a/eng/targets/SharedFx.Common.props b/eng/targets/SharedFx.Common.props deleted file mode 100644 index 7f562c98f98c..000000000000 --- a/eng/targets/SharedFx.Common.props +++ /dev/null @@ -1,36 +0,0 @@ - - - - - true - - $(SharedFxRID) - $(HostRid) - $(RuntimeIdentifier) - - - true - - - true - - - true - - false - - - false - false - - - none - false - false - false - - - diff --git a/src/Framework/Directory.Build.props b/src/Framework/Directory.Build.props index cc051ae3600e..eb1297900ff4 100644 --- a/src/Framework/Directory.Build.props +++ b/src/Framework/Directory.Build.props @@ -5,12 +5,6 @@ true - - true - - $(RepositoryRoot)obj\pkg\$(MSBuildProjectName)\ - - - - $(RepositoryRoot)bin\fx\$(SharedFxRid)\$(MSBuildProjectName)\ - $(RepositoryRoot)obj\fx\$(MSBuildProjectName)\ - - false - false - - true - $(MSBuildThisFileDirectory)runtime.fx.nuspec - aspnetcore;shared-framework - - true - - diff --git a/src/Framework/Directory.Build.targets b/src/Framework/Directory.Build.targets deleted file mode 100644 index 80354ba35b55..000000000000 --- a/src/Framework/Directory.Build.targets +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - id=$(PackageId); - version=$(PackageVersion); - authors=$(Authors); - rid=$(SharedFxRid); - description=$(PackageDescription); - tags=$(PackageTags.Replace(';', ' ')); - licenseUrl=$(PackageLicenseUrl); - projectUrl=$(PackageProjectUrl); - iconUrl=$(PackageIconUrl); - repositoryUrl=$(RepositoryUrl); - repositoryCommit=$(RepositoryCommit); - copyright=$(Copyright); - targetFramework=$(TargetFramework); - symbolsAssets=$([MSBuild]::NormalizeDirectory($(SymbolsOutputPath))); - nativeAssets=$([MSBuild]::NormalizeDirectory($(NativeAssetsOutputPath))); - runtimeAssets=$([MSBuild]::NormalizeDirectory($(RuntimeAssetsOutputPath))); - - - - - diff --git a/src/Framework/Metapackage.targets b/src/Framework/Metapackage.targets deleted file mode 100644 index a1951c166c36..000000000000 --- a/src/Framework/Metapackage.targets +++ /dev/null @@ -1,51 +0,0 @@ - - - - false - - false - - false - - true - - true - - $(MSBuildProjectName) - $(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg - - - - - - - - - $(PackageId) - - - - - - - - - - - - - - - - None - - - - - - - - diff --git a/src/Framework/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App.props b/src/Framework/Microsoft.AspNetCore.App.props similarity index 99% rename from src/Framework/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App.props rename to src/Framework/Microsoft.AspNetCore.App.props index 8acb3e61f124..c9ad8cf00829 100644 --- a/src/Framework/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App.props +++ b/src/Framework/Microsoft.AspNetCore.App.props @@ -125,7 +125,7 @@ - + diff --git a/src/Framework/Microsoft.AspNetCore.App/pkg/Microsoft.AspNetCore.App.pkgproj b/src/Framework/Microsoft.AspNetCore.App/pkg/Microsoft.AspNetCore.App.pkgproj deleted file mode 100644 index acde456b6c80..000000000000 --- a/src/Framework/Microsoft.AspNetCore.App/pkg/Microsoft.AspNetCore.App.pkgproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - netcoreapp3.0 - aspnetcore - Provides a default set of APIs for building an ASP.NET Core application. - -This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download. - - - - - - - - - - - - MajorMinor - - - - - - diff --git a/src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp3.0/Microsoft.AspNetCore.App.props b/src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp3.0/Microsoft.AspNetCore.App.props deleted file mode 100644 index b68699c5b3ee..000000000000 --- a/src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp3.0/Microsoft.AspNetCore.App.props +++ /dev/null @@ -1,21 +0,0 @@ - - - - <_AspNetCoreAppSharedFxIsEnabled Condition=" '$(_AspNetCoreAppSharedFxIsEnabled)' == '' ">true - - - - - - - - diff --git a/src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp3.0/Microsoft.AspNetCore.App.targets b/src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp3.0/Microsoft.AspNetCore.App.targets deleted file mode 100644 index 2e222008cc80..000000000000 --- a/src/Framework/Microsoft.AspNetCore.App/pkg/build/netcoreapp3.0/Microsoft.AspNetCore.App.targets +++ /dev/null @@ -1,18 +0,0 @@ - - - - Microsoft.AspNetCore.App - - - - - - diff --git a/src/Framework/Microsoft.AspNetCore.App/src/Microsoft.AspNetCore.App.shfxproj b/src/Framework/Microsoft.AspNetCore.App/src/Microsoft.AspNetCore.App.shfxproj deleted file mode 100644 index e590cce6ce43..000000000000 --- a/src/Framework/Microsoft.AspNetCore.App/src/Microsoft.AspNetCore.App.shfxproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - netcoreapp3.0 - Microsoft.NETCore.App - $(MicrosoftNETCoreAppPackageVersion) - - - runtime.$(SharedFxRid).$(MSBuildProjectName) - This package provides assets used for self-contained deployments of an ASP.NET Core application. It is an internal implementation package not meant for direct consumption. Please do not reference directly. - -$(MSBuildProjectName) provides a default set of APIs for building an ASP.NET Core application. - - - - - - - - diff --git a/src/Framework/pkg/Metapackage.targets b/src/Framework/pkg/Metapackage.targets new file mode 100644 index 000000000000..1c4e011b4ca0 --- /dev/null +++ b/src/Framework/pkg/Metapackage.targets @@ -0,0 +1,72 @@ + + + + false + + false + + false + + true + + true + + false + + + true + + $(MSBuildProjectName) + $(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg + + + + + + + $(MicrosoftNETCoreAppPackageVersion) + All + true + + + + + + + + $(PackageId) + + + + + + + + <_SupportedRids Include="$(SupportedRuntimeIdentifiers)" /> + + + + +{ + "runtimes": { + @(_SupportedRids->'"%(Identity)": { "$(PackageId)": { "runtime.%(Identity).$(PackageId)": "$(PackageVersion)" } }', ',%0A ') + } +} + + + + + + + + + + ref/$(TargetFramework)/%(ReferencePath.FileName)%(ReferencePath.Extension) + + + + + + + + diff --git a/src/Framework/pkg/Microsoft.AspNetCore.App.pkgproj b/src/Framework/pkg/Microsoft.AspNetCore.App.pkgproj new file mode 100644 index 000000000000..a7f0ed52ccca --- /dev/null +++ b/src/Framework/pkg/Microsoft.AspNetCore.App.pkgproj @@ -0,0 +1,30 @@ + + + $(RepositoryRoot)obj\pkg\$(MSBuildProjectName)\ + + + false + + + + + + netcoreapp3.0 + aspnetcore + true + Provides a default set of APIs for building an ASP.NET Core application. + +This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download. + + + + + + + + + + + + + diff --git a/src/Framework/pkg/Microsoft.AspNetCore.App.targets b/src/Framework/pkg/Microsoft.AspNetCore.App.targets new file mode 100644 index 000000000000..9e85ffd05545 --- /dev/null +++ b/src/Framework/pkg/Microsoft.AspNetCore.App.targets @@ -0,0 +1,7 @@ + + + + + diff --git a/src/Framework/Microsoft.AspNetCore.App/pkg/lib/netcoreapp3.0/_._ b/src/Framework/pkg/_._ similarity index 100% rename from src/Framework/Microsoft.AspNetCore.App/pkg/lib/netcoreapp3.0/_._ rename to src/Framework/pkg/_._ diff --git a/src/Framework/src/Microsoft.AspNetCore.App.shfxproj b/src/Framework/src/Microsoft.AspNetCore.App.shfxproj new file mode 100644 index 000000000000..7c6c9455a3ef --- /dev/null +++ b/src/Framework/src/Microsoft.AspNetCore.App.shfxproj @@ -0,0 +1,64 @@ + + + netcoreapp3.0 + Microsoft.NETCore.App + $(MicrosoftNETCoreAppPackageVersion) + + $(RepositoryRoot)bin\fx\$(SharedFxRid)\$(MSBuildProjectName)\ + $(RepositoryRoot)obj\fx\$(MSBuildProjectName)\ + + + true + + $(SharedFxRID) + $(HostRid) + $(RuntimeIdentifier) + + + true + + + true + + false + false + + + true + + false + + + false + false + + + none + false + false + false + + + + + + + runtime.$(SharedFxRid).$(MSBuildProjectName) + This package provides assets used for self-contained deployments of an ASP.NET Core application. It is an internal implementation package not meant for direct consumption. Please do not reference directly. + +$(MSBuildProjectName) provides a default set of APIs for building an ASP.NET Core application. + + + true + $(MSBuildThisFileDirectory)runtime.fx.nuspec + aspnetcore;shared-framework + + true + + + + + + + + diff --git a/eng/targets/SharedFx.Common.targets b/src/Framework/src/SharedFx.targets similarity index 92% rename from eng/targets/SharedFx.Common.targets rename to src/Framework/src/SharedFx.targets index 61b41d9eee9c..1c3063ebaf70 100644 --- a/eng/targets/SharedFx.Common.targets +++ b/src/Framework/src/SharedFx.targets @@ -4,7 +4,7 @@ This targets file should only be imported by .shfxproj files. --> - + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) @@ -94,21 +94,14 @@ This targets file should only be imported by .shfxproj files. $(IntermediateOutputPath)$(SharedFxName).publish.deps.json - $(MetadataOutputPath)$(SharedFxName).runtimeconfig.json + $(MetadataOutputPath)$(SharedFxName).runtimeconfig.json + + $(PublishRuntimeConfigFilePath) $(MetadataOutputPath)$(SharedFxName).deps.json $(MetadataOutputPath).version - - - _ResolvedFrameworkProjectReferencePaths - - - - _ResolvedPackageProjectReferencePaths - - @@ -186,12 +176,12 @@ This targets file should only be imported by .shfxproj files. Outputs="$(SharedFxDepsFilePath)"> + BaseRuntimeIdentifier="$(BaseSharedFxRid)" /> @@ -274,7 +264,6 @@ This targets file should only be imported by .shfxproj files. <_PlatformAssemblyPaths Remove="@(_PlatformAssemblyPaths)" /> <_PlatformAssemblyPaths Include="$(CrossGenToolDir)" /> <_PlatformAssemblyPaths Include="$(PublishDir)" /> - <_PlatformAssemblyPaths Include="%(_ResolvedFrameworkProjectReferencePaths.RuntimeAssetsOutputPath)" Condition="'%(_ResolvedFrameworkProjectReferencePaths.RuntimeAssetsOutputPath)' != ''" /> @@ -360,4 +349,27 @@ This targets file should only be imported by .shfxproj files. + + + + + id=$(PackageId); + version=$(PackageVersion); + authors=$(Authors); + rid=$(SharedFxRid); + description=$(PackageDescription); + tags=$(PackageTags.Replace(';', ' ')); + licenseUrl=$(PackageLicenseUrl); + projectUrl=$(PackageProjectUrl); + iconUrl=$(PackageIconUrl); + repositoryUrl=$(RepositoryUrl); + repositoryCommit=$(RepositoryCommit); + copyright=$(Copyright); + targetFramework=$(TargetFramework); + symbolsAssets=$([MSBuild]::NormalizeDirectory($(SymbolsOutputPath))); + nativeAssets=$([MSBuild]::NormalizeDirectory($(NativeAssetsOutputPath))); + runtimeAssets=$([MSBuild]::NormalizeDirectory($(RuntimeAssetsOutputPath))); + + + diff --git a/src/Framework/_._ b/src/Framework/src/_._ similarity index 100% rename from src/Framework/_._ rename to src/Framework/src/_._ diff --git a/src/Framework/runtime.fx.nuspec b/src/Framework/src/runtime.fx.nuspec similarity index 100% rename from src/Framework/runtime.fx.nuspec rename to src/Framework/src/runtime.fx.nuspec diff --git a/src/Framework/Framework.UnitTests/AssertEx.cs b/src/Framework/test/AssertEx.cs similarity index 100% rename from src/Framework/Framework.UnitTests/AssertEx.cs rename to src/Framework/test/AssertEx.cs diff --git a/src/Framework/Framework.UnitTests/Framework.UnitTests.csproj b/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj similarity index 96% rename from src/Framework/Framework.UnitTests/Framework.UnitTests.csproj rename to src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj index 612980dc5350..4ea4f83952bb 100644 --- a/src/Framework/Framework.UnitTests/Framework.UnitTests.csproj +++ b/src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj @@ -30,7 +30,7 @@ - + false _ResolvedFrameworkReference diff --git a/src/Framework/Framework.UnitTests/SharedFxTests.cs b/src/Framework/test/SharedFxTests.cs similarity index 58% rename from src/Framework/Framework.UnitTests/SharedFxTests.cs rename to src/Framework/test/SharedFxTests.cs index e5376a5a946b..6772b7d3efe5 100644 --- a/src/Framework/Framework.UnitTests/SharedFxTests.cs +++ b/src/Framework/test/SharedFxTests.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.IO; +using System.Linq; using Newtonsoft.Json.Linq; using Xunit; @@ -9,6 +10,13 @@ namespace Microsoft.AspNetCore { public class SharedFxTests { + private readonly string _expectedTfm; + + public SharedFxTests() + { + _expectedTfm = "netcoreapp" + TestData.GetPackageVersion().Substring(0, 3); + } + [Fact] public void ItContainsValidRuntimeConfigFile() { @@ -20,7 +28,7 @@ public void ItContainsValidRuntimeConfigFile() var runtimeConfig = JObject.Parse(File.ReadAllText(runtimeConfigFilePath)); Assert.Equal("Microsoft.NETCore.App", (string)runtimeConfig["runtimeOptions"]["framework"]["name"]); - Assert.Equal("netcoreapp" + TestData.GetPackageVersion().Substring(0, 3), (string)runtimeConfig["runtimeOptions"]["tfm"]); + Assert.Equal(_expectedTfm, (string)runtimeConfig["runtimeOptions"]["tfm"]); Assert.Equal(TestData.GetMicrosoftNETCoreAppPackageVersion(), (string)runtimeConfig["runtimeOptions"]["framework"]["version"]); } @@ -32,13 +40,13 @@ public void ItContainsValidDepsJson() var rid = TestData.GetSharedFxRuntimeIdentifier(); var target = $".NETCoreApp,Version=v{TestData.GetPackageVersion().Substring(0, 3)}/{rid}"; + var ridPackageId = $"runtime.{rid}.Microsoft.AspNetCore.App"; AssertEx.FileExists(depsFilePath); var depsFile = JObject.Parse(File.ReadAllText(depsFilePath)); Assert.Equal(target, (string)depsFile["runtimeTarget"]["name"]); - Assert.NotNull(depsFile["targets"][target]); Assert.NotNull(depsFile["compilationOptions"]); Assert.Empty(depsFile["compilationOptions"]); Assert.NotEmpty(depsFile["runtimes"][rid]); @@ -47,7 +55,32 @@ public void ItContainsValidDepsJson() var prop = Assert.IsType(item); var lib = Assert.IsType(prop.Value); Assert.Equal("package", lib["type"].Value()); - Assert.StartsWith("sha512-", lib["sha512"].Value()); + Assert.Empty(lib["sha512"].Value()); + }); + + Assert.NotNull(depsFile["libraries"][$"Microsoft.AspNetCore.App/{TestData.GetPackageVersion()}"]); + Assert.NotNull(depsFile["libraries"][$"runtime.{rid}.Microsoft.AspNetCore.App/{TestData.GetPackageVersion()}"]); + Assert.Equal(2, depsFile["libraries"].Values().Count()); + + var targetLibraries = depsFile["targets"][target]; + Assert.Equal(2, targetLibraries.Values().Count()); + var metapackage = targetLibraries[$"Microsoft.AspNetCore.App/{TestData.GetPackageVersion()}"]; + Assert.Null(metapackage["runtime"]); + Assert.Null(metapackage["native"]); + + var runtimeLibrary = targetLibraries[$"{ridPackageId}/{TestData.GetPackageVersion()}"]; + Assert.Null(runtimeLibrary["dependencies"]); + Assert.All(runtimeLibrary["runtime"], item => + { + var obj = Assert.IsType(item); + Assert.StartsWith($"runtimes/{rid}/lib/{_expectedTfm}/", obj.Name); + Assert.NotEmpty(obj.Value["assemblyVersion"].Value()); + Assert.NotEmpty(obj.Value["fileVersion"].Value()); + }); + Assert.All(runtimeLibrary["native"], item => + { + var obj = Assert.IsType(item); + Assert.StartsWith($"runtimes/{rid}/native/", obj.Name); }); } diff --git a/src/Framework/Framework.UnitTests/TestData.cs b/src/Framework/test/TestData.cs similarity index 100% rename from src/Framework/Framework.UnitTests/TestData.cs rename to src/Framework/test/TestData.cs diff --git a/src/Framework/Framework.UnitTests/TestDataAttribute.cs b/src/Framework/test/TestDataAttribute.cs similarity index 100% rename from src/Framework/Framework.UnitTests/TestDataAttribute.cs rename to src/Framework/test/TestDataAttribute.cs diff --git a/src/Installers/Archive/Archive.Internal.zipproj b/src/Installers/Archive/Archive.Internal.zipproj index ba67cae60bb2..fe6c0c9c7e9f 100644 --- a/src/Installers/Archive/Archive.Internal.zipproj +++ b/src/Installers/Archive/Archive.Internal.zipproj @@ -16,7 +16,7 @@ - + true _ResolvedFxProjects diff --git a/src/Installers/Archive/Archive.Redist.zipproj b/src/Installers/Archive/Archive.Redist.zipproj index 342f43ca22cc..ede7d4a7f7ef 100644 --- a/src/Installers/Archive/Archive.Redist.zipproj +++ b/src/Installers/Archive/Archive.Redist.zipproj @@ -19,7 +19,7 @@ - + true _ResolvedFxProjects diff --git a/src/Installers/Debian/Runtime.debproj b/src/Installers/Debian/Runtime.debproj index 69816888ac4e..ffe02b315e2d 100644 --- a/src/Installers/Debian/Runtime.debproj +++ b/src/Installers/Debian/Runtime.debproj @@ -40,7 +40,7 @@ - + true _ResolvedFxProjects diff --git a/src/Installers/Rpm/Rpm.props b/src/Installers/Rpm/Rpm.props index 4cb272bcd1bb..f002b65eba92 100644 --- a/src/Installers/Rpm/Rpm.props +++ b/src/Installers/Rpm/Rpm.props @@ -25,7 +25,7 @@ - + true _ResolvedFxProjects diff --git a/src/Packages/Microsoft.AspNetCore.All/lib/netcoreapp3.0/_._ b/src/Packages/Microsoft.AspNetCore.All/lib/netcoreapp3.0/_._ deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/Packages/Microsoft.AspNetCore.App/lib/netcoreapp3.0/_._ b/src/Packages/Microsoft.AspNetCore.App/lib/netcoreapp3.0/_._ deleted file mode 100644 index e69de29bb2d1..000000000000 From 93715670cd696bbf1996b227bab3a4c0ce2ac719 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 15 Nov 2018 22:31:53 -0800 Subject: [PATCH 2/3] Update default-build.yml --- .azure/pipelines/jobs/default-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure/pipelines/jobs/default-build.yml b/.azure/pipelines/jobs/default-build.yml index 87873f95d866..48077c9ca387 100644 --- a/.azure/pipelines/jobs/default-build.yml +++ b/.azure/pipelines/jobs/default-build.yml @@ -63,7 +63,7 @@ jobs: - job: ${{ coalesce(parameters.jobName, parameters.agentOs) }} displayName: ${{ coalesce(parameters.jobDisplayName, parameters.agentOs) }} dependsOn: ${{ parameters.dependsOn }} - timeoutInMinutes: 90 + timeoutInMinutes: 120 workspace: clean: all strategy: From edea1415b716bd378ee71a1daeea5c4e608fb1fa Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 16 Nov 2018 08:10:49 -0800 Subject: [PATCH 3/3] Update tests to pass on osx and linux --- src/Framework/test/SharedFxTests.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Framework/test/SharedFxTests.cs b/src/Framework/test/SharedFxTests.cs index 6772b7d3efe5..b465b16705af 100644 --- a/src/Framework/test/SharedFxTests.cs +++ b/src/Framework/test/SharedFxTests.cs @@ -77,11 +77,19 @@ public void ItContainsValidDepsJson() Assert.NotEmpty(obj.Value["assemblyVersion"].Value()); Assert.NotEmpty(obj.Value["fileVersion"].Value()); }); - Assert.All(runtimeLibrary["native"], item => + + if (TestData.GetSharedFxRuntimeIdentifier().StartsWith("win")) { - var obj = Assert.IsType(item); - Assert.StartsWith($"runtimes/{rid}/native/", obj.Name); - }); + Assert.All(runtimeLibrary["native"], item => + { + var obj = Assert.IsType(item); + Assert.StartsWith($"runtimes/{rid}/native/", obj.Name); + }); + } + else + { + Assert.Null(runtimeLibrary["native"]); + } } [Fact]