Build the Bundler as a library (dotnet/core-setup#5798)
authorSwaroop Sridhar <Swaroop.Sridhar@microsoft.com>
Fri, 12 Apr 2019 04:17:18 +0000 (21:17 -0700)
committerGitHub <noreply@github.com>
Fri, 12 Apr 2019 04:17:18 +0000 (21:17 -0700)
commitdffaad78314044072068d8e253a51ef28e66b14a
treeb1ffd65a83070fae787164c9e764dfa262373db8
parentd2873470af5aa83b3fad9ca0ea1f48f7f2167a1c
Build the Bundler as a library (dotnet/core-setup#5798)

* Build the Bundler as a library

Currently, the single-file bundler is
* Built as an app instead of a library
* Invoked from the SDK out-of-proc in order to enforce strict API boundaries

However, since the SDK implementation progressed, we've had to revisit the above decisions.

First, the bundler currently is implemented to take a folder vs a list of files to bundle.
* This causes unnecessary extra copies to the publish directory.
    * The files to be bundled need not be first copied to the publish directory.
    * Instead they can be written directly to the bundle.
* Stale items remaining in the publish directory may be written into the bundle unnecessarily.

Therefore, we decided that the bundler should take tuples of (source file-path, relative-path within bundle) instead of the publish folder as input.
* While it is possible to provide this input on the command-line/response file, it is convenient and more efficient to do it in-proc.
* Further, the SDK team agrees that the bundler is simple enough to run in-proc with the build system.

Therefore, the changes proposed are:
* Bundler will be built into a library Microsoft.NET.HostModel in core-setup repo (similar to DependencyModel)
    * It is not a task directly because we don't have to worry about multi-targeting
    * Other apphost related services like stamping the app.dll name into the apphost will be moded into this library
* A task in the SDK repo will consume this library through package reference (from myget)
    * (WIP) SDK changes: https://github.com/dotnet/sdk/compare/master...swaroop-sridhar:bundle-lib?expand=1

Commit migrated from https://github.com/dotnet/core-setup/commit/345061995531c6f8de00189842a27298d5d1a9b1
20 files changed:
Microsoft.DotNet.CoreSetup.sln
src/installer/managed/Microsoft.NET.Build.Bundle/Microsoft.NET.Build.Bundle.csproj [deleted file]
src/installer/managed/Microsoft.NET.Build.Bundle/Program.cs [deleted file]
src/installer/managed/Microsoft.NET.Build.Bundle/README.md [deleted file]
src/installer/managed/Microsoft.NET.Build.Bundle/Sdk.props [deleted file]
src/installer/managed/Microsoft.NET.HostModel/Bundle/BundleException.cs [moved from src/installer/managed/Microsoft.NET.Build.Bundle/BundleException.cs with 92% similarity]
src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs [moved from src/installer/managed/Microsoft.NET.Build.Bundle/Bundler.cs with 51% similarity]
src/installer/managed/Microsoft.NET.HostModel/Bundle/Extractor.cs [moved from src/installer/managed/Microsoft.NET.Build.Bundle/Extractor.cs with 68% similarity]
src/installer/managed/Microsoft.NET.HostModel/Bundle/FileEntry.cs [moved from src/installer/managed/Microsoft.NET.Build.Bundle/FileEntry.cs with 95% similarity]
src/installer/managed/Microsoft.NET.HostModel/Bundle/FileSpec.cs [new file with mode: 0644]
src/installer/managed/Microsoft.NET.HostModel/Bundle/FileType.cs [moved from src/installer/managed/Microsoft.NET.Build.Bundle/FileType.cs with 87% similarity]
src/installer/managed/Microsoft.NET.HostModel/Bundle/Manifest.cs [moved from src/installer/managed/Microsoft.NET.Build.Bundle/Manifest.cs with 94% similarity]
src/installer/managed/Microsoft.NET.HostModel/Bundle/README.md [new file with mode: 0644]
src/installer/managed/Microsoft.NET.HostModel/Bundle/Trace.cs [new file with mode: 0644]
src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj [new file with mode: 0644]
src/installer/managed/dir.proj
src/installer/pkg/packaging/dir.proj
src/installer/test/Microsoft.NET.HostModel.Tests/BundleAndExtract.cs [moved from src/installer/test/Microsoft.NET.Build.Bundle.Tests/BundleAndExtract.cs with 79% similarity]
src/installer/test/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Tests.csproj [moved from src/installer/test/Microsoft.NET.Build.Bundle.Tests/Microsoft.NET.Build.Bundle.Tests.csproj with 64% similarity]
src/installer/test/dir.props