Build an apphost with hostfxr and hostpolicy linked in (#36230)
authorVladimir Sadov <vsadov@microsoft.com>
Fri, 15 May 2020 22:01:32 +0000 (15:01 -0700)
committerGitHub <noreply@github.com>
Fri, 15 May 2020 22:01:32 +0000 (15:01 -0700)
commit26661be4909461a224dd561c24cb3ca81f0e291c
tree7a4946340ef8eabfc1018b35a7fdf63c64575251
parentc7a246c000747ec728ac862b7a503348b103df0e
Build an apphost with hostfxr and hostpolicy linked in (#36230)

* hostfxr: Build most of hostfxr as a static library

This is part of the work to create an apphost that bundles both hostfxr
and hostpolicy.  The main distinction between the static and shared
versions of hostfxr is that the static version contains a hostpolicy
resolver that references the hostpolicy symbols directly rather than
loading them from a DLL.

* hostpolicy: Build as a static library

This change is part of the work to enable an apphost that bundles both
hostfxr and hostpolicy.  There's no distinction between hostpolicy
that's built as a shared library and as a static library: the shared
library is built by linking an empty object file with the static
library.

* corehost: Allow linking of hostfxr and hostpolicy with apphost

Provide a hostfxr_iface class, that abstracts how the hostfxr functions called
by the early stage in the hosting layer is resolved.

* dotnet: Teach the muxer binary about hostfxr_iface

* apphost: Teach apphost about hostfxr_iface

This provides two implementations of hostfxr_iface: one for the static
apphost, which bundles hostfxr and hostpolicy, and another for the
conventional apphost, which loads them dynamically on startup.

* Add exports for hostfxr and policy

* Exports for unix

* EXPORTS_LINKER_OPTION

* use generateversionscript.awk from ENG

* Move fxr files out of static

* Fixes for Linux

* Fix for   win-x86

* move HEADERS next to SOURCES similarly to other files.

* PR feedback (simplifying hostpolicy_resolver::try_get_dir for static host)

* Publish static_apphost to Microsoft.NETCore.App.Host

* bind to entry points without probing, when in a static host.

* Add a test case

* renamed hostfxr_iface --> hostfxr_resolver_t

* renamed shared --> standalone

* rename static_apphost --> singlefilehost

* Signing exclusions for singlefilehost

* switched StaticHost tst to a different asset (mostly a copy of StandaloneApp)

* get_method_module_path

Co-authored-by: Leandro Pereira <leandro.pereira@microsoft.com>
Co-authored-by: Swaroop Sridhar <swaroop.sridhar@microsoft.com>
39 files changed:
eng/SignCheckExclusionsFile.txt
eng/Signing.props
eng/native/functions.cmake
eng/native/generateexportedsymbols.awk [moved from src/coreclr/generateexportedsymbols.awk with 100% similarity]
eng/native/generateversionscript.awk [moved from src/coreclr/generateversionscript.awk with 100% similarity]
src/installer/corehost/cli/CMakeLists.txt
src/installer/corehost/cli/apphost/CMakeLists.txt
src/installer/corehost/cli/apphost/standalone/CMakeLists.txt [new file with mode: 0644]
src/installer/corehost/cli/apphost/standalone/hostfxr_resolver_t.cpp [new file with mode: 0644]
src/installer/corehost/cli/apphost/static/CMakeLists.txt [new file with mode: 0644]
src/installer/corehost/cli/apphost/static/hostfxr_resolver_t.cpp [new file with mode: 0644]
src/installer/corehost/cli/apphost/static/hostpolicy_resolver.cpp [new file with mode: 0644]
src/installer/corehost/cli/dotnet/CMakeLists.txt
src/installer/corehost/cli/exe.cmake
src/installer/corehost/cli/fxr/CMakeLists.txt
src/installer/corehost/cli/fxr/fx_muxer.cpp
src/installer/corehost/cli/fxr/hostfxr.cpp
src/installer/corehost/cli/fxr/hostpolicy_resolver.h
src/installer/corehost/cli/fxr/standalone/CMakeLists.txt [new file with mode: 0644]
src/installer/corehost/cli/fxr/standalone/hostfxr.def [new file with mode: 0644]
src/installer/corehost/cli/fxr/standalone/hostfxr_unixexports.src [new file with mode: 0644]
src/installer/corehost/cli/fxr/standalone/hostpolicy_resolver.cpp [moved from src/installer/corehost/cli/fxr/hostpolicy_resolver.cpp with 97% similarity]
src/installer/corehost/cli/fxr/static/CMakeLists.txt [new file with mode: 0644]
src/installer/corehost/cli/hostmisc/pal.h
src/installer/corehost/cli/hostmisc/pal.unix.cpp
src/installer/corehost/cli/hostmisc/pal.windows.cpp
src/installer/corehost/cli/hostpolicy/CMakeLists.txt
src/installer/corehost/cli/hostpolicy/standalone/CMakeLists.txt [new file with mode: 0644]
src/installer/corehost/cli/hostpolicy/standalone/hostpolicy.def [new file with mode: 0644]
src/installer/corehost/cli/hostpolicy/standalone/hostpolicy_unixexports.src [new file with mode: 0644]
src/installer/corehost/cli/hostpolicy/static/CMakeLists.txt [new file with mode: 0644]
src/installer/corehost/cli/lib_static.cmake
src/installer/corehost/corehost.cpp
src/installer/corehost/hostfxr_resolver_t.h [new file with mode: 0644]
src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/runtime.Windows_NT.Microsoft.NETCore.DotNetAppHost.props
src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Host.pkgproj
src/installer/test/Assets/TestProjects/StaticHostApp/Program.cs [new file with mode: 0644]
src/installer/test/Assets/TestProjects/StaticHostApp/StaticHostApp.csproj [new file with mode: 0644]
src/installer/test/Microsoft.NET.HostModel.Tests/AppHost.Bundle.Tests/StaticHost.cs [new file with mode: 0644]