Skip to content

Create Microsoft.NetCore.App.Ref targeting pack for NetCoreAppCurrent in libraries #37600

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 9 commits into from
Jun 9, 2020
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
2 changes: 1 addition & 1 deletion eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>fef373440d604c428950236fbc2b99ce0df368a9</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk" Version="5.0.0-beta.20280.1">
<Dependency Name="Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk" Version="5.0.0-beta.20308.5">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>fef373440d604c428950236fbc2b99ce0df368a9</Sha>
</Dependency>
Expand Down
18 changes: 9 additions & 9 deletions eng/testing/tests.mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<AndroidAbi Condition="'$(TargetArchitecture)' == 'x86'">x86</AndroidAbi>
</PropertyGroup>

<Error Condition="!Exists('$(RuntimePackRidDir)')" Text="RuntimePackRidDir=$(RuntimePackRidDir) doesn't exist" />
<Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" />

<!-- TEMP: consume OpenSSL binaries from external sources via env. variables -->
<Copy Condition="'$(ANDROID_OPENSSL_AAR)' != ''"
Expand All @@ -36,7 +36,7 @@
<AndroidAppBuilderTask
Abi="$(AndroidAbi)"
ProjectName="$(AssemblyName)"
MonoRuntimeHeaders="$(RuntimePackNativeDir)include\mono-2.0"
MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0"
MainLibraryFileName="AndroidTestRunner.dll"
StripDebugSymbols="False"
OutputDir="$(BundleDir)"
Expand All @@ -59,7 +59,7 @@
<Import Project="$(MonoAOTCompilerDir)MonoAOTCompiler.props" />

<Target Condition="'$(TargetOS)' == 'iOS'" Name="BundleTestAppleApp">
<Error Condition="!Exists('$(RuntimePackRidDir)')" Text="RuntimePackRidDir=$(RuntimePackRidDir) doesn't exist" />
<Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" />
<Error Condition="('$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm') and '$(DevTeamProvisioning)' == ''"
Text="'DevTeamProvisioning' needs to be set for device builds. Set it to 'UBF8T346G9' if you're part of the Microsoft team account." />

Expand All @@ -74,12 +74,12 @@
</ItemGroup>

<MonoAOTCompiler Condition="'$(RunAOTCompilation)' == 'true'"
CompilerBinaryPath="$(RuntimePackNativeDir)cross\mono-aot-cross"
CompilerBinaryPath="$(MicrosoftNetCoreAppRuntimePackNativeDir)cross\mono-aot-cross"
Mode="Full"
OutputType="AsmOnly"
Assemblies="@(AotInputAssemblies)"
UseLLVM="$(MonoEnableLLVM)"
LLVMPath="$(RuntimePackNativeDir)cross">
LLVMPath="$(MicrosoftNetCoreAppRuntimePackNativeDir)cross">
<Output TaskParameter="CompiledAssemblies" ItemName="BundleAssemblies" />
</MonoAOTCompiler>

Expand All @@ -89,7 +89,7 @@
<AppleAppBuilderTask
Arch="$(TargetArchitecture)"
ProjectName="$(AssemblyName)"
MonoRuntimeHeaders="$(RuntimePackNativeDir)include\mono-2.0"
MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\mono-2.0"
Assemblies="@(BundleAssemblies)"
MainLibraryFileName="AppleTestRunner.dll"
UseConsoleUITemplate="True"
Expand All @@ -114,10 +114,10 @@
<ItemGroup>
<AssemblySearchPaths Include="$(PublishDir)"/>
</ItemGroup>
<Error Condition="!Exists('$(RuntimePackRidDir)')" Text="RuntimePackRidDir=$(RuntimePackRidDir) doesn't exist" />
<Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" />
<WasmAppBuilder
AppDir="$(BundleDir)"
RuntimePackDir="$(RuntimePackRidDir)"
MicrosoftNetCoreAppRuntimePackDir="$(MicrosoftNetCoreAppRuntimePackRidDir)"
MainAssembly="$(PublishDir)\WasmTestRunner.dll"
MainJS="$(MonoProjectRoot)\wasm\runtime-test.js"
ExtraAssemblies="$(PublishDir)\$(AssemblyName).dll"
Expand All @@ -144,7 +144,7 @@
<Target Name="UpdateRuntimePack"
DependsOnTargets="AddFrameworkReference;ResolveFrameworkReferences">
<ItemGroup>
<ResolvedRuntimePack Update="@(ResolvedRuntimePack)" PackageDirectory="$(RuntimePackDir)" />
<ResolvedRuntimePack Update="@(ResolvedRuntimePack)" PackageDirectory="$(MicrosoftNetCoreAppRuntimePackDir)" />
</ItemGroup>
</Target>

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"python3": "3.7.1"
},
"msbuild-sdks": {
"Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "5.0.0-beta.20280.1",
"Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "5.0.0-beta.20308.5",
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20280.1",
"Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk": "5.0.0-beta.20280.1",
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20280.1",
Expand Down
15 changes: 8 additions & 7 deletions src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,14 @@

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

<RuntimePackDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'lib-runtime-packs', '$(BuildSettings)'))</RuntimePackDir>
<RuntimePackRidDir>$([MSBuild]::NormalizeDirectory('$(RuntimePackDir)', 'runtimes', '$(PackageRID)'))</RuntimePackRidDir>
<RuntimePackLibDir>$([MSBuild]::NormalizeDirectory('$(RuntimePackRidDir)', 'lib', '$(NetCoreAppCurrent)'))</RuntimePackLibDir>
<RuntimePackNativeDir>$([MSBuild]::NormalizeDirectory('$(RuntimePackRidDir)', 'native'))</RuntimePackNativeDir>
<RuntimePackTargetFrameworkPath>runtimes/$(PackageRID)</RuntimePackTargetFrameworkPath>
<MicrosoftNetCoreAppRefPackDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.ref', '$(Configuration)'))</MicrosoftNetCoreAppRefPackDir>
<MicrosoftNetCoreAppRefPackRefDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'ref'))</MicrosoftNetCoreAppRefPackRefDir>
<MicrosoftNetCoreAppRefPackDataDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'data'))</MicrosoftNetCoreAppRefPackDataDir>

<MicrosoftNetCoreAppRuntimePackDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.runtime.$(PackageRID)', '$(Configuration)'))</MicrosoftNetCoreAppRuntimePackDir>
Copy link
Member

Choose a reason for hiding this comment

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

could we lift this to some global .props, so we don't need to duplicate it in the iOS/Android/WASM sample .csprojs?

Copy link
Member Author

Choose a reason for hiding this comment

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

@steveisok mentioned that eventually the sample projects will be moved into libraries IIRC

<MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackDir)', 'runtimes', '$(PackageRID)'))</MicrosoftNetCoreAppRuntimePackRidDir>
Copy link
Member

Choose a reason for hiding this comment

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

NIT: Do we really need to rename all these variables? Seems like the only runtime pack we are producing is for netcoreapp anyways and we are only really using it in very few places so not sure if we are gaining much by making the property names longer. (Of course I specifically ask this because my linker test functionality depends on the property :+1 but I'm happy to change it if the decision is to rename)

Copy link
Member Author

Choose a reason for hiding this comment

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

I prefer an unambiguous meaning as we might introduce a second runtime pack in the future for assets outside of microsoft.netcore.app when we decide to clean the current runtime pack up to only include assets that are part of the shared framework to actually test what we are shipping.

<MicrosoftNetCoreAppRuntimePackRidLibTfmDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'lib', '$(NetCoreAppCurrent)'))</MicrosoftNetCoreAppRuntimePackRidLibTfmDir>
<MicrosoftNetCoreAppRuntimePackNativeDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'native'))</MicrosoftNetCoreAppRuntimePackNativeDir>

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

Expand Down Expand Up @@ -302,8 +305,6 @@
<BinPlaceTestSharedFramework Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)'">true</BinPlaceTestSharedFramework>
<BinPlaceNETFXRuntime Condition="'$(BuildTargetFramework)' == '$(NetFrameworkCurrent)'">true</BinPlaceNETFXRuntime>

<BinPlaceTestRuntimePack Condition="'$(RuntimeFlavor)' == 'Mono'">true</BinPlaceTestRuntimePack>

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

<TestHostRuntimePath Condition="'$(BinPlaceTestSharedFramework)' == 'true'">$(NETCoreAppTestSharedFrameworkPath)</TestHostRuntimePath>
Expand Down
34 changes: 20 additions & 14 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<IsNETCoreAppRef Condition="'$(IsNETCoreAppRef)' == ''">$(IsNETCoreApp)</IsNETCoreAppRef>
<IsNetFxNETStandardRef Condition="'$(IsNetFxNETStandardRef)' == ''">$(IsNetFxNETStandard)</IsNetFxNETStandardRef>

<BinPlaceRef Condition="'$(BinPlaceRef)' == '' And ('$(IsReferenceAssembly)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRef>
<BinPlaceRuntime Condition="'$(BinPlaceRuntime)' == '' And ('$(IsRuntimeAssembly)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRuntime>
<BinPlaceRef Condition="'$(BinPlaceRef)' == '' and ('$(IsReferenceAssembly)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRef>
<BinPlaceRuntime Condition="'$(BinPlaceRuntime)' == '' and ('$(IsRuntimeAssembly)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRuntime>
<BinPlaceForTargetVertical Condition="'$(BinPlaceForTargetVertical)' == ''">true</BinPlaceForTargetVertical>
<AllTargetFrameworks>net45;net451;net46;net461;net462;net47;net471;net472;netstandard1.0;netstandard1.1;netstandard1.2;netstandard1.3;netstandard1.4;netstandard1.5;netstandard1.6;netstandard2.0;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;$(netcoreappCurrent);</AllTargetFrameworks>
</PropertyGroup>
Expand All @@ -60,15 +60,18 @@
<ItemGroup Condition="'@(BinPlaceTargetFrameworks)' == ''">
<!-- binplace to directories for the target vertical -->
<BinPlaceTargetFrameworks Include="$(BuildTargetFramework)-$(TargetOS)" Condition="'$(BinPlaceForTargetVertical)' == 'true'">
<NativePath>$(RuntimePath)</NativePath>
<RefPath>$(BuildTargetFrameworkRefPath)</RefPath>
<RuntimePath>$(RuntimePath)</RuntimePath>
</BinPlaceTargetFrameworks>
<!-- binplace to directories for packages -->
<BinPlaceTargetFrameworks Condition="'$(IsNETCoreApp)' == 'true' and '$(BuildingNETCoreAppVertical)' == 'true'" Include="$(NetCoreAppCurrent)-$(TargetOS)">
<PackageFileNativePath>$(NETCoreAppPackageRuntimePath)</PackageFileNativePath>
<PackageFileRefPath Condition="'$(IsNETCoreAppRef)' == 'true'">$(NETCoreAppPackageRefPath)</PackageFileRefPath>
<PackageFileRuntimePath>$(NETCoreAppPackageRuntimePath)</PackageFileRuntimePath>
<RuntimePath Condition="'$(BinPlaceNETCoreAppPackage)' == 'true'">$(NETCoreAppPackageRuntimePath)\..\runtime\$(TargetOS)-$(Configuration)-$(TargetArchitecture)</RuntimePath>
<NativePath Condition="'$(BinPlaceNETCoreAppPackage)' == 'true'">$(NETCoreAppPackageRuntimePath)\..\runtime\$(TargetOS)-$(Configuration)-$(TargetArchitecture)</NativePath>
<RefPath Condition="'$(BinPlaceNETCoreAppPackage)' == 'true' and '$(IsNETCoreAppRef)' == 'true'">$(RefRootPath)microsoft.netcore.app\$(Configuration)</RefPath>
<RuntimePath Condition="'$(BinPlaceNETCoreAppPackage)' == 'true'">$(NETCoreAppPackageRuntimePath)\..\runtime\$(TargetOS)-$(Configuration)-$(TargetArchitecture)</RuntimePath>
<!-- enable trimming for any runtime project that's part of the shared framework and hasn't already set ILLinkTrimAssembly -->
<SetProperties Condition="'$(BinPlaceRuntime)' == 'true' and '$(ILLinkTrimAssembly)' == ''">ILLinkTrimAssembly=true</SetProperties>
</BinPlaceTargetFrameworks>
Expand All @@ -79,29 +82,31 @@

<!-- Setup the shared framework directory for testing -->
<BinPlaceTargetFrameworks Condition="'$(BinPlaceTestSharedFramework)' == 'true'" Include="$(NetCoreAppCurrent)-$(TargetOS)">
<NativePath>$(NETCoreAppTestSharedFrameworkPath)</NativePath>
<RuntimePath>$(NETCoreAppTestSharedFrameworkPath)</RuntimePath>
</BinPlaceTargetFrameworks>
<BinPlaceTargetFrameworks Condition="'$(BinPlaceNETFXRuntime)' == 'true'" Include="$(NetFrameworkCurrent)-Windows_NT">
<NativePath>$(TestHostRootPath)</NativePath>
<RuntimePath>$(TestHostRootPath)</RuntimePath>
</BinPlaceTargetFrameworks>

<!-- Setup the runtime pack structure for mobile platforms (for testing and installer) -->
<!-- Corresponding assemblies are added to lib -->
<BinPlaceTargetFrameworks Condition="'$(BinPlaceTestRuntimePack)' == 'true'" Include="$(NetCoreAppCurrent)-$(TargetOS)">
<RuntimePath>$(RuntimePackLibDir)</RuntimePath>
<!-- Microsoft.NetCore.App.Ref targeting pack -->
<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)">
<RefPath Condition="'$(IsNETCoreAppRef)' == 'true'">$(MicrosoftNetCoreAppRefPackRefDir)</RefPath>
</BinPlaceTargetFrameworks>
<!-- Corresponding libMono and system.native libraries are added to native -->
<BinPlaceTargetFrameworks Condition="'$(BinPlaceTestRuntimePack)' == 'true'" Include="$(NetCoreAppCurrent)-$(TargetOS)">
<RuntimePath>$(RuntimePackNativeDir)</RuntimePath>
<ItemName>NativeBinPlaceItem</ItemName>

<!-- Microsoft.NetCore.App.Runtime targeting pack -->
<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)-$(TargetOS)">
<NativePath>$(MicrosoftNetCoreAppRuntimePackNativeDir)</NativePath>
<RuntimePath>$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)</RuntimePath>
</BinPlaceTargetFrameworks>
<!-- Corresponding libMono and system.native libraries are added to testhost shared framework -->
<BinPlaceTargetFrameworks Condition="'$(BinPlaceTestRuntimePack)' == 'true' and '$(TargetsMobile)' != 'true'" Include="$(NetCoreAppCurrent)-$(TargetOS)">
<RuntimePath>$(TestHostRuntimePath)</RuntimePath>
<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)-$(TargetOS)"
Condition="'$(BinPlaceTestSharedFramework)' == 'true'">
<NativePath>$(NETCoreAppTestSharedFrameworkPath)</NativePath>
<ItemName>TestHostBinPlaceItem</ItemName>
</BinPlaceTargetFrameworks>


<!-- binplace targeting packs which may be different from Build TargetFramework -->
<BinPlaceTargetFrameworks Include="netstandard2.0">
<RefPath>$(NetStandard20RefPath)</RefPath>
Expand All @@ -120,6 +125,7 @@
</BinPlaceTargetFrameworks>
<!-- for BuildAllConfigurations make sure runtimepaths are created for all vertical target frameworks. -->
<BinPlaceTargetFrameworks Condition="'$(BuildAllConfigurations)' == 'true' and ('$(BinPlaceForTargetVertical)' == 'true' or ('$(TargetFramework)' != '$(NetCoreAppCurrent)' and '$(TargetFrameworkSuffix)' == ''))" Include="$(NetCoreAppCurrent)-$(TargetOS)">
<NativePath>$(ArtifactsBinDir)runtime/%(Identity)-$(Configuration)-$(TargetArchitecture)</NativePath>
<RuntimePath>$(ArtifactsBinDir)runtime/%(Identity)-$(Configuration)-$(TargetArchitecture)</RuntimePath>
</BinPlaceTargetFrameworks>

Expand Down
33 changes: 17 additions & 16 deletions src/libraries/Native/native-binplace.proj
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,31 @@
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);netstandard2.0;$(NetFrameworkCurrent)</TargetFrameworks>
<TargetFramework>$(BuildTargetFramework)</TargetFramework>
<BinPlaceRuntime>false</BinPlaceRuntime>
<BinPlaceNative>true</BinPlaceNative>
</PropertyGroup>

<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />

<!-- Ordering matters! Overriding GetBinPlaceItems and Build targets after the Sdk import. -->
<Target Name="GetBinPlaceItems">
<ItemGroup>
<NativeBinPlaceItem Include="$(NativeBinDir)*.dll" />
<NativeBinPlaceItem Include="$(NativeBinDir)*.pdb" />
<NativeBinPlaceItem Include="$(NativeBinDir)*.lib" />
<NativeBinPlaceItem Include="$(NativeBinDir)*.a" />
<NativeBinPlaceItem Include="$(NativeBinDir)*.bc" />
<NativeBinPlaceItem Include="$(NativeBinDir)*.so" />
<NativeBinPlaceItem Include="$(NativeBinDir)*.dbg" />
<NativeBinPlaceItem Include="$(NativeBinDir)*.dylib" />
<NativeBinPlaceItem Include="$(NativeBinDir)*.dwarf" />
<NativeBinPlaceItem Condition="'$(TargetOS)' == 'Browser'" Include="$(NativeBinDir)dotnet.js" />
<NativeBinPlaceItem Condition="'$(TargetOS)' == 'Browser'" Include="$(NativeBinDir)dotnet.wasm" />

<BinPlaceItem Condition="'$(BinPlaceTestRuntimePack)' != 'true'" Include="@(NativeBinPlaceItem)" />
<FileWrites Include="@(NativeBinPlaceItem)" />
<BinPlaceItem Include="$(NativeBinDir)*.dll" />
<BinPlaceItem Include="$(NativeBinDir)*.pdb" />
<BinPlaceItem Include="$(NativeBinDir)*.lib" />
<BinPlaceItem Include="$(NativeBinDir)*.a" />
<BinPlaceItem Include="$(NativeBinDir)*.bc" />
<BinPlaceItem Include="$(NativeBinDir)*.so" />
<BinPlaceItem Include="$(NativeBinDir)*.dbg" />
<BinPlaceItem Include="$(NativeBinDir)*.dylib" />
<BinPlaceItem Include="$(NativeBinDir)*.dwarf" />
<BinPlaceItem Condition="'$(TargetOS)' == 'Browser'" Include="$(NativeBinDir)dotnet.js" />
<BinPlaceItem Condition="'$(TargetOS)' == 'Browser'" Include="$(NativeBinDir)dotnet.wasm" />
<FileWrites Include="@(BinPlaceItem)" />
</ItemGroup>
<ItemGroup Condition="'$(BinPlaceTestRuntimePack)' == 'true' and '$(TargetsMobile)' != 'true'">
<TestHostBinPlaceItem Include="%(NativeBinPlaceItem.Identity)" />

<ItemGroup Condition="'$(RuntimeFlavor)' == 'Mono' and '$(TargetsMobile)' != 'true'">
<TestHostBinPlaceItem Include="@(BinPlaceItem)" />
<FileWrites Include="@(TestHostBinPlaceItem)" />
</ItemGroup>
</Target>
Expand Down
Loading