Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command-line interface #872

Merged
merged 269 commits into from May 20, 2021
Merged

Command-line interface #872

merged 269 commits into from May 20, 2021

Conversation

cafour
Copy link
Contributor

@cafour cafour commented Aug 14, 2020

(Builds off of #775.)

This is a major-ish rewrite of the command-line interface and the stand-alone compiler executable. It tries to bring them closer to style of the SDK's dotnet executable.

The Compiler executable is no longer embedded into the DotVVM NuGet package anymore. Instead, DotVVM.CommandLine itself includes two builds of the Compiler, one for .NET Framework and one for .NET Core (and .NET 5).

In addition to that, the Compiler is now able to load the compiled project's assembly correctly (i.e. with all its dependencies) using AppDomain and DependencyContext magics.

However, not everything has been solved. The Compiler is still not actually a compiler. It's more of a linter really, since even though it can create an assembly for each page it can't merge them together. None of the IL merging tools I tried work, so I conclude that to get this to work, we'll have to make some changes in DotVVM.Framework.

The process of the CLI's lint command goes a little something like this:

  1. Find a .csproj
  2. Using a custom .targets file, figure out what framework does the .csproj target
  3. Build the .csproj, unless the --no-build options was passed
  4. Pick the proper build of the compiler (i.e. net461 or netcoreapp3.1)
  5. Invoke the compiler with a path to the project and its built assembly file
    a. If this is the netcoreapp3.1 Compiler, use DependencyContext and AssemblyLoadContext to load the assembly with its dependencies.
    b. If this is the net461 Compiler, create a new AppDomain with the project's app.config (thus loading its dependencies first). If an assembly resolution fails, the original AppDomain is used in the AssemblyResolve event.
    c. Create a DotvvmConfiguration
    d. Compile all views and markup controls more-or-less the same way DotVVM does at runtime.

Filip Kalous and others added 30 commits April 1, 2019 16:50
@tomasherceg tomasherceg added this to the Version 3.1 milestone Mar 27, 2021
@quigamdev
Copy link
Contributor

Finally, I have tested the compiler against the net461 framework and it works. Also, I have checked all files that are directly part of DotVVM.Framework or DotVVM.Core assembly. All seem good to me.

@quigamdev quigamdev merged commit 735f80c into main May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants