Skip to content

Targeting pack and shared framework fixups #7794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 8 additions & 25 deletions src/Framework/ref/Microsoft.AspNetCore.App.Ref.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ This package is an internal implementation of the .NET Core SDK and is not meant
<PackageTags>aspnetcore;targeting-pack</PackageTags>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>

<!-- Subject to change: see https://github.com/dotnet/designs/pull/50 -->
<PackageType>TargetingPack</PackageType>
<PackageType>DotnetPlatform</PackageType>
<RefAssemblyPackagePath>ref/$(TargetFramework)/</RefAssemblyPackagePath>

<LayoutTargetDir>$(TargetingPackLayoutRoot)packs/Microsoft.AspNetCore.App.Ref/$(PackageVersion)/$(RefAssemblyPackagePath)</LayoutTargetDir>
<LayoutTargetDir>$(TargetingPackLayoutRoot)packs/Microsoft.AspNetCore.App.Ref/$(PackageVersion)/</LayoutTargetDir>
<ArchiveOutputFileName>aspnetcore-targeting-pack-$(PackageVersion).zip</ArchiveOutputFileName>
<ArchiveOutputPath>$(InstallersOutputPath)$(ArchiveOutputFileName)</ArchiveOutputPath>

Expand Down Expand Up @@ -56,7 +55,6 @@ This package is an internal implementation of the .NET Core SDK and is not meant
$(BuildDependsOn);
GeneratePackageConflictManifest;
_ResolveTargetingPackContent;
_BatchCopyToOutputDirectory;
_BatchCopyToLayoutTargetDir;
_CreateTargetingPackArchive;
</BuildDependsOn>
Expand Down Expand Up @@ -87,15 +85,11 @@ This package is an internal implementation of the .NET Core SDK and is not meant

<AspNetCoreReferenceDocXml Include="@(AspNetCoreReferenceAssemblyPath->'%(RootDir)%(Directory)%(FileName).xml')" />

<!-- Exclude known missing XML docs files. Time-boxing this workaround because we want XML docs for everything. This can be removed when we get a new build with https://github.com/dotnet/core-setup/pull/5109. -->
<AspNetCoreReferenceDocXml Remove="@(AspNetCoreReferenceDocXml)"
Condition="'$(MicrosoftNETCoreAppPackageVersion)' == '3.0.0-preview-27405-2' AND ('%(FileName)' == 'Microsoft.Extensions.DependencyModel' OR '%(FileName)' == 'Microsoft.DotNet.PlatformAbstractions' )" />
<RefPackContent Include="@(AspNetCoreReferenceAssemblyPath)" PackagePath="$(RefAssemblyPackagePath)" />
<RefPackContent Include="@(AspNetCoreReferenceDocXml)" PackagePath="$(RefAssemblyPackagePath)" />
<RefPackContent Include="$(TargetDir)$(PackageConflictManifestFileName)" PackagePath="$(PackageConflictManifestPackagePath)" />

<RefPackContent Include="@(AspNetCoreReferenceAssemblyPath)" />
<RefPackContent Include="@(AspNetCoreReferenceDocXml)" />

<_PackageFiles Include="@(RefPackContent)" PackagePath="$(RefAssemblyPackagePath)" />
<_PackageFiles Include="$(TargetDir)$(PackageConflictManifestFileName)" PackagePath="$(PackageConflictManifestPackagePath)" />
<_PackageFiles Include="@(RefPackContent)" />
</ItemGroup>
</Target>

Expand All @@ -114,25 +108,14 @@ This package is an internal implementation of the .NET Core SDK and is not meant
Overwrite="true" />
</Target>

<!-- Written to take advantage of target batching in MSBuild. -->
<Target Name="_BatchCopyToOutputDirectory"
DependsOnTargets="_ResolveTargetingPackContent"
Inputs="@(RefPackContent)"
Outputs="@(RefPackContent->'$(TargetDir)%(FileName)%(Extension)')">

<Copy SourceFiles="@(RefPackContent)"
DestinationFiles="@(RefPackContent->'$(TargetDir)%(FileName)%(Extension)')"
UseHardlinksIfPossible="true" />
</Target>

<!-- Written to take advantage of target batching in MSBuild. -->
<Target Name="_BatchCopyToLayoutTargetDir"
DependsOnTargets="_ResolveTargetingPackContent"
Inputs="@(RefPackContent)"
Outputs="@(RefPackContent->'$(LayoutTargetDir)%(FileName)%(Extension)')">
Outputs="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(FileName)%(Extension)')">

<Copy SourceFiles="@(RefPackContent)"
DestinationFiles="@(RefPackContent->'$(LayoutTargetDir)%(FileName)%(Extension)')"
DestinationFiles="@(RefPackContent->'$(LayoutTargetDir)%(PackagePath)%(FileName)%(Extension)')"
UseHardlinksIfPossible="true" />
</Target>

Expand Down
5 changes: 3 additions & 2 deletions src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<SharedFxName>Microsoft.AspNetCore.App</SharedFxName>
<PackageId>$(MSBuildProjectName).$(RuntimeIdentifier)</PackageId>
<IsShippingPackage>true</IsShippingPackage>
<!-- Undo for Preview4. Preview 3 is shipping using the runtime.$(rid) packages instead. -->
<IsPackable Condition="'$(PreReleaseLabel)'=='preview3'">false</IsPackable>

<PackageDescription>Provides a default set of APIs for building an ASP.NET Core application. Contains assets used for self-contained deployments.

Expand All @@ -23,8 +25,7 @@ This package is an internal implementation of the .NET Core SDK and is not meant
<PackageTags>aspnetcore;shared-framework</PackageTags>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>

<!-- Subject to change: see https://github.com/dotnet/designs/pull/50 -->
<PackageType>RuntimePack</PackageType>
<PackageType>DotnetPlatform</PackageType>
<!-- NuGet appends target framework to this value. Example: runtimes/win-x64/lib/netcoreapp3.0/ -->
<BuildOutputTargetFolder>runtimes/$(RuntimeIdentifier)/lib/</BuildOutputTargetFolder>
<!-- Target framework is not append to this because native assets to not have a target framework. -->
Expand Down
4 changes: 2 additions & 2 deletions src/Framework/src/SharedFx.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ This targets file should only be imported by .shfxproj files.
GenerateSharedFxVersionsFile;
GenerateBuildDependencyFile;
PrepareForPublish;
GeneratePublishDependencyFile;
GenerateSharedFxMetadataFiles;
GenerateBuildRuntimeConfigurationFiles;
ComputeAndCopyFilesToPublishDirectory;
GeneratePublishDependencyFile;
GenerateSharedFxMetadataFiles;
CopySharedFxToOutput;
CollectSharedFxOutput;
PostBuildEvent;
Expand Down
4 changes: 4 additions & 0 deletions src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
<_Parameter1>ManifestOutputDir</_Parameter1>
<_Parameter2>%(_ResolvedFrameworkReference.ManifestOutputDir)</_Parameter2>
</AssemblyAttribute>
<AssemblyAttribute Include="Microsoft.AspNetCore.TestData">
<_Parameter1>RuntimeAssetsOutputPath</_Parameter1>
<_Parameter2>%(_ResolvedFrameworkReference.RuntimeAssetsOutputPath)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>

Expand Down
27 changes: 27 additions & 0 deletions src/Framework/test/SharedFxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,33 @@ public SharedFxTests(ITestOutputHelper output)
_expectedRid = TestData.GetSharedFxRuntimeIdentifier();
}

[Fact]
public void SharedFrameworkContainsExpectedFiles()
{
var actualAssemblies = Directory.GetFiles(TestData.GetTestDataValue("RuntimeAssetsOutputPath"), "*.dll")
.Select(Path.GetFileNameWithoutExtension)
.ToHashSet();
var expectedAssemblies = TestData.GetSharedFxDependencies()
.Split(';', StringSplitOptions.RemoveEmptyEntries)
.ToHashSet();

_output.WriteLine("==== actual assemblies ====");
_output.WriteLine(string.Join('\n', actualAssemblies));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious - for the sake of printing these out, would it make sense to sort them by some arbitrary string sort? That would make the debug output easier for humans to read (I realize it doesn't technically matter).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we could order by name. I'll add that when I merge this back to master (i have green CI checks right now, and don't want to wait 90 minutes to fix this up.)

_output.WriteLine("==== expected assemblies ====");
_output.WriteLine(string.Join('\n', expectedAssemblies));

var missing = expectedAssemblies.Except(actualAssemblies);
var unexpected = actualAssemblies.Except(expectedAssemblies);

_output.WriteLine("==== missing assemblies from the framework ====");
_output.WriteLine(string.Join('\n', missing));
_output.WriteLine("==== unexpected assemblies in the framework ====");
_output.WriteLine(string.Join('\n', unexpected));

Assert.Empty(missing);
Assert.Empty(unexpected);
}

[Fact]
public void PlatformManifestListsAllFiles()
{
Expand Down