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

Added configuration for view precompilation. #846

Merged
merged 9 commits into from
Jun 23, 2020

Conversation

MichalTichy
Copy link
Contributor

@MichalTichy MichalTichy commented Jun 3, 2020

This PR adds configuration for view compilation modes.

/// Gets or sets the mode under which the view compilation (pages, controls, ... ) is done.
configuration.Markup.ViewCompilation.Mode = ViewCompilationMode.AfterStartup;

/// Gets or sets the delay before view compilation will be done. This compilation delay can be set only in precompilation modes.
configuration.Markup.ViewCompilation.BackgroundCompilationDelay = TimeSpan.FromMinutes(1);

Compilation modes are:

  • Lazy
    Current mode of compilation.
  • DuringApplicationStart
    Compilation will run during application startup. Application will start after compilation is done.
  • AfterApplicationStart
    Compilation will run after application startup.

@MichalTichy MichalTichy requested review from quigamdev, tomasherceg and exyi and removed request for quigamdev June 8, 2020 10:25
{
if (BackgroundCompilationDelay.HasValue && Mode == ViewCompilationMode.Lazy)
{
throw new Exception($"{nameof(BackgroundCompilationDelay)} is not supported in {nameof(ViewCompilationMode.Lazy)} {nameof(Mode)}.");
Copy link
Member

Choose a reason for hiding this comment

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

BackgroundCompilationDelay must be null in ...

Copy link
Member

Choose a reason for hiding this comment

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

We should also check that the delay is null when Mode is DuringStartup. That would only stop the startup, which does not make much sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -93,7 +93,7 @@ public static IEnumerable<ControlUsageError> ValidateUsage(ResolvedControl contr
{
if ((int)delayProperty.Value < 0)
{
yield return new ControlUsageError("Delay cannot be set to negative number.");
yield return new ControlUsageError("BackgroundCompilationDelay cannot be set to negative number.");
Copy link
Member

Choose a reason for hiding this comment

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

No, this is wrong 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ups :O
I've reverted the change and modified all the messages in UpdateProgress to use nameof

@MichalTichy MichalTichy requested a review from exyi June 12, 2020 08:36
Copy link
Member

@exyi exyi left a comment

Choose a reason for hiding this comment

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

Nice :)

@tomasherceg tomasherceg added this to the Version 2.5 milestone Jun 12, 2020
@tomasherceg
Copy link
Member

It seems like that integration tests are failing - @MichalTichy please look at it.

@MichalTichy
Copy link
Contributor Author

Tests seem to be ok now.
Can we merge it?
@tomasherceg

@tomasherceg tomasherceg merged commit 23af889 into master Jun 23, 2020
@tomasherceg tomasherceg deleted the DotVVM_ViewPrecompilation branch June 23, 2020 09:04
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.

3 participants