From 8e45bf1fc19f87b465d659d8e5d288b170a9788d Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 4 Oct 2019 15:55:03 -0700 Subject: [PATCH] =?UTF-8?q?Enable=20using=20Live-live=20builds=20of=20Core?= =?UTF-8?q?CLR=20and=20CoreFX=20with=20Core-S=E2=80=A6=20(dotnet/core-setu?= =?UTF-8?q?p#8448)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Enable using a live CoreCLR build when building core-setup by passing a path to a CoreCLR product directory via /p:CoreCLROverridePath. * Enable using a live CoreFX build for Core-Setup restore. * Grab ucrt redist from CoreCLR output directory. * Fix overriding long-name DAC on CoreCLR-live build. * Don't add non-existent doc files to the list of doc files to package. * Add documentation about how to build with a local coreclr or corefx. * PR Feedback. * Extract out the overrides to a local targets file for the netcoreapp shared framework restore. Call out in the documentation of this build feature that it is only supported for the NETCoreApp shared framework. * Update src/pkg/projects/netcoreapp/src/localnetcoreapp.override.targets Co-Authored-By: Davis Goodin Commit migrated from https://github.com/dotnet/core-setup/commit/b903a6e815dbcec7acfeef39db1e9189fef7ed69 --- .../building/local-coreclr-corefx.md | 29 +++++ .../framework.dependency.targets | 19 ++- .../src/localnetcoreapp.override.targets | 118 ++++++++++++++++++ .../netcoreapp/src/netcoreapp.depproj | 3 +- 4 files changed, 162 insertions(+), 7 deletions(-) create mode 100644 docs/installer/building/local-coreclr-corefx.md create mode 100644 src/installer/pkg/projects/netcoreapp/src/localnetcoreapp.override.targets diff --git a/docs/installer/building/local-coreclr-corefx.md b/docs/installer/building/local-coreclr-corefx.md new file mode 100644 index 00000000000..a5fba3d04d1 --- /dev/null +++ b/docs/installer/building/local-coreclr-corefx.md @@ -0,0 +1,29 @@ +# Build Core-Setup with a Local CoreCLR or CoreFX + +## Testing with private CoreCLR bits + +Generally the Core-Setup build system gets the CoreCLR from a NuGet package which gets pulled down and correctly copied to the various output directories by building `src\pkg\projects\netcoreapp\src\netcoreapp.depproj` which gets built as part of `build.cmd/sh`. For folks that want to do builds and test runs in corefx with a local private build of coreclr you can follow these steps: + +1. Build CoreCLR and note your output directory. Ex: `\coreclr\bin\Product\Windows_NT.x64.Release\` Note this will vary based on your OS/Architecture/Flavor and it is generally a good idea to use Release builds for CoreCLR when building Core-Setup and the OS and Architecture should match what you are building in Core-Setup. +2. Build Core-Setup either passing in the `CoreCLROverridePath` property or setting it as an environment variable: + +```batch +build.cmd /p:CoreCLROverridePath=d:\git\coreclr\bin\Product\Windows_NT.x64.Release +``` + +By convention the project will look for PDBs in a directory under `$(CoreCLROverridePath)/PDB` and if found will also copy them. If not found no PDBs will be copied. If you want to explicitly set the PDB path then you can pass `CoreCLRPDBOverridePath` property to that PDB directory. +Once you have updated your CoreCLR you can run tests however you usually do and it should be using your copy of CoreCLR. +If you prefer, you can use a Debug build of System.Private.CoreLib, but if you do you must also use a Debug build of the native portions of the runtime, e.g. coreclr.dll. Tests with a Debug runtime will execute much more slowly than with Release runtime bits. This override is only enabled for building the NETCoreApp shared framework. + +## Testing with private CoreFX bits + +Similarly to how Core-Setup consumes CoreCLR, Core-Setup also consumes CoreFX from a NuGet package which gets pulled down and correctly copied to the various output directories by building `src\pkg\projects\netcoreapp\src\netcoreapp.depproj` which gets built as part of `build.cmd/sh`. To test with a local private build of CoreFX, you can follow these steps: + +1. Build CoreFX and note your configuration (Ex. Debug, Checked, Release). +2. Build Core-Setup either passing in the `CoreFXOverridePath` property or setting it as an environment variable (assuming your CoreFX repo is located at `d:\git\corefx`): + +```batch +build.cmd /p:CoreFXOverridePath=d:\git\corefx\artifacts\packages\Debug +``` + +The Core-Setup build will resolve the correct libraries to use to build the NETCoreApp shared framework based on the restored packages and will locate the files in the output directory based on the nuspec file of the shared-framework package in the local CoreFX build. This override does not enable using a local CoreFX build when creating the WindowsDesktop shared framework. diff --git a/src/installer/pkg/packaging-tools/framework.dependency.targets b/src/installer/pkg/packaging-tools/framework.dependency.targets index 3e7afc5483d..9d2eaabb6fa 100644 --- a/src/installer/pkg/packaging-tools/framework.dependency.targets +++ b/src/installer/pkg/packaging-tools/framework.dependency.targets @@ -251,10 +251,17 @@ <_diaSymReaderPackageDir>$(PackagesDir)microsoft.diasymreader.native/$(MicrosoftDiaSymReaderNativePackageVersion)/ + + <_crossHostArch>x86 + + + <_crossHostArch>x64 + + + <_crossHostArch>x64 + - <_crossDir Condition="'$(TargetArchitecture)' == 'arm' AND '$(OS)' == 'Windows_NT'">/x86_arm - <_crossDir Condition="'$(TargetArchitecture)' == 'arm' AND '$(OS)' != 'Windows_NT'">/x64_arm - <_crossDir Condition="'$(TargetArchitecture)' == 'arm64'">/x64_arm64 + <_crossDir Condition="'$(_crossHostArch)' != ''">/$(_crossHostArch)_$(TargetArchitecture) @@ -303,7 +310,7 @@ <_diaSymReaderToolDir>%(_diaSymReaderAssembly.RootDir)%(_diaSymReaderAssembly.Directory) - + + + + + + $(CoreCLROverridePath)/PDB + + + + + + + + @(CoreCLRFiles) + + + + %(PathInPackage) + + + + + + @(ShortNameDacFileOverride) + + + + true + + + + + + + + + + + + + + $(CoreFXOverridePath)/specs/$(MicrosoftPrivateCoreFxNETCoreAppPackage).nuspec + $(CoreFXOverridePath)/specs/runtime.$(PackageRID).$(MicrosoftPrivateCoreFxNETCoreAppPackage).nuspec + + + + + + + + + + + + + + + + + + + + + @(CoreFXReferenceItems) + + + + + + + @(CoreFXReferenceCopyLocalItems) + + + + true + + + + + + + + <_coreFXOverrideDocFiles + Condition="'$(CoreFXOverridePath)' != '' And '%(NuGetPackageId)' == '$(MicrosoftPrivateCoreFxNETCoreAppPackage)'" + Include="@(OverriddenFrameworkReferenceFiles->'$(CoreFXOverridePath)/../../bin/docs/%(FileName).xml')" /> + <_docFilesToPackage Include="@(_coreFXOverrideDocFiles)" Condition="Exists('%(Identity)')" /> + + + + + + <_runtimeDirectory>$(CoreCLROverridePath) + <_crossgenPath>$(CoreCLROverridePath)/crossgen$(ApplicationFileExtension) + <_coreLibDirectory>$(CoreCLROverridePath) + <_jitPath>$(CoreClrOverridePath)/$(_crossHostArch)/$(LibraryFilePrefix)clrjit$(LibraryFileExtension) + + + + + diff --git a/src/installer/pkg/projects/netcoreapp/src/netcoreapp.depproj b/src/installer/pkg/projects/netcoreapp/src/netcoreapp.depproj index 96c79dc4953..8e698d658f8 100644 --- a/src/installer/pkg/projects/netcoreapp/src/netcoreapp.depproj +++ b/src/installer/pkg/projects/netcoreapp/src/netcoreapp.depproj @@ -77,5 +77,6 @@ - + + -- GitLab