diff options
author | Swaroop Sridhar <Swaroop.Sridhar@microsoft.com> | 2020-04-08 21:35:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-08 21:35:03 +0300 |
commit | 78b303df8fbb242985d049a277d0d199cafd51b5 (patch) | |
tree | 818486bcb7fb9260793378015d8af40f4d190765 /src/installer/corehost/cli/fxr/hostfxr.cpp | |
parent | f4375ecb7c4a7cf6394b28dd74255ae71830efde (diff) |
Single-File: Process bundles in the framework (#34274)
* Single-File: Process bundles in the framework
This change implements the host changes proposed in the [design](https://github.com/dotnet/designs/blob/master/accepted/2020/single-file/design.md#startup)
The main changes for single-file bundles are:
* Bundle processing code is moved from apphost to hostpolicy
* HostFxr and HostPolicy process deps.json and runtimeconfig.json files directly from the bundle.
* HostPolicy performs verification wrt deps.json based on the contents of the single-file bundle.
* AppContext.BaseDirectory is set as explained [here](https://github.com/dotnet/designs/blob/master/accepted/2020/single-file/design.md#appcontextbasedirectory)
Currently, all files except deps.json and runtimeconfig.json are extracted to disk.
Once the runtime is able to processing assemblies directly from the bundle, they will no longer be extracted.
Notable details:
* The bundle driver (formarly runner.cpp) is divided into two parts:
* bundle::info which describes basic information about the bundle available from the headers only
* bundle::runner which has information about all embedded files, and the ability to drive extraction
This facilitates linking only parts of the bundle handling code with hostfxr, while all code is linked with hostpolicy.
* The AppHost only links with bundle_marker to identify itself as a single-file bundle.
* If the AppHost is a single-file bundle, it notifies hostfxr using the new hostfxr_main_bundle_startup_info() API
* The HostFxr comminucates the single-file-information with HostPolicy using the host_interface_t structure.
Fixes https://github.com/dotnet/runtime/issues/32821
Diffstat (limited to 'src/installer/corehost/cli/fxr/hostfxr.cpp')
-rw-r--r-- | src/installer/corehost/cli/fxr/hostfxr.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/installer/corehost/cli/fxr/hostfxr.cpp b/src/installer/corehost/cli/fxr/hostfxr.cpp index c9a346b799b..1fdfa210489 100644 --- a/src/installer/corehost/cli/fxr/hostfxr.cpp +++ b/src/installer/corehost/cli/fxr/hostfxr.cpp @@ -14,6 +14,7 @@ #include "sdk_resolver.h" #include "hostfxr.h" #include "host_context.h" +#include "bundle/info.h" namespace { @@ -24,6 +25,23 @@ namespace } } +SHARED_API int HOSTFXR_CALLTYPE hostfxr_main_bundle_startupinfo(const int argc, const pal::char_t* argv[], const pal::char_t* host_path, const pal::char_t* dotnet_root, const pal::char_t* app_path, int64_t bundle_header_offset) +{ + trace_hostfxr_entry_point(_X("hostfxr_main_bundle_startupinfo")); + + StatusCode bundleStatus = bundle::info_t::process_bundle(host_path, app_path, bundle_header_offset); + if (bundleStatus != StatusCode::Success) + { + trace::error(_X("A fatal error occured while processing application bundle")); + return bundleStatus; + } + + host_startup_info_t startup_info(host_path, dotnet_root, app_path); + + return fx_muxer_t::execute(pal::string_t(), argc, argv, startup_info, nullptr, 0, nullptr); +} + + SHARED_API int HOSTFXR_CALLTYPE hostfxr_main_startupinfo(const int argc, const pal::char_t* argv[], const pal::char_t* host_path, const pal::char_t* dotnet_root, const pal::char_t* app_path) { trace_hostfxr_entry_point(_X("hostfxr_main_startupinfo")); |