Skip to content
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

Creating a runtime pack artifacts directory in the libraries build #34662

Merged
merged 27 commits into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8321dea
[libraries] Clean up SetupTestingHost
mdh1418 Apr 8, 2020
be068f2
[libraries] Setup runtime pack artifacts directory
mdh1418 Apr 8, 2020
d22cee8
WIP havent addressed feedback or finished cleaning up
mdh1418 Apr 8, 2020
e432bbc
Fixed up some xml
Apr 8, 2020
002b96b
[libraries] Set and use BinPlaceTestRuntimePack property
mdh1418 Apr 8, 2020
c3ba797
Updates to structure. Build for ios now generates the right things
Apr 10, 2020
4d91c78
Feedback items
Apr 13, 2020
94a03ab
Removed targetOS check
Apr 13, 2020
3cafc0f
[libraries] Address feedback
mdh1418 Apr 13, 2020
d71ddd1
[libraries] Add DotNetBuildTasksSharedFrameworkTaskFile property to l…
mdh1418 Apr 13, 2020
84241b1
[libraries] Modify sdk import and rename __RuntimeId to PackageRID
mdh1418 Apr 13, 2020
b5568e4
Brought back BinPlaceTestSharedFramework to generate testhost. Will …
Apr 13, 2020
07965e5
Syntax error :-(
Apr 14, 2020
2b3b736
Extra > character lingering
Apr 14, 2020
484d0ff
[libraries] Normalize NetCoreAppRuntimePack directories
mdh1418 Apr 14, 2020
05d4759
[libraries] Cleanup paths after normalizing directories
mdh1418 Apr 14, 2020
73b6800
[libraries] Add comment to explain the lib and native folders under l…
mdh1418 Apr 14, 2020
0dad68b
[libraries] Simplify GetBinPlaceItems
mdh1418 Apr 14, 2020
d465796
[libraries] Remove superfluous condition
mdh1418 Apr 14, 2020
60b9009
[libraries] Condition BinPlaceNETFXRuntime on not targeting mobile an…
mdh1418 Apr 14, 2020
23da306
[libraries] Remove hardcoded NETCoreAppFrameworkIdentifier in pretest…
mdh1418 Apr 14, 2020
211eece
[libraries] Import Sdk.targets into pretest.proj as well
mdh1418 Apr 14, 2020
2d4d7f4
[libraries] Reduce Copy usage in runtime.depproj
mdh1418 Apr 15, 2020
757c871
[libraries] Exclude unwanted files from runtime packs
mdh1418 Apr 15, 2020
bc3991a
[libraries] Change to singular NativeBinPlaceItem
mdh1418 Apr 15, 2020
ba6d021
[libraries] Consolidate itemgroups in runtime.depproj and move runtim…
mdh1418 Apr 15, 2020
0d46895
[libraries] Move pretest.proj imports to end of the file
mdh1418 Apr 15, 2020
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
8 changes: 7 additions & 1 deletion src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@

<TestHostRootPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'testhost', '$(BuildSettings)'))</TestHostRootPath>

<NETCoreAppRuntimePackPath>$(ArtifactsBinDir)\lib-runtime-packs</NETCoreAppRuntimePackPath>
mdh1418 marked this conversation as resolved.
Show resolved Hide resolved
<NETCoreAppRuntimePackLibPath>$(NETCoreAppRuntimePackPath)\runtimes\$(__RuntimeId)\lib\$(NETCoreAppFramework)</NETCoreAppRuntimePackLibPath>
<NETCoreAppRuntimePackNativePath>$(NETCoreAppRuntimePackPath)\runtimes\$(__RuntimeId)\native</NETCoreAppRuntimePackNativePath>
<RuntimePackTargetFrameworkPath>runtimes/$(__RuntimeId)</RuntimePackTargetFrameworkPath>
steveisok marked this conversation as resolved.
Show resolved Hide resolved

<VersionFileForPackages Condition="'$(VersionFileForPackages)' == ''">$(ArtifactsObjDir)version.txt</VersionFileForPackages>

Expand Down Expand Up @@ -304,9 +308,11 @@

<PropertyGroup Condition="'$(BuildAllConfigurations)' != 'true'">
<!-- We add extra binplacing for the test shared framework until we can get hardlinking with the runtime directory working on all platforms -->
<BinPlaceTestSharedFramework Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)'">true</BinPlaceTestSharedFramework>
<BinPlaceTestSharedFramework Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' and '$(TargetOS)' != 'iOS'">true</BinPlaceTestSharedFramework>
steveisok marked this conversation as resolved.
Show resolved Hide resolved
<BinPlaceNETFXRuntime Condition="'$(BuildTargetFramework)' == '$(NetFrameworkCurrent)'">true</BinPlaceNETFXRuntime>

<BinPlaceTestRuntimePack Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' and '$(TargetOS)' == 'iOS'">true</BinPlaceTestRuntimePack>
steveisok marked this conversation as resolved.
Show resolved Hide resolved

<NETCoreAppTestSharedFrameworkPath>$([MSBuild]::NormalizeDirectory('$(TestHostRootPath)', 'shared', 'Microsoft.NETCore.App', '$(ProductVersion)'))</NETCoreAppTestSharedFrameworkPath>

<TestHostRuntimePath Condition="'$(BinPlaceTestSharedFramework)' == 'true'">$(NETCoreAppTestSharedFrameworkPath)</TestHostRuntimePath>
Expand Down
9 changes: 9 additions & 0 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@
<RuntimePath>$(TestHostRootPath)</RuntimePath>
</BinPlaceTargetFrameworks>

<!-- Setup the runtime pack structure for mobile platforms (for testing and installer) -->
<BinPlaceTargetFrameworks Condition="'$(BinPlaceTestRuntimePack)' == 'true'" Include="$(NetCoreAppCurrent)-$(TargetOS)">
<RuntimePath>$(NETCoreAppRuntimePackLibPath)</RuntimePath>
</BinPlaceTargetFrameworks>
<BinPlaceTargetFrameworks Condition="'$(BinPlaceTestRuntimePack)' == 'true'" Include="$(NetCoreAppCurrent)-$(TargetOS)">
<RuntimePath>$(NETCoreAppRuntimePackNativePath)</RuntimePath>
<ItemName>NativeRuntimePackBinPlaceItem</ItemName>
</BinPlaceTargetFrameworks>
mdh1418 marked this conversation as resolved.
Show resolved Hide resolved

<!-- binplace targeting packs which may be different from Build TargetFramework -->
<BinPlaceTargetFrameworks Include="netstandard2.0">
<RefPath>$(NetStandard20RefPath)</RefPath>
Expand Down
15 changes: 14 additions & 1 deletion src/libraries/Native/native-binplace.proj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<!-- Ordering matters! Overriding GetBinPlaceItems and Build targets after the Sdk import. -->
<Target Name="GetBinPlaceItems">
<ItemGroup>
<ItemGroup Condition="'$(BinPlaceTestRuntimePack)' == ''">
mdh1418 marked this conversation as resolved.
Show resolved Hide resolved
<BinPlaceItem Include="$(NativeBinDir)*.dll" />
<BinPlaceItem Include="$(NativeBinDir)*.pdb" />
<BinPlaceItem Include="$(NativeBinDir)*.lib" />
Expand All @@ -20,8 +20,21 @@
<BinPlaceItem Include="$(NativeBinDir)*.dbg" />
<BinPlaceItem Include="$(NativeBinDir)*.dylib" />
<BinPlaceItem Include="$(NativeBinDir)*.dwarf" />
<BinMobileNative Condition="'$(BinPlaceTestRuntimePack)' == 'true'" Include="@(BinPlaceItem)" />
steveisok marked this conversation as resolved.
Show resolved Hide resolved
<FileWrites Include="@(BinPlaceItem)" />
</ItemGroup>
<ItemGroup Condition="'$(BinPlaceTestRuntimePack)' == 'true'">
<NativeRuntimePackBinPlaceItem Include="$(NativeBinDir)/*.dll" />
<NativeRuntimePackBinPlaceItem Include="$(NativeBinDir)/*.pdb" />
<NativeRuntimePackBinPlaceItem Include="$(NativeBinDir)/*.lib" />
<NativeRuntimePackBinPlaceItem Include="$(NativeBinDir)/*.a" />
<NativeRuntimePackBinPlaceItem Include="$(NativeBinDir)/*.bc" />
<NativeRuntimePackBinPlaceItem Include="$(NativeBinDir)/*.so" />
<NativeRuntimePackBinPlaceItem Include="$(NativeBinDir)/*.dbg" />
<NativeRuntimePackBinPlaceItem Include="$(NativeBinDir)/*.dylib" />
<NativeRuntimePackBinPlaceItem Include="$(NativeBinDir)/*.dwarf" />
<FileWrites Include="@(NativeRuntimePackBinPlaceItem)" />
</ItemGroup>
</Target>

<Target Name="Build" DependsOnTargets="BinPlace" />
Expand Down
38 changes: 37 additions & 1 deletion src/libraries/pretest.proj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<PropertyGroup>
<TraversalGlobalProperties>BuildAllProjects=true</TraversalGlobalProperties>
<NETCoreAppFrameworkIdentifier>.NETCoreApp</NETCoreAppFrameworkIdentifier>
<SharedFrameworkName>Microsoft.NETCore.App</SharedFrameworkName>
Copy link
Member

Choose a reason for hiding this comment

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

Share values with installer project tree? (Move to common ancestor?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Where would be a good place to place these properties in <runtimeroot>/src/Directory.Build.props?
Is it a significant impact to performance/organization to move it up? I'm not familiar enough to know now if those properties have a chance of changing or differing between the directories in <runtimeroot>/src. If they were to differ later would it be better to have each specify their own properties?

Copy link
Member

Choose a reason for hiding this comment

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

It might not be worth it. My knee-jerk reaction is that duplicating code is what needs justification rather than reusing it, so just a quick suggestion.

Copy link
Member

Choose a reason for hiding this comment

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

Let's open an issue for this. Consolidate all places in props and targets where we use Microsoft.NETCore.App to a single shared property.

</PropertyGroup>

<!-- Explicitly build the runtime.depproj project first to correctly set up the testhost. -->
Expand Down Expand Up @@ -35,7 +37,7 @@
<UsingTask TaskName="GenerateFileVersionProps" AssemblyFile="$(InstallerTasksAssemblyPath)"/>
<Target Name="GenerateFileVersionProps"
DependsOnTargets="CollectSharedFrameworkRuntimeFiles"
Condition="'$(PlatformManifestFile)' != '' and '$(BuildTargetFramework)' == '$(NetCoreAppCurrent)'"
Condition="'$(PlatformManifestFile)' != '' and '$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' and '$(TargetOS)' != 'iOS'"
AfterTargets="RestoreTestHost">
<GenerateFileVersionProps Files="@(SharedFrameworkRuntimeFiles)"
PackageId="Microsoft.NETCore.App"
Expand All @@ -58,4 +60,38 @@
RuntimeGraphFiles="$(RuntimeIdGraphDefinitionFile)"
TargetRuntimeIdentifier="$(PackageRID)" />
</Target>

<UsingTask TaskName="CreateFrameworkListFile" AssemblyFile="$(InstallerTasksAssemblyPath)"/>
steveisok marked this conversation as resolved.
Show resolved Hide resolved
<Target Name="GenerateFrameworkListFile"
Condition="'$(BinPlaceTestRuntimePack)' == 'true'"
AfterTargets="RestoreTestHost">
<PropertyGroup>
<FrameworkListFilename>RuntimeList.xml</FrameworkListFilename>
<FrameworkListFile>$(NETCoreAppRuntimePackPath)/data/$(FrameworkListFilename)</FrameworkListFile>
</PropertyGroup>

<ItemGroup>
<_rpLibFiles Include="$(NETCoreAppRuntimePackLibPath)\*.*" />
<_rpNativeFiles Include="$(NETCoreAppRuntimePackNativePath)\*.*" />

<_runtimePackFiles Include="@(_rpLibFiles)">
<TargetPath>$(RuntimePackTargetFrameworkPath)/lib/$(NETCoreAppFramework)</TargetPath>
<IsSymbolFile Condition="$([System.String]::Copy('%(Identity)').EndsWith('pdb'))">true</IsSymbolFile>
steveisok marked this conversation as resolved.
Show resolved Hide resolved
</_runtimePackFiles>
<_runtimePackFiles Include="@(_rpNativeFiles)">
<TargetPath>$(RuntimePackTargetFrameworkPath)/native</TargetPath>
<IsNative>true</IsNative>
</_runtimePackFiles>
<FrameworkListRootAttributes Include="Name" Value=".NET $(NETCoreAppFrameworkVersion)" />
<FrameworkListRootAttributes Include="TargetFrameworkIdentifier" Value="$(NETCoreAppFrameworkIdentifier)" />
<FrameworkListRootAttributes Include="TargetFrameworkVersion" Value="$(NETCoreAppFrameworkVersion)" />
<FrameworkListRootAttributes Include="FrameworkName" Value="$(SharedFrameworkName)" />
</ItemGroup>

<CreateFrameworkListFile
Files="@(_runtimePackFiles)"
TargetFile="$(FrameworkListFile)"
TargetFilePrefixes="ref/;runtimes/"
RootAttributes="@(FrameworkListRootAttributes)" />
</Target>
</Project>
28 changes: 24 additions & 4 deletions src/libraries/restore/runtime/runtime.depproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
<FileToExclude Include="apphost" />
</ItemGroup>

<!-- In-tree runtime packs do not require the host, so exclude -->
<ItemGroup Condition="'$(BinPlaceTestRuntimePack)' == 'true'">
<FileToExclude Include="dotnet" />
mdh1418 marked this conversation as resolved.
Show resolved Hide resolved
<FileToExclude Include="libnethost" />
<FileToExclude Include="libhostfxr" />
<FileToExclude Include="libhostpolicy" />
<FileToExclude Include="nethost" />
</ItemGroup>

<ItemGroup>
<!-- System.Data.SqlClient is not live-built anymore -->
<PackageReference Include="System.Data.SqlClient" Version="$(SystemDataSqlClientVersion)" />
Expand All @@ -44,9 +53,6 @@
Condition="'$(BinPlaceTestSharedFramework)' == 'true'"
AfterTargets="AfterResolveReferences">
<PropertyGroup>
<GlobalJsonContent>$([System.IO.File]::ReadAllText('$(RepoRoot)global.json'))</GlobalJsonContent>
<DotNetVersion>$([System.Text.RegularExpressions.Regex]::Match($(GlobalJsonContent), '(%3F&lt;="dotnet": ").*(%3F=")'))</DotNetVersion>

<HostFxrFileName Condition="'$(TargetsWindows)' == 'true'">hostfxr</HostFxrFileName>
<HostFxrFileName Condition="'$(TargetsWindows)' != 'true'">libhostfxr</HostFxrFileName>

Expand All @@ -73,6 +79,20 @@
<Exec Command="chmod +x $(TestHostRootPath)%(DotnetExe.Filename)%(DotnetExe.Extension)" Condition="'$(TargetOS)' != 'Windows_NT' and '$(OS)' != 'Windows_NT'"/>
</Target>

<Target Name="SetupRuntimePackNative"
Copy link
Member

Choose a reason for hiding this comment

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

Given this target is specific to Mono should we include Mono in the target name?

Copy link
Member

Choose a reason for hiding this comment

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

there are going to be some differences with desktop mono, so I'd like to address them in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

Do you have an issue tracking this work we can reference here?

Copy link
Member

Choose a reason for hiding this comment

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

Condition="'$(BinPlaceTestRuntimePack)' == 'true' and '$(RuntimeFlavor)' == 'Mono'"
AfterTargets="AfterResolveReferences">
<Copy SourceFiles="@(RuntimeFiles)"
mdh1418 marked this conversation as resolved.
Show resolved Hide resolved
DestinationFolder="$(NETCoreAppRuntimePackNativePath)"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(MonoCrossFiles)"
DestinationFolder="$(NETCoreAppRuntimePackNativePath)/cross"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(MonoIncludeFiles)"
DestinationFolder="$(NETCoreAppRuntimePackNativePath)/include/%(RecursiveDir)"
SkipUnchangedFiles="true" />
</Target>

<Target Name="OverrideRuntimeCoreCLR"
DependsOnTargets="ResolveRuntimeFilesFromLocalBuild"
AfterTargets="AfterResolveReferences;FilterNugetPackages"
Expand All @@ -89,7 +109,7 @@
DependsOnTargets="ResolveRuntimeFilesFromLocalBuild"
AfterTargets="AfterResolveReferences;FilterNugetPackages"
Condition="'$(RuntimeFlavor)' == 'Mono'">
<ItemGroup>
<ItemGroup Condition="'$(BinPlaceTestRuntimePack)' == ''">
mdh1418 marked this conversation as resolved.
Show resolved Hide resolved
<ReferenceCopyLocalPaths Include="@(RuntimeFiles)" />
</ItemGroup>
</Target>
Expand Down