From 477acb4de329af023dcf740f70bd58bb22b0e511 Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 27 Sep 2017 11:35:51 +0200 Subject: [PATCH] Fix build, version 8.0.0-alpha024 --- .../Modules/Umbraco.Build/Umbraco.Build.psm1 | 4 + build/Modules/Umbraco.Build/Verify-NuGet.ps1 | 2 +- build/NuSpecs/UmbracoCms.Core.nuspec | 8 +- build/NuSpecs/UmbracoCms.nuspec | 2 +- src/SolutionInfo.cs | 2 +- src/Umbraco.Core/ActivatorHelper.cs | 20 -- src/Umbraco.Core/ActivatorServiceProvider.cs | 12 -- .../Configuration/UmbracoVersion.cs | 2 +- src/Umbraco.Core/CoreRuntimeComponent.cs | 3 - .../ThreadStaticDatabaseScopeAccessor.cs | 18 -- src/Umbraco.Core/ReadLock.cs | 1 + src/Umbraco.Core/ServiceProviderExtensions.cs | 46 ----- src/Umbraco.Core/TopologicalSorter.cs | 181 ------------------ src/Umbraco.Core/Umbraco.Core.csproj | 5 - src/Umbraco.Core/WriteLock.cs | 1 + src/Umbraco.Tests/Testing/UmbracoTestBase.cs | 3 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 16 +- .../WebMappingProfilesCompositionRoot.cs | 2 +- .../HybridDatabaseScopeAccessor.cs | 20 -- src/Umbraco.Web/Umbraco.Web.csproj | 3 +- .../WebApi/UmbracoAuthorizedApiController.cs | 22 --- src/Umbraco.Web/WebRuntimeComponent.cs | 2 +- 22 files changed, 23 insertions(+), 352 deletions(-) delete mode 100644 src/Umbraco.Core/ActivatorHelper.cs delete mode 100644 src/Umbraco.Core/ActivatorServiceProvider.cs delete mode 100644 src/Umbraco.Core/Persistence/ThreadStaticDatabaseScopeAccessor.cs delete mode 100644 src/Umbraco.Core/ServiceProviderExtensions.cs delete mode 100644 src/Umbraco.Core/TopologicalSorter.cs rename src/Umbraco.Web/{DI => Composing/CompositionRoots}/WebMappingProfilesCompositionRoot.cs (95%) delete mode 100644 src/Umbraco.Web/HybridDatabaseScopeAccessor.cs diff --git a/build/Modules/Umbraco.Build/Umbraco.Build.psm1 b/build/Modules/Umbraco.Build/Umbraco.Build.psm1 index c7bb3b824d..ae1ba01951 100644 --- a/build/Modules/Umbraco.Build/Umbraco.Build.psm1 +++ b/build/Modules/Umbraco.Build/Umbraco.Build.psm1 @@ -585,6 +585,10 @@ function Build-Umbraco { Package-Zip $uenv } + elseif ($target -eq "pkg-nuget") + { + Package-NuGet $uenv $version + } elseif ($target -eq "compile-belle") { Compile-Belle $uenv $version diff --git a/build/Modules/Umbraco.Build/Verify-NuGet.ps1 b/build/Modules/Umbraco.Build/Verify-NuGet.ps1 index f6053d2572..9e69f73f6a 100644 --- a/build/Modules/Umbraco.Build/Verify-NuGet.ps1 +++ b/build/Modules/Umbraco.Build/Verify-NuGet.ps1 @@ -382,7 +382,7 @@ function Verify-NuGet "Umbraco.Core", "Umbraco.Web", "Umbraco.Web.UI", - "UmbracoExamine", + "Umbraco.Examine", "Umbraco.Compat7"#, #"Umbraco.Tests", #"Umbraco.Tests.Benchmarks" diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index 659244e5a3..cbab1536b0 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -53,8 +53,8 @@ - - + + @@ -65,7 +65,7 @@ - - + + \ No newline at end of file diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec index 038d39e167..c06ac853f8 100644 --- a/build/NuSpecs/UmbracoCms.nuspec +++ b/build/NuSpecs/UmbracoCms.nuspec @@ -17,7 +17,7 @@ - + diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index eef30a6e50..531de848f8 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -17,4 +17,4 @@ using System.Resources; // these are FYI and changed automatically [assembly: AssemblyFileVersion("8.0.0")] -[assembly: AssemblyInformationalVersion("8.0.0-alpha0024")] +[assembly: AssemblyInformationalVersion("8.0.0-alpha0025")] diff --git a/src/Umbraco.Core/ActivatorHelper.cs b/src/Umbraco.Core/ActivatorHelper.cs deleted file mode 100644 index c7a6b7d983..0000000000 --- a/src/Umbraco.Core/ActivatorHelper.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Umbraco.Core -{ - /// - /// Helper methods for Activation - /// - internal static class ActivatorHelper - { - /// - /// Creates an instance of a type using that type's default constructor. - /// - /// - /// - public static T CreateInstance() where T : class, new() - { - return new ActivatorServiceProvider().GetService(typeof (T)) as T; - } - - - } -} diff --git a/src/Umbraco.Core/ActivatorServiceProvider.cs b/src/Umbraco.Core/ActivatorServiceProvider.cs deleted file mode 100644 index 70b1b121d1..0000000000 --- a/src/Umbraco.Core/ActivatorServiceProvider.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Umbraco.Core -{ - internal class ActivatorServiceProvider : IServiceProvider - { - public object GetService(Type serviceType) - { - return Activator.CreateInstance(serviceType); - } - } -} diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index 3b16470cdb..48fcd64c5d 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -21,7 +21,7 @@ namespace Umbraco.Core.Configuration /// /// Gets the version comment of the executing code (eg "beta"). /// - public static string CurrentComment => "alpha0024"; + public static string CurrentComment => "alpha0025"; /// /// Gets the assembly version of Umbraco.Code.dll. diff --git a/src/Umbraco.Core/CoreRuntimeComponent.cs b/src/Umbraco.Core/CoreRuntimeComponent.cs index 06567d2691..f2a6b7b6bc 100644 --- a/src/Umbraco.Core/CoreRuntimeComponent.cs +++ b/src/Umbraco.Core/CoreRuntimeComponent.cs @@ -42,9 +42,6 @@ namespace Umbraco.Core // *not* a singleton, don't want to keep it around composition.Container.Register(); - //TODO: Don't think we'll need this when the resolvers are all container resolvers - composition.Container.RegisterSingleton(); - // register filesystems composition.Container.Register(); composition.Container.Register(factory => factory.GetInstance().MediaFileSystem); diff --git a/src/Umbraco.Core/Persistence/ThreadStaticDatabaseScopeAccessor.cs b/src/Umbraco.Core/Persistence/ThreadStaticDatabaseScopeAccessor.cs deleted file mode 100644 index 7e09341412..0000000000 --- a/src/Umbraco.Core/Persistence/ThreadStaticDatabaseScopeAccessor.cs +++ /dev/null @@ -1,18 +0,0 @@ -// fixme - remove this file -//using System; - -//namespace Umbraco.Core.Persistence -//{ - -// internal class ThreadStaticDatabaseScopeAccessor : IDatabaseScopeAccessor -// { -// [ThreadStatic] -// private static DatabaseScope _databaseScope; - -// public DatabaseScope Scope -// { -// get { return _databaseScope; } -// set { _databaseScope = value; } -// } -// } -//} diff --git a/src/Umbraco.Core/ReadLock.cs b/src/Umbraco.Core/ReadLock.cs index 684758e86a..61025721fc 100644 --- a/src/Umbraco.Core/ReadLock.cs +++ b/src/Umbraco.Core/ReadLock.cs @@ -12,6 +12,7 @@ namespace Umbraco.Core /// /// Intended as an infrastructure class. /// + [Obsolete("stop using, allocates")] public class ReadLock : IDisposable { private readonly ReaderWriterLockSlim _rwLock; diff --git a/src/Umbraco.Core/ServiceProviderExtensions.cs b/src/Umbraco.Core/ServiceProviderExtensions.cs deleted file mode 100644 index a467dc3455..0000000000 --- a/src/Umbraco.Core/ServiceProviderExtensions.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Umbraco.Core.Logging; -using Umbraco.Core.Composing; - -namespace Umbraco.Core -{ - internal static class ServiceProviderExtensions - { - /// - /// Used to create instances of the specified type based on the resolved/cached plugin types - /// - /// - /// - /// - /// - /// set to true if an exception is to be thrown if there is an error during instantiation - /// - public static IEnumerable CreateInstances(this IServiceProvider serviceProvider, IEnumerable types, ILogger logger, bool throwException = false) - { - var typesAsArray = types.ToArray(); - - var instances = new List(); - foreach (var t in typesAsArray) - { - try - { - var typeInstance = (T) serviceProvider.GetService(t); - instances.Add(typeInstance); - } - catch (Exception ex) - { - - logger.Error(String.Format("Error creating type {0}", t.FullName), ex); - - if (throwException) - { - throw; - } - } - } - return instances; - } - } -} diff --git a/src/Umbraco.Core/TopologicalSorter.cs b/src/Umbraco.Core/TopologicalSorter.cs deleted file mode 100644 index 359e43e1e6..0000000000 --- a/src/Umbraco.Core/TopologicalSorter.cs +++ /dev/null @@ -1,181 +0,0 @@ -// fixme - remove this file -//using System; -//using System.Collections.Generic; - -//namespace Umbraco.Core -//{ -// /// -// /// Topological Sort algorithm for sorting items based on dependencies. -// /// Use the static method TopologicalSorter.GetSortedItems for a convenient -// /// way of sorting a list of items with dependencies between them. -// /// -// [Obsolete("Use the TopoGraph class instead, perfs are way better.", true)] // fixme remove! -// public class TopologicalSorter -// { -// private readonly int[] _vertices; // list of vertices -// private readonly int[,] _matrix; // adjacency matrix -// private int _numVerts; // current number of vertices -// private readonly int[] _sortedArray; - -// public TopologicalSorter(int size) -// { -// _vertices = new int[size]; -// _matrix = new int[size, size]; -// _numVerts = 0; -// for (var i = 0; i < size; i++) -// for (var j = 0; j < size; j++) -// _matrix[i, j] = 0; -// _sortedArray = new int[size]; // sorted vert labels -// } - -// #region Public Methods - -// public int AddVertex(int vertex) -// { -// _vertices[_numVerts++] = vertex; -// return _numVerts - 1; -// } - -// public void AddEdge(int start, int end) -// { -// _matrix[start, end] = 1; -// } - -// public int[] Sort() // toplogical sort -// { -// while (_numVerts > 0) // while vertices remain, -// { -// // get a vertex with no successors, or -1 -// var currentVertex = NoSuccessors(); -// if (currentVertex == -1) // must be a cycle -// throw new Exception("Graph has cycles"); - -// // insert vertex label in sorted array (start at end) -// _sortedArray[_numVerts - 1] = _vertices[currentVertex]; - -// DeleteVertex(currentVertex); // delete vertex -// } - -// // vertices all gone; return sortedArray -// return _sortedArray; -// } - -// #endregion - -// #region Private Helper Methods - -// // returns vert with no successors (or -1 if no such verts) -// private int NoSuccessors() -// { -// for (var row = 0; row < _numVerts; row++) -// { -// var isEdge = false; // edge from row to column in adjMat -// for (var col = 0; col < _numVerts; col++) -// { -// if (_matrix[row, col] <= 0) continue; -// isEdge = true; -// break; // this vertex has a successor try another -// } -// if (isEdge == false) // if no edges, has no successors -// return row; -// } -// return -1; // no -// } - -// private void DeleteVertex(int delVert) -// { -// // if not last vertex, delete from vertexList -// if (delVert != _numVerts - 1) -// { -// for (var j = delVert; j < _numVerts - 1; j++) -// _vertices[j] = _vertices[j + 1]; - -// for (var row = delVert; row < _numVerts - 1; row++) -// MoveRowUp(row, _numVerts); - -// for (var col = delVert; col < _numVerts - 1; col++) -// MoveColLeft(col, _numVerts - 1); -// } -// _numVerts--; // one less vertex -// } - -// private void MoveRowUp(int row, int length) -// { -// for (var col = 0; col < length; col++) -// _matrix[row, col] = _matrix[row + 1, col]; -// } - -// private void MoveColLeft(int col, int length) -// { -// for (var row = 0; row < length; row++) -// _matrix[row, col] = _matrix[row, col + 1]; -// } - -// #endregion - -// #region Static methods - -// public static IEnumerable GetSortedItems(List> fields) where T : class -// { -// var sortOrder = GetTopologicalSortOrder(fields); -// var list = new List(); -// for (var i = 0; i < sortOrder.Length; i++) -// { -// var field = fields[sortOrder[i]]; -// list.Add(field.Item.Value); -// } -// list.Reverse(); -// return list; -// } - -// internal static int[] GetTopologicalSortOrder(List> fields) where T : class -// { -// var g = new TopologicalSorter(fields.Count); -// var indexes = new Dictionary(); - -// //add vertices -// for (var i = 0; i < fields.Count; i++) -// { -// indexes[fields[i].Alias.ToLowerInvariant()] = g.AddVertex(i); -// } - -// //add edges -// for (var i = 0; i < fields.Count; i++) -// { -// if (fields[i].DependsOn == null) continue; - -// for (var j = 0; j < fields[i].DependsOn.Length; j++) -// { -// if (indexes.ContainsKey(fields[i].DependsOn[j].ToLowerInvariant()) == false) -// throw new IndexOutOfRangeException( -// $"The alias '{fields[i]}' has an invalid dependency. The dependency '{fields[i].DependsOn[j]}' does not exist in the list of aliases"); - -// g.AddEdge(i, indexes[fields[i].DependsOn[j].ToLowerInvariant()]); -// } -// } - -// var result = g.Sort(); -// return result; -// } - -// #endregion - -// public class DependencyField where T : class -// { -// public DependencyField() -// { -// } - -// public DependencyField(string @alias, string[] dependsOn, Lazy item) -// { -// Alias = alias; -// DependsOn = dependsOn; -// Item = item; -// } - -// public string Alias { get; set; } -// public string[] DependsOn { get; set; } -// public Lazy Item { get; set; } -// } -// } -//} diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 6ccf608161..be744de397 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -88,8 +88,6 @@ Constants.cs --> - - @@ -1199,7 +1197,6 @@ - @@ -1341,7 +1338,6 @@ - @@ -1476,7 +1472,6 @@ - diff --git a/src/Umbraco.Core/WriteLock.cs b/src/Umbraco.Core/WriteLock.cs index ceeb175c25..b6a957234b 100644 --- a/src/Umbraco.Core/WriteLock.cs +++ b/src/Umbraco.Core/WriteLock.cs @@ -12,6 +12,7 @@ namespace Umbraco.Core /// /// Intended as an infrastructure class. /// + [Obsolete("stop using, allocates")] public class WriteLock : IDisposable { private readonly ReaderWriterLockSlim _rwLock; diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs index 4f40efdef5..28640e1ac5 100644 --- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs +++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs @@ -27,9 +27,9 @@ using Umbraco.Core.Strings; using Umbraco.Tests.TestHelpers; using Umbraco.Tests.TestHelpers.Stubs; using Umbraco.Web; -using Umbraco.Web.DI; using Umbraco.Web.Services; using Umbraco.Examine; +using Umbraco.Web.Composing.CompositionRoots; using Umbraco.Web._Legacy.Actions; using Current = Umbraco.Core.Composing.Current; @@ -256,7 +256,6 @@ namespace Umbraco.Tests.Testing Container.RegisterSingleton(factory => SettingsForTests.GetDefault()); Container.RegisterSingleton(factory => settings.Content); Container.RegisterSingleton(factory => settings.Templates); - Container.Register(); Container.Register(factory => new MediaFileSystem(Mock.Of())); Container.RegisterSingleton(); diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 1011d46b4c..93220d01b9 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -471,14 +471,14 @@ create.aspx - + xslt.ascx ASPXCodeBehind xslt.ascx - + UserControlProxy.aspx ASPXCodeBehind @@ -1036,24 +1036,18 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\" - - - - + + - - + - - - \ No newline at end of file diff --git a/src/Umbraco.Web/DI/WebMappingProfilesCompositionRoot.cs b/src/Umbraco.Web/Composing/CompositionRoots/WebMappingProfilesCompositionRoot.cs similarity index 95% rename from src/Umbraco.Web/DI/WebMappingProfilesCompositionRoot.cs rename to src/Umbraco.Web/Composing/CompositionRoots/WebMappingProfilesCompositionRoot.cs index 347fb84996..5ac4904712 100644 --- a/src/Umbraco.Web/DI/WebMappingProfilesCompositionRoot.cs +++ b/src/Umbraco.Web/Composing/CompositionRoots/WebMappingProfilesCompositionRoot.cs @@ -1,7 +1,7 @@ using LightInject; using Umbraco.Web.Models.Mapping; -namespace Umbraco.Web.DI +namespace Umbraco.Web.Composing.CompositionRoots { public sealed class WebMappingProfilesCompositionRoot : ICompositionRoot { diff --git a/src/Umbraco.Web/HybridDatabaseScopeAccessor.cs b/src/Umbraco.Web/HybridDatabaseScopeAccessor.cs deleted file mode 100644 index 0e61a1908a..0000000000 --- a/src/Umbraco.Web/HybridDatabaseScopeAccessor.cs +++ /dev/null @@ -1,20 +0,0 @@ -// fixme remove this file -//using Umbraco.Core.Persistence; - -//namespace Umbraco.Web -//{ -// internal class HybridDatabaseScopeAccessor : HybridAccessorBase, IDatabaseScopeAccessor -// { -// protected override string ItemKey => "Umbraco.Core.Persistence.HybridDatabaseScopeAccessor"; - -// public HybridDatabaseScopeAccessor(IHttpContextAccessor httpContextAccessor) -// : base(httpContextAccessor) -// { } - -// public DatabaseScope Scope -// { -// get { return Value; } -// set { Value = value; } -// } -// } -//} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 798a96509f..c492c2b79f 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -151,13 +151,12 @@ - - + diff --git a/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs b/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs index a93d41a490..ad217b43fd 100644 --- a/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs +++ b/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs @@ -22,30 +22,8 @@ namespace Umbraco.Web.WebApi public abstract class UmbracoAuthorizedApiController : UmbracoApiController { private BackOfficeUserManager _userManager; - private bool _userisValidated = false; protected BackOfficeUserManager UserManager => _userManager ?? (_userManager = TryGetOwinContext().Result.GetBackOfficeUserManager()); - - /// - /// Returns the currently logged in Umbraco User - /// - /* - [Obsolete("This should no longer be used since it returns the legacy user object, use The Security.CurrentUser instead to return the proper user object, or Security.GetUserId() if you want to just get the user id")] - protected User UmbracoUser - { - get - { - //throw exceptions if not valid (true) - if (!_userisValidated) - { - Security.ValidateCurrentUser(true); - _userisValidated = true; - } - - return new User(Security.CurrentUser); - } - } - */ // fixme v8 remove this code } } diff --git a/src/Umbraco.Web/WebRuntimeComponent.cs b/src/Umbraco.Web/WebRuntimeComponent.cs index 86c413a2ca..6e205a56ac 100644 --- a/src/Umbraco.Web/WebRuntimeComponent.cs +++ b/src/Umbraco.Web/WebRuntimeComponent.cs @@ -25,7 +25,6 @@ using Umbraco.Core.PropertyEditors; using Umbraco.Core.PropertyEditors.ValueConverters; using Umbraco.Core.Services; using Umbraco.Web.Cache; -using Umbraco.Web.DI; using Umbraco.Web.Dictionary; using Umbraco.Web.Editors; using Umbraco.Web.HealthCheck; @@ -42,6 +41,7 @@ using Umbraco.Web.UI.JavaScript; using Umbraco.Web.WebApi; using Umbraco.Web._Legacy.Actions; using Umbraco.Examine; +using Umbraco.Web.Composing.CompositionRoots; using Umbraco.Web.Search; using Umbraco.Web.Trees; using Current = Umbraco.Web.Composing.Current;