Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

AppHost: Support bundles (stage 1) - #5742

Merged
swaroop-sridhar merged 6 commits into
dotnet:masterfrom
swaroop-sridhar:host
Apr 14, 2019
Merged

AppHost: Support bundles (stage 1)#5742
swaroop-sridhar merged 6 commits into
dotnet:masterfrom
swaroop-sridhar:host

Conversation

@swaroop-sridhar

@swaroop-sridhar swaroop-sridhar commented Apr 9, 2019

Copy link
Copy Markdown

This changes implements the app-host support for executing .net core apps published as a single file.

This change implements stage 1, which extracts out the embedded files to disk.

On startup, the AppHost detects whether it's own binary is a .net core bundle.
If so, on the first run, the host extracts embedded files to:

  • $DOTNET_BUNDLE_EXTRACT_BASE_DIR/app/id/... if DOTNET_BUNDLE_EXTRACT_BASE_DIR is set
  • $TMPDIR/.net/app/id/... otherwise.

On subsequent runs, the files extracted above are reused.

AppHost (X64) size increase:
Windows 5KB, Linux 11KB, Mac 6KB

Testing:
Tested the single-file extraction locally with several kinds of dotnet apps
(wpf, winforms, web, mvc, console, etc.)
Added a test case that runs a bundled apps with sub directories

Comment thread src/corehost/cli/bdl_file_entry.h Outdated
Comment thread src/corehost/cli/bdl_file_entry.cpp Outdated
Comment thread src/corehost/cli/bdl_file_entry.cpp Outdated
Comment thread src/corehost/cli/bdl_file_entry.cpp Outdated
Comment thread src/corehost/cli/bdl_file_entry.cpp Outdated
Comment thread src/corehost/common/pal.windows.cpp Outdated
Comment thread src/corehost/corehost.cpp Outdated
Comment thread src/corehost/corehost.cpp Outdated
Comment thread src/corehost/corehost.cpp Outdated
Comment thread src/corehost/corehost.cpp Outdated
@swaroop-sridhar

Copy link
Copy Markdown
Author

Thanks for the detailed feedback @vitek-karas.

Comment thread src/corehost/corehost.cpp
@swaroop-sridhar

Copy link
Copy Markdown
Author

@vitek-karas I've committed the changes except file renames/moves in this change d181371
I'll commit another change that does the file moves, because that obscures the diffing. Thanks.

@swaroop-sridhar

Copy link
Copy Markdown
Author

@vitek-karas with the latest commit, I believe I've addressed all of your comments. Thanks.

Comment thread src/corehost/common/pal.windows.cpp Outdated
Comment thread src/corehost/corehost.cpp Outdated
Comment thread src/corehost/cli/bdl_processor.cpp
Comment thread src/corehost/cli/apphost/CMakeLists.txt
Comment thread src/corehost/cli/apphost/CMakeLists.txt Outdated
@swaroop-sridhar

Copy link
Copy Markdown
Author

Thanks @vitek-karas, I've addressed your comments in this checkin: 2f379ec

@vitek-karas vitek-karas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@swaroop-sridhar
swaroop-sridhar force-pushed the host branch 2 times, most recently from 679d686 to fe3316a Compare April 13, 2019 03:11
swaroop-sridhar and others added 6 commits April 13, 2019 16:35
This changes implements the [app-host support](https://github.com/dotnet/designs/blob/master/accepted/single-file/design.md#the-host )
for executing .net core apps published as a single file.

This change implements [stage 1](https://github.com/dotnet/designs/blob/master/accepted/single-file/staging.md#1-self-extractor),
which [extracts out](https://github.com/dotnet/designs/blob/master/accepted/single-file/extract.md ) the embedded files to disk.

On startup, the AppHost detects whether it's own binary is a .net core bundle.
If so, on the first run, the host extracts embedded files to:
  * $DOTNET_BUNDLE_EXTRACT_BASE_DIR/.net/<app>/<id>/... if DOTNET_BUNDLE_EXTRACT_BASE_DIR is set
  * $TMPDIR/.net/<app>/<id>/... otherwise.

On subsequent runs, the files extracted above are reused.

AppHost (X64) size increase:
Windows 5KB
Linux 11KB
Mac 6KB

Testing:
Tested the single-file extraction locally with several kinds of dotnet apps
(wpf, winforms, web, mvc, console, etc.)
Added a test case that runs a bundled apps with sub directories

Add a test for processing bundles
* Use spaces instead of tabs for indentation
* Fix trace messages
* Fix some rebasing problems
* Improve pal::get_temp_dir() on windows.
* Fix a few minor issues (function ordering etc)
* Read/Write file extraction in 8KB chunks
* Also fix a bug in the extractor for a similar issue.
* Rename bundle processor to bundle runner
On Ubuntu, $TMPDIR is not set. So, add an option to try
/var/tmp or /tmp directories.
@swaroop-sridhar

Copy link
Copy Markdown
Author

@vitek-karas I had to make another small change: 3de5b31 to get tmp-directory on Ubuntu.

@swaroop-sridhar
swaroop-sridhar merged commit 4a01e55 into dotnet:master Apr 14, 2019
@swaroop-sridhar

Copy link
Copy Markdown
Author

@vitek-karas, I merged the change, in order to facilitate its flow into SDK repo, where I have other changes to be tested with this AppHost. If you have any concerns with 3de5b31, I'll address it separately. I'm also planning to put out another PR with more test cases.

@swaroop-sridhar
swaroop-sridhar deleted the host branch April 14, 2019 06:32
@vitek-karas

Copy link
Copy Markdown
Member

@swaroop-sridhar Thanks! LGTM

picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
* AppHost: Support bundles (stage 1)

This changes implements the [app-host support](https://github.com/dotnet/designs/blob/master/accepted/single-file/design.md#the-host )
for executing .net core apps published as a single file.

This change implements [stage 1](https://github.com/dotnet/designs/blob/master/accepted/single-file/staging.mddotnet/core-setup#1-self-extractor),
which [extracts out](https://github.com/dotnet/designs/blob/master/accepted/single-file/extract.md ) the embedded files to disk.

On startup, the AppHost detects whether it's own binary is a .net core bundle.
If so, on the first run, the host extracts embedded files to:
  * if `DOTNET_BUNDLE_EXTRACT_BASE_DIR` is set, to `$DOTNET_BUNDLE_EXTRACT_BASE_DIR/.net/<app>/<id>/...` . Otherwise, 
  * On Windows, to `%TEMP%/.net/<app>/<id>/...`
  * On Unix systems, if `$TMPDIR` is set, to `$TMPDIR/.net/<app>/<id>/...` . Otherwise to `/var/tmp` or `/tmp` if those paths are available and accessible.

On subsequent runs, the files extracted above are reused.

AppHost (X64) size increase:
Windows 5KB
Linux 11KB
Mac 6KB

Testing:
Tested the single-file extraction locally with several kinds of dotnet apps
(wpf, winforms, web, mvc, console, etc.)
Added a test case that runs a bundled apps with sub directories
Also fixed a bug in the Microsoft.NET.HostModel.extractor wrt processing bundled files in chunks.


Commit migrated from dotnet/core-setup@4a01e55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants