From f668bf060ae5cca91d088dccba75d43ab9af4865 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 19 Mar 2021 08:08:00 +0100 Subject: [PATCH 1/2] move static assets and the target+props file to a seperate nuget. Now the root package is only referencing other packages --- build/NuSpecs/UmbracoCms.StaticAssets.nuspec | 33 +++++++++++++++++++ build/NuSpecs/UmbracoCms.nuspec | 11 +------ ...s.props => Umbraco.Cms.StaticAssets.props} | 0 ...rgets => Umbraco.Cms.StaticAssets.targets} | 2 +- build/build.ps1 | 6 ++++ src/umbraco.sln | 5 +-- 6 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 build/NuSpecs/UmbracoCms.StaticAssets.nuspec rename build/NuSpecs/build/{Umbraco.Cms.props => Umbraco.Cms.StaticAssets.props} (100%) rename build/NuSpecs/build/{Umbraco.Cms.targets => Umbraco.Cms.StaticAssets.targets} (82%) diff --git a/build/NuSpecs/UmbracoCms.StaticAssets.nuspec b/build/NuSpecs/UmbracoCms.StaticAssets.nuspec new file mode 100644 index 0000000000..b8109dbfa9 --- /dev/null +++ b/build/NuSpecs/UmbracoCms.StaticAssets.nuspec @@ -0,0 +1,33 @@ + + + + Umbraco.Cms.StaticAssets + 9.0.0 + Umbraco Cms Static Assets + Umbraco HQ + Umbraco HQ + MIT + https://umbraco.com/ + https://umbraco.com/dist/nuget/logo-small.png + false + Contains the static assets that is required to run Umbraco CMS. + Contains the static assets that is required to run Umbraco CMS. + en-US + umbraco + + + + + + + + + + + + + + + + + diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec index c031d71704..0c9c914d6c 100644 --- a/build/NuSpecs/UmbracoCms.nuspec +++ b/build/NuSpecs/UmbracoCms.nuspec @@ -19,6 +19,7 @@ + - - - - - - - - - diff --git a/build/NuSpecs/build/Umbraco.Cms.props b/build/NuSpecs/build/Umbraco.Cms.StaticAssets.props similarity index 100% rename from build/NuSpecs/build/Umbraco.Cms.props rename to build/NuSpecs/build/Umbraco.Cms.StaticAssets.props diff --git a/build/NuSpecs/build/Umbraco.Cms.targets b/build/NuSpecs/build/Umbraco.Cms.StaticAssets.targets similarity index 82% rename from build/NuSpecs/build/Umbraco.Cms.targets rename to build/NuSpecs/build/Umbraco.Cms.StaticAssets.targets index 29d972d480..9f40bdf125 100644 --- a/build/NuSpecs/build/Umbraco.Cms.targets +++ b/build/NuSpecs/build/Umbraco.Cms.StaticAssets.targets @@ -9,7 +9,7 @@ - + "$($this.BuildTemp)\nupack.cmssqlce.log" if (-not $?) { throw "Failed to pack NuGet UmbracoCms.SqlCe." } + &$this.BuildEnv.NuGet Pack "$nuspecs\UmbracoCms.StaticAssets.nuspec" ` + -Properties BuildTmp="$($this.BuildTemp)" ` + -Version "$($this.Version.Semver.ToString())" ` + -Verbosity detailed -outputDirectory "$($this.BuildOutput)" > "$($this.BuildTemp)\nupack.cmsstaticassets.log" + if (-not $?) { throw "Failed to pack NuGet UmbracoCms.StaticAssets." } + &$this.BuildEnv.NuGet Pack "$templates\Umbraco.Templates.nuspec" ` -Properties BuildTmp="$($this.BuildTemp)" ` -Version "$($this.Version.Semver.ToString())" ` diff --git a/src/umbraco.sln b/src/umbraco.sln index 0041474014..f0088501fa 100644 --- a/src/umbraco.sln +++ b/src/umbraco.sln @@ -40,6 +40,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{227C ..\build\NuSpecs\UmbracoCms.nuspec = ..\build\NuSpecs\UmbracoCms.nuspec ..\build\NuSpecs\UmbracoCms.SqlCe.nuspec = ..\build\NuSpecs\UmbracoCms.SqlCe.nuspec ..\build\NuSpecs\UmbracoCms.Examine.Lucene.nuspec = ..\build\NuSpecs\UmbracoCms.Examine.Lucene.nuspec + ..\build\NuSpecs\UmbracoCms.StaticAssets.nuspec = ..\build\NuSpecs\UmbracoCms.StaticAssets.nuspec EndProjectSection EndProject Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Umbraco.Web.UI.Client", "http://localhost:3961", "{3819A550-DCEC-4153-91B4-8BA9F7F0B9B4}" @@ -113,8 +114,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{E3F9F378 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{5B03EF4E-E0AC-4905-861B-8C3EC1A0D458}" ProjectSection(SolutionItems) = preProject - ..\build\NuSpecs\build\Umbraco.Cms.props = ..\build\NuSpecs\build\Umbraco.Cms.props - ..\build\NuSpecs\build\Umbraco.Cms.targets = ..\build\NuSpecs\build\Umbraco.Cms.targets + ..\build\NuSpecs\build\Umbraco.Cms.StaticAssets.props = ..\build\NuSpecs\build\Umbraco.Cms.StaticAssets.props + ..\build\NuSpecs\build\Umbraco.Cms.StaticAssets.targets = ..\build\NuSpecs\build\Umbraco.Cms.StaticAssets.targets EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DocTools", "DocTools", "{53594E5B-64A2-4545-8367-E3627D266AE8}" From baacedd57d1db616ea429d5f90f0f9859eab4de0 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 19 Mar 2021 08:09:00 +0100 Subject: [PATCH 2/2] Fixed bug where indexes was build before application was in run state + Moved the logic to the application started event --- .../Search/ExamineFinalComponent.cs | 33 ------------------- .../Search/ExamineFinalComposer.cs | 11 ------- .../Search/ExamineNotificationHandler.cs | 10 ++++-- 3 files changed, 8 insertions(+), 46 deletions(-) delete mode 100644 src/Umbraco.Infrastructure/Search/ExamineFinalComponent.cs delete mode 100644 src/Umbraco.Infrastructure/Search/ExamineFinalComposer.cs diff --git a/src/Umbraco.Infrastructure/Search/ExamineFinalComponent.cs b/src/Umbraco.Infrastructure/Search/ExamineFinalComponent.cs deleted file mode 100644 index 441d8af038..0000000000 --- a/src/Umbraco.Infrastructure/Search/ExamineFinalComponent.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using Umbraco.Cms.Core.Composing; -using Umbraco.Cms.Core.Runtime; - -namespace Umbraco.Cms.Infrastructure.Search -{ - /// - /// Executes after all other examine components have executed - /// - public sealed class ExamineFinalComponent : IComponent - { - BackgroundIndexRebuilder _indexRebuilder; - private readonly IMainDom _mainDom; - - public ExamineFinalComponent(BackgroundIndexRebuilder indexRebuilder, IMainDom mainDom) - { - _indexRebuilder = indexRebuilder; - _mainDom = mainDom; - } - - public void Initialize() - { - if (!_mainDom.IsMainDom) return; - - // TODO: Instead of waiting 5000 ms, we could add an event handler on to fulfilling the first request, then start? - _indexRebuilder.RebuildIndexes(true, TimeSpan.FromSeconds(5)); - } - - public void Terminate() - { - } - } -} diff --git a/src/Umbraco.Infrastructure/Search/ExamineFinalComposer.cs b/src/Umbraco.Infrastructure/Search/ExamineFinalComposer.cs deleted file mode 100644 index 037a3d1622..0000000000 --- a/src/Umbraco.Infrastructure/Search/ExamineFinalComposer.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Umbraco.Cms.Core.Composing; - -namespace Umbraco.Cms.Infrastructure.Search -{ - // examine's final composer composes after all user composers - // and *also* after ICoreComposer (in case IUserComposer is disabled) - [ComposeAfter(typeof(IUserComposer))] - [ComposeAfter(typeof(ICoreComposer))] - public class ExamineFinalComposer : ComponentComposer - { } -} diff --git a/src/Umbraco.Infrastructure/Search/ExamineNotificationHandler.cs b/src/Umbraco.Infrastructure/Search/ExamineNotificationHandler.cs index b10bf70c10..d22acb87e2 100644 --- a/src/Umbraco.Infrastructure/Search/ExamineNotificationHandler.cs +++ b/src/Umbraco.Infrastructure/Search/ExamineNotificationHandler.cs @@ -35,6 +35,7 @@ namespace Umbraco.Cms.Infrastructure.Search private readonly IValueSetBuilder _memberValueSetBuilder; private readonly BackgroundIndexRebuilder _backgroundIndexRebuilder; private readonly TaskHelper _taskHelper; + private readonly IRuntimeState _runtimeState; private readonly IScopeProvider _scopeProvider; private readonly ServiceContext _services; private readonly IMainDom _mainDom; @@ -60,7 +61,8 @@ namespace Umbraco.Cms.Infrastructure.Search IValueSetBuilder mediaValueSetBuilder, IValueSetBuilder memberValueSetBuilder, BackgroundIndexRebuilder backgroundIndexRebuilder, - TaskHelper taskHelper) + TaskHelper taskHelper, + IRuntimeState runtimeState) { _services = services; _scopeProvider = scopeProvider; @@ -71,6 +73,7 @@ namespace Umbraco.Cms.Infrastructure.Search _memberValueSetBuilder = memberValueSetBuilder; _backgroundIndexRebuilder = backgroundIndexRebuilder; _taskHelper = taskHelper; + _runtimeState = runtimeState; _mainDom = mainDom; _profilingLogger = profilingLogger; _logger = logger; @@ -114,7 +117,10 @@ namespace Umbraco.Cms.Infrastructure.Search s_deactivate_handlers = true; } - + if (_mainDom.IsMainDom && _runtimeState.Level >= RuntimeLevel.Run) + { + _backgroundIndexRebuilder.RebuildIndexes(true); + } }