Move umbraco views to static assets and make that an RCL + Embedded language files (#12324)
* RCL for static assets to replace the nuspec * Fix build * Fix unit tests * clean up in build.ps1 * Removed test (lang files will be removed later anyway) * Fixed namespaces.. + Ensure we set web root path if missing (e.g. wwwroot folder do not exist) + Added StaticWebAssetBasePath * fixed namespace * cleanup * Set root variable * Added static assets * Experimenting with StaticWebAssetBasePath * Embedded lang files into Umbraco.Core * Removed legacy test. New test can be implemented instead * Fixed tests * clean up * Fix merge issue
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata minClientVersion="4.1.0">
|
||||
<id>Umbraco.Cms.StaticAssets</id>
|
||||
<version>9.0.0</version>
|
||||
<title>Umbraco Cms Static Assets</title>
|
||||
<authors>Umbraco HQ</authors>
|
||||
<owners>Umbraco HQ</owners>
|
||||
<license type="expression">MIT</license>
|
||||
<projectUrl>https://umbraco.com/</projectUrl>
|
||||
<iconUrl>https://umbraco.com/dist/nuget/logo-small.png</iconUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>Contains the static assets that is required to run Umbraco CMS.</description>
|
||||
<summary>Contains the static assets that is required to run Umbraco CMS.</summary>
|
||||
<language>en-US</language>
|
||||
<tags>umbraco</tags>
|
||||
<repository type="git" url="https://github.com/umbraco/umbraco-cms" />
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<!-- Content -->
|
||||
<file src="$BuildTmp$\WebApp\wwwroot\umbraco\**\*.*" target="content\wwwroot\umbraco" />
|
||||
<file src="$BuildTmp$\WebApp\umbraco\**\*.*" target="content\umbraco" />
|
||||
|
||||
<!-- UmbracoCms props and targets used to copy the content into the solution -->
|
||||
<file src="buildTransitive\**" target="buildTransitive\" />
|
||||
</files>
|
||||
</package>
|
||||
@@ -1,8 +0,0 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);App_Plugins/**</DefaultItemExcludes>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);umbraco/Data/**</DefaultItemExcludes>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);umbraco/Logs/**</DefaultItemExcludes>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);wwwroot/media/**</DefaultItemExcludes>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,91 +0,0 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<ContentFilesPath>$(MSBuildThisFileDirectory)..\content\umbraco\**\*.*</ContentFilesPath>
|
||||
<ContentWwwrootFilesPath>$(MSBuildThisFileDirectory)..\content\wwwroot\umbraco\**\*.*</ContentWwwrootFilesPath>
|
||||
<UmbracoWwwrootName Condition="'$(UmbracoWwwrootName)' == ''">umbraco</UmbracoWwwrootName>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="CopyUmbracoAssets" BeforeTargets="BeforeBuild">
|
||||
<ItemGroup>
|
||||
<ContentFiles Include="$(ContentFilesPath)" />
|
||||
<ContentWwwrootFiles Include="$(ContentWwwrootFilesPath)" />
|
||||
</ItemGroup>
|
||||
<Message Text="Copying Umbraco content files: $(ContentFilesPath) - #@(ContentFiles->Count()) files" Importance="high" />
|
||||
<Message Text="Copying Umbraco wwwroot content files: $(ContentWwwrootFilesPath) - #@(ContentWwwrootFiles->Count()) files" Importance="high" />
|
||||
<Copy
|
||||
SourceFiles="@(ContentFiles)"
|
||||
DestinationFiles="@(ContentFiles->'$(MSBuildProjectDirectory)\umbraco\%(RecursiveDir)%(Filename)%(Extension)')"
|
||||
SkipUnchangedFiles="true" />
|
||||
<Copy
|
||||
SourceFiles="@(ContentWwwrootFiles)"
|
||||
DestinationFiles="@(ContentWwwrootFiles->'$(MSBuildProjectDirectory)\wwwroot\$(UmbracoWwwrootName)\%(RecursiveDir)%(Filename)%(Extension)')"
|
||||
SkipUnchangedFiles="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="IncludeAppPluginsContent" BeforeTargets="GetCopyToOutputDirectoryItems;GetCopyToPublishDirectoryItems;">
|
||||
<ItemGroup>
|
||||
<_AppPluginsFiles Include="App_Plugins\**" />
|
||||
|
||||
<ContentWithTargetPath
|
||||
Include="@(_AppPluginsFiles)"
|
||||
Exclude="@(ContentWithTargetPath)"
|
||||
TargetPath="%(Identity)"
|
||||
CopyToOutputDirectory="PreserveNewest"
|
||||
CopyToPublishDirectory="PreserveNewest"/>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
The set of files to publish is generated really early and doesn't currently account for files added by targets e.g. BeforeBuild.
|
||||
A fix was put in place in Web SDK to update for wwwwroot in case someone runs npm build etc in a target, we're borrowing their trick.
|
||||
https://github.com/dotnet/sdk/blob/e2b2b1a4ac56c955b84d62fe71cda3b6f258b42b/src/WebSdk/Publish/Targets/ComputeTargets/Microsoft.NET.Sdk.Publish.ComputeFiles.targets
|
||||
-->
|
||||
<Target Name="IncludeUmbracoFolderContent" BeforeTargets="GetCopyToOutputDirectoryItems;GetCopyToPublishDirectoryItems;">
|
||||
<ItemGroup>
|
||||
<_UmbracoFolderFiles Include="umbraco\config\**" />
|
||||
<_UmbracoFolderFiles Include="umbraco\PartialViewMacros\**" />
|
||||
<_UmbracoFolderFiles Include="umbraco\UmbracoBackOffice\**" />
|
||||
<_UmbracoFolderFiles Include="umbraco\UmbracoInstall\**" />
|
||||
<_UmbracoFolderFiles Include="umbraco\UmbracoWebsite\**" />
|
||||
<_UmbracoFolderFiles Include="umbraco\UmbracoWebsite\**" />
|
||||
<_UmbracoFolderFiles Include="umbraco\Licenses\**" />
|
||||
|
||||
<!-- This could be handled in deploy if it's not already -->
|
||||
<_UmbracoFolderFiles Include="umbraco\Deploy\**" />
|
||||
|
||||
<ContentWithTargetPath
|
||||
Include="@(_UmbracoFolderFiles)"
|
||||
Exclude="@(ContentWithTargetPath)"
|
||||
TargetPath="%(Identity)"
|
||||
CopyToOutputDirectory="PreserveNewest"
|
||||
CopyToPublishDirectory="PreserveNewest"/>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="ClearUmbracoAssets" BeforeTargets="Clean">
|
||||
<ItemGroup>
|
||||
<UmbracoConfigPackageDir Include="$(MSBuildProjectDirectory)\umbraco\config\" />
|
||||
<UmbracoPartialViewMacrosPackageDir Include="$(MSBuildProjectDirectory)\umbraco\PartialViewMacros\" />
|
||||
<UmbracoUmbracoBackOfficeMacrosDir Include="$(MSBuildProjectDirectory)\umbraco\UmbracoBackOffice\" />
|
||||
<UmbracoUmbracoInstallDir Include="$(MSBuildProjectDirectory)\umbraco\UmbracoInstall\" />
|
||||
<UmbracoUmbracoWebsiteMacrosDir Include="$(MSBuildProjectDirectory)\umbraco\UmbracoWebsite\" />
|
||||
<WwwrootUmbracoPackageDir Include="$(MSBuildProjectDirectory)\wwwroot\$(UmbracoWwwrootName)\" />
|
||||
</ItemGroup>
|
||||
<Message Text="Clear old umbraco data" Importance="high" />
|
||||
<RemoveDir Directories="@(UmbracoConfigPackageDir)" />
|
||||
<RemoveDir Directories="@(UmbracoPartialViewMacrosPackageDir)" />
|
||||
<RemoveDir Directories="@(UmbracoUmbracoBackOfficeMacrosDir)" />
|
||||
<RemoveDir Directories="@(UmbracoUmbracoInstallDir)" />
|
||||
<RemoveDir Directories="@(UmbracoUmbracoWebsiteMacrosDir)" />
|
||||
<RemoveDir Directories="@(WwwrootUmbracoPackageDir)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="IncludeUmbracoRazorFiles" BeforeTargets="ResolveRazorGenerateInputs">
|
||||
<ItemGroup>
|
||||
<Content Include="$(MSBuildProjectDirectory)\umbraco\**\*.cshtml" Exclude="@(Content)" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -301,13 +301,6 @@
|
||||
$_.CreationTime = $_.CreationTime.AddHours(-11)
|
||||
$_.LastWriteTime = $_.LastWriteTime.AddHours(-11)
|
||||
}
|
||||
|
||||
# copy Belle
|
||||
Write-Host "Copy Belle"
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI\wwwroot\umbraco\assets", "*", "$tmp\WebApp\wwwroot\umbraco\assets")
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI\wwwroot\umbraco\js", "*", "$tmp\WebApp\wwwroot\umbraco\js")
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI\wwwroot\umbraco\lib", "*", "$tmp\WebApp\wwwroot\umbraco\lib")
|
||||
$this.CopyFiles("$src\Umbraco.Web.UI\wwwroot\umbraco\views", "*", "$tmp\WebApp\wwwroot\umbraco\views")
|
||||
})
|
||||
|
||||
|
||||
@@ -365,12 +358,6 @@
|
||||
-Verbosity detailed -outputDirectory "$($this.BuildOutput)" > "$($this.BuildTemp)\nupack.cms.log"
|
||||
if (-not $?) { throw "Failed to pack NuGet UmbracoCms." }
|
||||
|
||||
&$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())" `
|
||||
|
||||
58
src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj
Normal file
58
src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj
Normal file
@@ -0,0 +1,58 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||
<PackageId>Umbraco.Cms.StaticAssets</PackageId>
|
||||
<Description>Contains the static assets that is required to run Umbraco CMS.</Description>
|
||||
<StaticWebAssetBasePath>/</StaticWebAssetBasePath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Web.BackOffice\Umbraco.Web.BackOffice.csproj" PrivateAssets="All" />
|
||||
<ProjectReference Include="..\Umbraco.Web.Website\Umbraco.Web.Website.csproj" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<BellePath>$(ProjectDir)wwwroot/umbraco</BellePath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="CheckPreconditions" BeforeTargets="Build">
|
||||
<Message Text="-CheckPreconditions-" Importance="high" />
|
||||
<Message Text="BellePath: $(BellePath)" Importance="high" />
|
||||
|
||||
<!-- Build Belle, if building is Visual Studio and the build folder does not exist yet -->
|
||||
<Message Text="Skip Belle because UmbracoBuild is '$(UmbracoBuild)' (this is not Visual Studio)." Importance="High" Condition="'$(UmbracoBuild)' != ''" />
|
||||
<Message Text="Skip Belle because $(BellePath) exists." Importance="High" Condition="Exists('$(BellePath)')" />
|
||||
<Message Text="Build Belle because UmbracoBuild is empty (this is Visual Studio), and $(BellePath) does not exist." Importance="High" Condition="!Exists('$(BellePath)') and '$(UmbracoBuild)' == ''" />
|
||||
<CallTarget Targets="BelleBuild" Condition="!Exists('$(BellePath)') and '$(UmbracoBuild)' == ''" />
|
||||
<Message Text="Skip JsonSchema generation because $(JsonSchemaPath) exists." Importance="High" Condition="Exists('$(JsonSchemaPath)')" />
|
||||
<Message Text="Generate the appsettings json schema." Importance="High" Condition="!Exists('$(JsonSchemaPath)') and '$(UmbracoBuild)' == ''" />
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="BelleBuild">
|
||||
<Exec WorkingDirectory="$(ProjectDir)/../Umbraco.Web.UI.Client/" Command="npm ci --no-fund --no-audit --prefer-offline" />
|
||||
<Exec WorkingDirectory="$(ProjectDir)/../Umbraco.Web.UI.Client/" Command="npm run build:skip-tests" />
|
||||
</Target>
|
||||
|
||||
<!-- Clean Belle when cleaning and rebuilding, but only in Visual Studio -->
|
||||
<Target Name="CleanPreconditions" AfterTargets="Clean" Condition="'$(UmbracoBuild)' == ''">
|
||||
<Message Text="-CleanPreconditions-" Importance="high" />
|
||||
<Message Text="Nothing to clean, as $(BellePath) does not exist." Importance="High" Condition="!Exists('$(BellePath)')" />
|
||||
<Message Text="Not cleaning (found src/preserve.belle)." Importance="High" Condition="Exists('$(BellePath)') and Exists('$(SolutionDir)preserve.belle')" />
|
||||
<Message Text="Remove $(BellePath)." Importance="High" Condition="Exists('$(BellePath)') and !Exists('$(SolutionDir)preserve.belle')" />
|
||||
<ItemGroup>
|
||||
<BelleLib Include="$(BellePath)" />
|
||||
</ItemGroup>
|
||||
<RemoveDir Directories="@(BelleLib)" Condition="Exists('$(BellePath)') and !Exists('$(SolutionDir)preserve.belle')" />
|
||||
<Message Text="Remove $(JsonSchemaPath)." Importance="High" Condition="Exists('$(JsonSchemaPath)') and !Exists('$(SolutionDir)preserve.jsonschema')" />
|
||||
<Delete Files="$(JsonSchemaPath)" Condition="Exists('$(JsonSchemaPath)') and !Exists('$(SolutionDir)preserve.jsonschema')" />
|
||||
</Target>
|
||||
|
||||
|
||||
</Project>
|
||||
@@ -59,15 +59,15 @@
|
||||
<script type="text/javascript">
|
||||
document.angularReady = function (app) {
|
||||
|
||||
@await Html.AngularValueExternalLoginInfoScriptAsync(externalLogins, ViewData.GetExternalSignInProviderErrors())
|
||||
@Html.AngularValueResetPasswordCodeInfoScript(ViewData[ViewDataExtensions.TokenPasswordResetCode])
|
||||
@await Html.AngularValueExternalLoginInfoScriptAsync(externalLogins, ViewData.GetExternalSignInProviderErrors()!)
|
||||
@Html.AngularValueResetPasswordCodeInfoScript(ViewData[ViewDataExtensions.TokenPasswordResetCode]!)
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@*And finally we can load in our angular app*@
|
||||
<script type="text/javascript" src="lib/lazyload-js/LazyLoad.min.js"></script>
|
||||
<script src="@Url.GetUrlWithCacheBust("Application", "BackOffice", null, hostingEnvironment, umbracoVersion, runtimeMinifier)"></script>
|
||||
<script src="@Url.GetUrlWithCacheBust("Application", "BackOffice", null!, hostingEnvironment, umbracoVersion, runtimeMinifier)"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -120,8 +120,8 @@
|
||||
|
||||
<script>
|
||||
document.angularReady = function(app) {
|
||||
@await Html.AngularValueExternalLoginInfoScriptAsync(externalLogins, ViewData.GetExternalSignInProviderErrors())
|
||||
@Html.AngularValueResetPasswordCodeInfoScript(ViewData[ViewDataExtensions.TokenPasswordResetCode])
|
||||
@await Html.AngularValueExternalLoginInfoScriptAsync(externalLogins, ViewData.GetExternalSignInProviderErrors()!)
|
||||
@Html.AngularValueResetPasswordCodeInfoScript(ViewData[ViewDataExtensions.TokenPasswordResetCode]!)
|
||||
@await Html.AngularValueTinyMceAssetsAsync(runtimeMinifier)
|
||||
//required for the noscript trick
|
||||
document.getElementById("mainwrapper").style.display = "inherit";
|
||||
@@ -129,7 +129,7 @@
|
||||
</script>
|
||||
|
||||
<script src="@WebPath.Combine(backOfficePath.TrimStart("~"), "/lib/lazyload-js/LazyLoad.min.js")"></script>
|
||||
<script src="@Url.GetUrlWithCacheBust("Application", "BackOffice", null, hostingEnvironment, umbracoVersion, runtimeMinifier)"></script>
|
||||
<script src="@Url.GetUrlWithCacheBust("Application", "BackOffice", null!, hostingEnvironment, umbracoVersion, runtimeMinifier)"></script>
|
||||
|
||||
@if (isDebug)
|
||||
{
|
||||
@@ -108,7 +108,7 @@
|
||||
@await Html.BareMinimumServerVariablesScriptAsync(BackOfficeServerVariables)
|
||||
|
||||
<script src="../lib/lazyload-js/LazyLoad.min.js"></script>
|
||||
<script src="@Url.GetUrlWithCacheBust("Application", "Preview", null, HostingEnvironment, UmbracoVersion, RuntimeMinifier)"></script>
|
||||
<script src="@Url.GetUrlWithCacheBust("Application", "Preview", null!, HostingEnvironment, UmbracoVersion, RuntimeMinifier)"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -69,7 +69,7 @@
|
||||
"installApiBaseUrl": "@ViewData.GetInstallApiBaseUrl()",
|
||||
"umbracoBaseUrl": "@ViewData.GetUmbracoBaseFolder()",
|
||||
"application": {
|
||||
version: "@ViewData.GetUmbracoVersion().Major"
|
||||
version: "@ViewData.GetUmbracoVersion()?.Major"
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -42,8 +42,8 @@
|
||||
@if (hostingEnvironment.IsDebugMode)
|
||||
{
|
||||
|
||||
var reason = (string)Context.Items["reason"];
|
||||
var message = (string)Context.Items["message"];
|
||||
var reason = (string?)Context.Items["reason"];
|
||||
var message = (string?)Context.Items["message"];
|
||||
|
||||
if (!reason.IsNullOrWhiteSpace())
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace Umbraco.Cms.Core.Configuration.Models
|
||||
internal const bool StaticUseHttps = false;
|
||||
internal const int StaticVersionCheckPeriod = 7;
|
||||
internal const string StaticUmbracoPath = Constants.System.DefaultUmbracoPath;
|
||||
internal const string StaticIconsPath = "~/umbraco/assets/icons";
|
||||
internal const string StaticIconsPath = "umbraco/assets/icons";
|
||||
internal const string StaticUmbracoCssPath = "~/css";
|
||||
internal const string StaticUmbracoScriptsPath = "~/scripts";
|
||||
internal const string StaticUmbracoMediaPath = "~/media";
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.FileProviders.Internal;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Umbraco.Cms.Core.Cache;
|
||||
using Umbraco.Extensions;
|
||||
@@ -17,6 +19,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
public class LocalizedTextServiceFileSources
|
||||
{
|
||||
private readonly ILogger<LocalizedTextServiceFileSources> _logger;
|
||||
private readonly IDirectoryContents _directoryContents;
|
||||
private readonly IAppPolicyCache _cache;
|
||||
private readonly IEnumerable<LocalizedTextServiceSupplementaryFileSource>? _supplementFileSources;
|
||||
private readonly DirectoryInfo? _fileSourceFolder;
|
||||
@@ -26,6 +29,21 @@ namespace Umbraco.Cms.Core.Services
|
||||
|
||||
private readonly Lazy<Dictionary<CultureInfo, Lazy<XDocument>>> _xmlSources;
|
||||
|
||||
[Obsolete("Use ctor with all params. This will be removed in Umbraco 12")]
|
||||
public LocalizedTextServiceFileSources(
|
||||
ILogger<LocalizedTextServiceFileSources> logger,
|
||||
AppCaches appCaches,
|
||||
DirectoryInfo fileSourceFolder,
|
||||
IEnumerable<LocalizedTextServiceSupplementaryFileSource> supplementFileSources)
|
||||
:this(
|
||||
logger,
|
||||
appCaches,
|
||||
fileSourceFolder,
|
||||
supplementFileSources, new NotFoundDirectoryContents())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used to configure the file sources with the main file sources shipped with Umbraco and also including supplemental/plugin based
|
||||
/// localization files. The supplemental files will be loaded in and merged in after the primary files.
|
||||
@@ -39,36 +57,37 @@ namespace Umbraco.Cms.Core.Services
|
||||
ILogger<LocalizedTextServiceFileSources> logger,
|
||||
AppCaches appCaches,
|
||||
DirectoryInfo fileSourceFolder,
|
||||
IEnumerable<LocalizedTextServiceSupplementaryFileSource> supplementFileSources)
|
||||
IEnumerable<LocalizedTextServiceSupplementaryFileSource> supplementFileSources,
|
||||
IDirectoryContents directoryContents
|
||||
)
|
||||
{
|
||||
if (logger == null) throw new ArgumentNullException("logger");
|
||||
if (appCaches == null) throw new ArgumentNullException("cache");
|
||||
if (fileSourceFolder == null) throw new ArgumentNullException("fileSourceFolder");
|
||||
|
||||
_logger = logger;
|
||||
_directoryContents = directoryContents;
|
||||
_cache = appCaches.RuntimeCache;
|
||||
|
||||
if (fileSourceFolder.Exists == false)
|
||||
{
|
||||
_logger.LogWarning("The folder does not exist: {FileSourceFolder}, therefore no sources will be discovered", fileSourceFolder.FullName);
|
||||
}
|
||||
else
|
||||
{
|
||||
_fileSourceFolder = fileSourceFolder;
|
||||
_supplementFileSources = supplementFileSources;
|
||||
}
|
||||
_fileSourceFolder = fileSourceFolder;
|
||||
_supplementFileSources = supplementFileSources;
|
||||
|
||||
//Create the lazy source for the _xmlSources
|
||||
_xmlSources = new Lazy<Dictionary<CultureInfo, Lazy<XDocument>>>(() =>
|
||||
{
|
||||
var result = new Dictionary<CultureInfo, Lazy<XDocument>>();
|
||||
|
||||
if (_fileSourceFolder == null) return result;
|
||||
|
||||
foreach (var fileInfo in _fileSourceFolder.GetFiles("*.xml"))
|
||||
var files = GetLanguageFiles();
|
||||
|
||||
if (!files.Any())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
foreach (var fileInfo in files)
|
||||
{
|
||||
var localCopy = fileInfo;
|
||||
var filename = Path.GetFileNameWithoutExtension(localCopy.FullName).Replace("_", "-");
|
||||
var filename = Path.GetFileNameWithoutExtension(localCopy.Name).Replace("_", "-");
|
||||
|
||||
// TODO: Fix this nonsense... would have to wait until v8 to store the language files with their correct
|
||||
// names instead of storing them as 2 letters but actually having a 4 letter culture. So now, we
|
||||
@@ -80,7 +99,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
{
|
||||
//we need to open the file to see if we can read it's 'real' culture, we'll use XmlReader since we don't
|
||||
//want to load in the entire doc into mem just to read a single value
|
||||
using (var fs = fileInfo.OpenRead())
|
||||
using (var fs = fileInfo.CreateReadStream())
|
||||
using (var reader = XmlReader.Create(fs))
|
||||
{
|
||||
if (reader.IsStartElement())
|
||||
@@ -98,7 +117,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
}
|
||||
catch (CultureNotFoundException)
|
||||
{
|
||||
_logger.LogWarning("The culture {CultureValue} found in the file {CultureFile} is not a valid culture", cultureVal, fileInfo.FullName);
|
||||
_logger.LogWarning("The culture {CultureValue} found in the file {CultureFile} is not a valid culture", cultureVal, fileInfo.Name);
|
||||
//If the culture in the file is invalid, we'll just hope the file name is a valid culture below, otherwise
|
||||
// an exception will be thrown.
|
||||
}
|
||||
@@ -119,7 +138,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
XDocument xdoc;
|
||||
|
||||
//load in primary
|
||||
using (var fs = localCopy.OpenRead())
|
||||
using (var fs = localCopy.CreateReadStream())
|
||||
{
|
||||
xdoc = XDocument.Load(fs);
|
||||
}
|
||||
@@ -128,7 +147,7 @@ namespace Umbraco.Cms.Core.Services
|
||||
MergeSupplementaryFiles(culture, xdoc);
|
||||
|
||||
return xdoc;
|
||||
}, isSliding: true, timeout: TimeSpan.FromMinutes(10), dependentFiles: new[] { localCopy.FullName })!);
|
||||
}, isSliding: true, timeout: TimeSpan.FromMinutes(10))!);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
@@ -136,6 +155,30 @@ namespace Umbraco.Cms.Core.Services
|
||||
|
||||
}
|
||||
|
||||
private IEnumerable<IFileInfo> GetLanguageFiles()
|
||||
{
|
||||
var result = new List<IFileInfo>();
|
||||
|
||||
if (_fileSourceFolder is not null && _fileSourceFolder.Exists)
|
||||
{
|
||||
|
||||
result.AddRange(
|
||||
new PhysicalDirectoryContents(_fileSourceFolder.FullName)
|
||||
.Where(x => !x.IsDirectory && x.Name.EndsWith(".xml"))
|
||||
);
|
||||
}
|
||||
|
||||
if (_directoryContents.Exists)
|
||||
{
|
||||
result.AddRange(
|
||||
_directoryContents
|
||||
.Where(x => !x.IsDirectory && x.Name.EndsWith(".xml"))
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Hosting;
|
||||
using Umbraco.Cms.Core.IO;
|
||||
using Umbraco.Cms.Core.IO.MediaPathSchemes;
|
||||
using Umbraco.Extensions;
|
||||
using IHostingEnvironment = Umbraco.Cms.Core.Hosting.IHostingEnvironment;
|
||||
|
||||
namespace Umbraco.Cms.Infrastructure.DependencyInjection
|
||||
{
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Cache;
|
||||
using Umbraco.Cms.Core.Composing;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Extensions;
|
||||
@@ -24,6 +26,7 @@ using Umbraco.Cms.Infrastructure.Telemetry.Providers;
|
||||
using Umbraco.Cms.Infrastructure.Templates;
|
||||
using Umbraco.Extensions;
|
||||
using CacheInstructionService = Umbraco.Cms.Core.Services.Implement.CacheInstructionService;
|
||||
using IHostingEnvironment = Umbraco.Cms.Core.Hosting.IHostingEnvironment;
|
||||
|
||||
namespace Umbraco.Cms.Infrastructure.DependencyInjection
|
||||
{
|
||||
@@ -61,17 +64,6 @@ namespace Umbraco.Cms.Infrastructure.DependencyInjection
|
||||
return builder;
|
||||
}
|
||||
|
||||
private static LocalizedTextServiceFileSources CreateLocalizedTextServiceFileSourcesFactory(IServiceProvider container)
|
||||
{
|
||||
var hostEnvironment = container.GetRequiredService<IHostEnvironment>();
|
||||
var mainLangFolder = new DirectoryInfo(hostEnvironment.MapPathContentRoot(WebPath.Combine(Constants.SystemDirectories.Umbraco, "config", "lang")));
|
||||
|
||||
return new LocalizedTextServiceFileSources(
|
||||
container.GetRequiredService<ILogger<LocalizedTextServiceFileSources>>(),
|
||||
container.GetRequiredService<AppCaches>(),
|
||||
mainLangFolder,
|
||||
container.GetServices<LocalizedTextServiceSupplementaryFileSource>());
|
||||
}
|
||||
|
||||
private static PackagesRepository CreatePackageRepository(IServiceProvider factory, string packageRepoFileName)
|
||||
=> new PackagesRepository(
|
||||
@@ -109,5 +101,18 @@ namespace Umbraco.Cms.Infrastructure.DependencyInjection
|
||||
factory.GetRequiredService<IMediaService>(),
|
||||
factory.GetRequiredService<IMediaTypeService>());
|
||||
|
||||
private static LocalizedTextServiceFileSources CreateLocalizedTextServiceFileSourcesFactory(IServiceProvider container)
|
||||
{
|
||||
var hostingEnvironment = container.GetRequiredService<IHostingEnvironment>();
|
||||
var subPath = WebPath.Combine(Constants.SystemDirectories.Umbraco, "config", "lang");
|
||||
var mainLangFolder = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(subPath));
|
||||
|
||||
return new LocalizedTextServiceFileSources(
|
||||
container.GetRequiredService<ILogger<LocalizedTextServiceFileSources>>(),
|
||||
container.GetRequiredService<AppCaches>(),
|
||||
mainLangFolder,
|
||||
container.GetServices<LocalizedTextServiceSupplementaryFileSource>(),
|
||||
new EmbeddedFileProvider(typeof(IAssemblyProvider).Assembly, "Umbraco.Cms.Core.EmbeddedResources.Lang").GetDirectoryContents(string.Empty));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,5 +116,4 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -7,8 +7,7 @@ using Umbraco.Cms.Core.Hosting;
|
||||
using Umbraco.Cms.Web.BackOffice.Middleware;
|
||||
using Umbraco.Cms.Web.BackOffice.Routing;
|
||||
using Umbraco.Cms.Web.Common.ApplicationBuilder;
|
||||
using Umbraco.Cms.Web.Common.Extensions;
|
||||
using Umbraco.Cms.Web.Common.Middleware;
|
||||
|
||||
|
||||
namespace Umbraco.Extensions
|
||||
{
|
||||
|
||||
@@ -2,14 +2,18 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Cms.Core;
|
||||
using Umbraco.Cms.Core.Cache;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Hosting;
|
||||
using Umbraco.Cms.Core.Models;
|
||||
using Umbraco.Cms.Core.Services;
|
||||
using Umbraco.Cms.Web.Common.DependencyInjection;
|
||||
using Umbraco.Extensions;
|
||||
using IHostingEnvironment = Umbraco.Cms.Core.Hosting.IHostingEnvironment;
|
||||
|
||||
namespace Umbraco.Cms.Web.BackOffice.Services
|
||||
{
|
||||
@@ -17,15 +21,32 @@ namespace Umbraco.Cms.Web.BackOffice.Services
|
||||
{
|
||||
private GlobalSettings _globalSettings;
|
||||
private readonly IHostingEnvironment _hostingEnvironment;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IAppPolicyCache _cache;
|
||||
|
||||
[Obsolete("Use other ctor - Will be removed in Umbraco 12")]
|
||||
public IconService(
|
||||
IOptionsMonitor<GlobalSettings> globalSettings,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
AppCaches appCaches)
|
||||
: this(globalSettings,
|
||||
hostingEnvironment,
|
||||
appCaches,
|
||||
StaticServiceProvider.Instance.GetRequiredService<IWebHostEnvironment>())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Obsolete("Use other ctor - Will be removed in Umbraco 12")]
|
||||
public IconService(
|
||||
IOptionsMonitor<GlobalSettings> globalSettings,
|
||||
IHostingEnvironment hostingEnvironment,
|
||||
AppCaches appCaches,
|
||||
IWebHostEnvironment webHostEnvironment)
|
||||
{
|
||||
_globalSettings = globalSettings.CurrentValue;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_cache = appCaches.RuntimeCache;
|
||||
|
||||
globalSettings.OnChange(x => _globalSettings = x);
|
||||
@@ -125,9 +146,11 @@ namespace Umbraco.Cms.Web.BackOffice.Services
|
||||
}
|
||||
}
|
||||
|
||||
// add icons from IconsPath if not already added from plugins
|
||||
var coreIconsDirectory = new DirectoryInfo(_hostingEnvironment.MapPathWebRoot($"{_globalSettings.IconsPath}/"));
|
||||
var coreIcons = coreIconsDirectory.GetFiles("*.svg");
|
||||
var iconFolder = _webHostEnvironment.WebRootFileProvider.GetDirectoryContents(_globalSettings.IconsPath);
|
||||
|
||||
var coreIcons = iconFolder
|
||||
.Where(x => !x.IsDirectory && x.Name.EndsWith(".svg"))
|
||||
.Select(x => new FileInfo(x.PhysicalPath));
|
||||
|
||||
icons.UnionWith(coreIcons);
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ using Umbraco.Cms.Core.Configuration;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.Extensions;
|
||||
using Umbraco.Cms.Core.Models.PublishedContent;
|
||||
using Umbraco.Cms.Web.Common.Extensions;
|
||||
using Umbraco.Extensions;
|
||||
using IHostingEnvironment = Umbraco.Cms.Core.Hosting.IHostingEnvironment;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ using System;
|
||||
using Microsoft.AspNetCore.DataProtection.Infrastructure;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Web.Common.Extensions
|
||||
namespace Umbraco.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains extension methods for the <see cref="IApplicationDiscriminator" /> interface.
|
||||
|
||||
@@ -4,7 +4,7 @@ using Smidge.Nuglify;
|
||||
using Umbraco.Cms.Web.Common.ApplicationBuilder;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Web.Common.Extensions
|
||||
namespace Umbraco.Extensions
|
||||
{
|
||||
public static partial class UmbracoApplicationBuilderExtensions
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Umbraco.Cms.Core;
|
||||
|
||||
namespace Umbraco.Cms.Web.Common.Extensions
|
||||
namespace Umbraco.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains extension methods for the <see cref="IWebHostEnvironment" /> interface.
|
||||
@@ -20,6 +21,12 @@ namespace Umbraco.Cms.Web.Common.Extensions
|
||||
{
|
||||
var root = webHostEnvironment.WebRootPath;
|
||||
|
||||
//Create if missing
|
||||
if (string.IsNullOrWhiteSpace(root))
|
||||
{
|
||||
root = webHostEnvironment.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot");
|
||||
}
|
||||
|
||||
var newPath = path.Replace('/', Path.DirectorySeparatorChar).Replace('\\', Path.DirectorySeparatorChar);
|
||||
|
||||
// TODO: This is a temporary error because we switched from IOHelper.MapPath to HostingEnvironment.MapPathXXX
|
||||
@@ -32,7 +39,7 @@ namespace Umbraco.Cms.Web.Common.Extensions
|
||||
throw new ArgumentException("The path appears to already be fully qualified. Please remove the call to MapPathWebRoot");
|
||||
}
|
||||
|
||||
return Path.Combine(root, newPath.TrimStart(Core.Constants.CharArrays.TildeForwardSlashBackSlash));
|
||||
return Path.Combine(root, newPath.TrimStart(Constants.CharArrays.TildeForwardSlashBackSlash));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.DataProtection.Infrastructure;
|
||||
using Serilog.Core;
|
||||
using Serilog.Events;
|
||||
using Umbraco.Cms.Web.Common.Extensions;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Web.Common.Logging.Enrichers;
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ module.exports = {
|
||||
assets: "./src/assets/**"
|
||||
}
|
||||
},
|
||||
roots: ["../Umbraco.Web.UI/wwwroot/"],
|
||||
roots: ["../Umbraco.Cms.StaticAssets/wwwroot/"],
|
||||
targets: {
|
||||
js: "umbraco/js/",
|
||||
lib: "umbraco/lib/",
|
||||
|
||||
@@ -34,12 +34,12 @@ module.exports = function (config) {
|
||||
'test/config/app.unit.js',
|
||||
|
||||
//application files
|
||||
'../Umbraco.Web.UI/wwwroot/umbraco/js/*.controllers.min.js',
|
||||
'../Umbraco.Web.UI/wwwroot/umbraco/js/*.directives.min.js',
|
||||
'../Umbraco.Web.UI/wwwroot/umbraco/js/*.filters.min.js',
|
||||
'../Umbraco.Web.UI/wwwroot/umbraco/js/*.services.min.js',
|
||||
'../Umbraco.Web.UI/wwwroot/umbraco/js/*.interceptors.min.js',
|
||||
'../Umbraco.Web.UI/wwwroot/umbraco/js/*.resources.min.js',
|
||||
'../Umbraco.Cms.StaticAssets/wwwroot/umbraco/js/*.controllers.min.js',
|
||||
'../Umbraco.Cms.StaticAssets/wwwroot/umbraco/js/*.directives.min.js',
|
||||
'../Umbraco.Cms.StaticAssets/wwwroot/umbraco/js/*.filters.min.js',
|
||||
'../Umbraco.Cms.StaticAssets/wwwroot/umbraco/js/*.services.min.js',
|
||||
'../Umbraco.Cms.StaticAssets/wwwroot/umbraco/js/*.interceptors.min.js',
|
||||
'../Umbraco.Cms.StaticAssets/wwwroot/umbraco/js/*.resources.min.js',
|
||||
|
||||
//mocked data and routing
|
||||
'src/common/mocks/umbraco.servervariables.js',
|
||||
|
||||
@@ -14,6 +14,10 @@ namespace Umbraco.Cms.Web.UI
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureUmbracoDefaults()
|
||||
.ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStaticWebAssets();
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,6 @@
|
||||
<RootNamespace>Umbraco.Cms.Web.UI</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="../../build/NuSpecs/buildTransitive/Umbraco.Cms.StaticAssets.props" />
|
||||
<PropertyGroup>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);wwwroot/umbraco/**</DefaultItemExcludes>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<DocumentationFile>bin/Release/Umbraco.Web.UI.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
@@ -23,6 +18,7 @@
|
||||
<ProjectReference Include="../Umbraco.Web.BackOffice/Umbraco.Web.BackOffice.csproj" />
|
||||
<ProjectReference Include="../Umbraco.Web.Common/Umbraco.Web.Common.csproj" />
|
||||
<ProjectReference Include="../Umbraco.Web.Website/Umbraco.Web.Website.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Cms.StaticAssets\Umbraco.Cms.StaticAssets.csproj" />
|
||||
<!-- <ProjectReference Include="../Umbraco.Persistence.SqlCe/Umbraco.Persistence.SqlCe.csproj" Condition="'$(OS)' == 'Windows_NT'" />-->
|
||||
<ProjectReference Include="..\Umbraco.PublishedCache.NuCache\Umbraco.PublishedCache.NuCache.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Web.BackOffice\Umbraco.Web.BackOffice.csproj" />
|
||||
@@ -50,7 +46,6 @@
|
||||
<PackageReference Include="Umbraco.Code" Version="2.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<_ContentIncludedByDefault Remove="wwwroot\umbraco\views\common\infiniteeditors\twofactor\enabletwofactor.html" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@@ -60,22 +55,13 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<BellePath>$(ProjectDir)wwwroot/umbraco</BellePath>
|
||||
<JsonSchemaPath>$(ProjectDir)umbraco/config/appsettings-schema.json</JsonSchemaPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="CheckPreconditions" BeforeTargets="Build">
|
||||
<Message Text="-CheckPreconditions-" Importance="high" />
|
||||
<Message Text="JsonSchemaPath: $(JsonSchemaPath)" Importance="high" />
|
||||
<Message Text="BellePath: $(BellePath)" Importance="high" />
|
||||
|
||||
<!-- Build Belle, if building is Visual Studio and the build folder does not exist yet -->
|
||||
<Message Text="Skip Belle because UmbracoBuild is '$(UmbracoBuild)' (this is not Visual Studio)." Importance="High" Condition="'$(UmbracoBuild)' != ''" />
|
||||
<Message Text="Skip Belle because $(BellePath) exists." Importance="High" Condition="Exists('$(BellePath)')" />
|
||||
<Message Text="Build Belle because UmbracoBuild is empty (this is Visual Studio), and $(BellePath) does not exist." Importance="High" Condition="!Exists('$(BellePath)') and '$(UmbracoBuild)' == ''" />
|
||||
<CallTarget Targets="BelleBuild" Condition="!Exists('$(BellePath)') and '$(UmbracoBuild)' == ''" />
|
||||
<Message Text="Skip JsonSchema generation because $(JsonSchemaPath) exists." Importance="High" Condition="Exists('$(JsonSchemaPath)')" />
|
||||
<Message Text="Generate the appsettings json schema." Importance="High" Condition="!Exists('$(JsonSchemaPath)') and '$(UmbracoBuild)' == ''" />
|
||||
<CallTarget Targets="JsonSchemaBuild" Condition="!Exists('$(JsonSchemaPath)') and '$(UmbracoBuild)' == ''" />
|
||||
|
||||
|
||||
@@ -83,10 +69,7 @@
|
||||
<CallTarget Targets="AppsettingsDevBuild" Condition="!Exists('appsettings.Development.json')" />
|
||||
</Target>
|
||||
|
||||
<Target Name="BelleBuild">
|
||||
<Exec WorkingDirectory="$(ProjectDir)/../Umbraco.Web.UI.Client/" Command="npm ci --no-fund --no-audit --prefer-offline" />
|
||||
<Exec WorkingDirectory="$(ProjectDir)/../Umbraco.Web.UI.Client/" Command="npm run build:skip-tests" />
|
||||
</Target>
|
||||
|
||||
|
||||
<Target Name="JsonSchemaBuild">
|
||||
<!-- <Exec WorkingDirectory="$(ProjectDir)/../../" Command="powershell -ExecutionPolicy RemoteSigned -Command '&dotnet run --project $pwd/src/JsonSchema/JsonSchema.csproj -c Release -- --outputFile $pwd/src/Umbraco.Web.UI/$(JsonSchemaPath)'" /> -->
|
||||
@@ -102,18 +85,4 @@
|
||||
<Copy SourceFiles="$(ProjectDir)appsettings.Development.template.json" DestinationFiles="$(ProjectDir)appsettings.Development.json" />
|
||||
</Target>
|
||||
|
||||
<!-- Clean Belle when cleaning and rebuilding, but only in Visual Studio -->
|
||||
<Target Name="CleanPreconditions" AfterTargets="Clean" Condition="'$(UmbracoBuild)' == ''">
|
||||
<Message Text="-CleanPreconditions-" Importance="high" />
|
||||
<Message Text="Nothing to clean, as $(BellePath) does not exist." Importance="High" Condition="!Exists('$(BellePath)')" />
|
||||
<Message Text="Not cleaning (found src/preserve.belle)." Importance="High" Condition="Exists('$(BellePath)') and Exists('$(SolutionDir)preserve.belle')" />
|
||||
<Message Text="Remove $(BellePath)." Importance="High" Condition="Exists('$(BellePath)') and !Exists('$(SolutionDir)preserve.belle')" />
|
||||
<ItemGroup>
|
||||
<BelleLib Include="$(BellePath)" />
|
||||
</ItemGroup>
|
||||
<RemoveDir Directories="@(BelleLib)" Condition="Exists('$(BellePath)') and !Exists('$(SolutionDir)preserve.belle')" />
|
||||
<Message Text="Remove $(JsonSchemaPath)." Importance="High" Condition="Exists('$(JsonSchemaPath)') and !Exists('$(SolutionDir)preserve.jsonschema')" />
|
||||
<Delete Files="$(JsonSchemaPath)" Condition="Exists('$(JsonSchemaPath)') and !Exists('$(SolutionDir)preserve.jsonschema')" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
<CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Keep this as false if ModelsBuilder mode is InMemoryAuto -->
|
||||
<PropertyGroup>
|
||||
<RazorCompileOnBuild>false</RazorCompileOnBuild>
|
||||
|
||||
@@ -8,11 +8,13 @@ using System.Linq;
|
||||
using Examine;
|
||||
using Examine.Lucene.Directories;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Cms.Core.Cache;
|
||||
using Umbraco.Cms.Core.Composing;
|
||||
using Umbraco.Cms.Core.Configuration.Models;
|
||||
using Umbraco.Cms.Core.DependencyInjection;
|
||||
using Umbraco.Cms.Core.Logging;
|
||||
@@ -90,7 +92,9 @@ namespace Umbraco.Cms.Tests.Integration.DependencyInjection
|
||||
return new LocalizedTextServiceFileSources(
|
||||
loggerFactory.CreateLogger<LocalizedTextServiceFileSources>(),
|
||||
appCaches,
|
||||
mainLangFolder);
|
||||
mainLangFolder,
|
||||
Array.Empty<LocalizedTextServiceSupplementaryFileSource>(),
|
||||
new EmbeddedFileProvider(typeof(IAssemblyProvider).Assembly, "Umbraco.Cms.Core.EmbeddedResources.Lang").GetDirectoryContents(string.Empty));
|
||||
}),
|
||||
loggerFactory.CreateLogger<LocalizedTextService>());
|
||||
|
||||
|
||||
@@ -88,7 +88,6 @@
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.4" />
|
||||
<PackageReference Include="Bogus" Version="34.0.2" />
|
||||
<PackageReference Include="Examine.Lucene" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="Moq" Version="4.17.2" />
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configurations
|
||||
{
|
||||
[TestFixture]
|
||||
public class LanguageXmlTests
|
||||
{
|
||||
[Test]
|
||||
[Platform("Win")] //TODO figure out why Path.GetFullPath("/mnt/c/...") is not considered an absolute path on linux + mac
|
||||
public void Can_Load_Language_Xml_Files()
|
||||
{
|
||||
var languageDirectoryPath = GetLanguageDirectory();
|
||||
var readFilesCount = 0;
|
||||
var xmlDocument = new XmlDocument();
|
||||
|
||||
var directoryInfo = new DirectoryInfo(languageDirectoryPath);
|
||||
|
||||
foreach (var languageFile in directoryInfo.GetFiles("*.xml", SearchOption.TopDirectoryOnly))
|
||||
{
|
||||
// Load will throw an exception if the XML isn't valid.
|
||||
xmlDocument.Load(languageFile.FullName);
|
||||
readFilesCount++;
|
||||
}
|
||||
|
||||
// Ensure that at least one file was read.
|
||||
Assert.AreNotEqual(0, readFilesCount);
|
||||
}
|
||||
|
||||
private static string GetLanguageDirectory()
|
||||
{
|
||||
var testDirectoryPathParts = Path.GetDirectoryName(TestContext.CurrentContext.TestDirectory)
|
||||
.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
var solutionDirectoryPathParts = testDirectoryPathParts
|
||||
.Take(Array.IndexOf(testDirectoryPathParts, "tests"));
|
||||
var languageFolderPathParts = new List<string>(solutionDirectoryPathParts);
|
||||
var additionalPathParts = new[] { "Umbraco.Web.UI", "umbraco", "config", "lang" };
|
||||
languageFolderPathParts.AddRange(additionalPathParts);
|
||||
|
||||
// Hack for build-server - when this path is generated in that envrionment it's missing the "src" folder.
|
||||
// Not sure why, but if it's missing we'll add it in the right place.
|
||||
if (!languageFolderPathParts.Contains("src"))
|
||||
{
|
||||
languageFolderPathParts.Insert(languageFolderPathParts.Count - additionalPathParts.Length, "src");
|
||||
}
|
||||
|
||||
return string.Join(Path.DirectorySeparatorChar.ToString(), languageFolderPathParts);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Web.Common
|
||||
private IEnumerable<string> GetUiFiles(IEnumerable<string> pathFromNetCore)
|
||||
{
|
||||
var root = TestContext.CurrentContext.TestDirectory.Split("tests")[0];
|
||||
var pathToFiles = Path.Combine(root, "src", "Umbraco.Web.UI");
|
||||
var pathToFiles = Path.Combine(root, "src", "Umbraco.Cms.StaticAssets");
|
||||
foreach (var pathSection in pathFromNetCore)
|
||||
{
|
||||
pathToFiles = Path.Combine(pathToFiles, pathSection);
|
||||
@@ -95,17 +95,5 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Web.Common
|
||||
Assert.True(views.Contains(fileName), $"Expected {fileName} to exist, but it didn't");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LanguageFilesAreLowercase()
|
||||
{
|
||||
IEnumerable<string> files = GetUiFiles(new[] { "umbraco", "config", "lang" });
|
||||
foreach (var fileName in files)
|
||||
{
|
||||
Assert.AreEqual(
|
||||
fileName.ToLower(),
|
||||
fileName,
|
||||
$"Language files must be all lowercase but {fileName} is not lowercase.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
16
umbraco.sln
16
umbraco.sln
@@ -29,7 +29,6 @@ EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpecs", "NuSpecs", "{227C3B55-80E5-4E7E-A802-BE16C5128B9D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
build\NuSpecs\UmbracoCms.nuspec = build\NuSpecs\UmbracoCms.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}"
|
||||
@@ -78,12 +77,6 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Umbraco.Tests.AcceptanceTes
|
||||
StartServerOnDebug = "false"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "buildTransitive", "buildTransitive", "{5B03EF4E-E0AC-4905-861B-8C3EC1A0D458}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
build\NuSpecs\buildTransitive\Umbraco.Cms.StaticAssets.props = build\NuSpecs\buildTransitive\Umbraco.Cms.StaticAssets.props
|
||||
build\NuSpecs\buildTransitive\Umbraco.Cms.StaticAssets.targets = build\NuSpecs\buildTransitive\Umbraco.Cms.StaticAssets.targets
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DocTools", "DocTools", "{53594E5B-64A2-4545-8367-E3627D266AE8}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\ApiDocs\docfx.filter.yml = src\ApiDocs\docfx.filter.yml
|
||||
@@ -131,6 +124,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Cms.Persistence.Sql
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Cms.Persistence.SqlServer", "src\Umbraco.Cms.Persistence.SqlServer\Umbraco.Cms.Persistence.SqlServer.csproj", "{93C5910D-2E36-475D-88EB-A11BA5B50F65}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Cms.StaticAssets", "src\Umbraco.Cms.StaticAssets\Umbraco.Cms.StaticAssets.csproj", "{D2FD54E8-3470-4A98-8B0C-A9ACB59BED48}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -235,6 +230,12 @@ Global
|
||||
{93C5910D-2E36-475D-88EB-A11BA5B50F65}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{93C5910D-2E36-475D-88EB-A11BA5B50F65}.SkipTests|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{93C5910D-2E36-475D-88EB-A11BA5B50F65}.SkipTests|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D2FD54E8-3470-4A98-8B0C-A9ACB59BED48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D2FD54E8-3470-4A98-8B0C-A9ACB59BED48}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D2FD54E8-3470-4A98-8B0C-A9ACB59BED48}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D2FD54E8-3470-4A98-8B0C-A9ACB59BED48}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D2FD54E8-3470-4A98-8B0C-A9ACB59BED48}.SkipTests|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D2FD54E8-3470-4A98-8B0C-A9ACB59BED48}.SkipTests|Any CPU.Build.0 = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -242,7 +243,6 @@ Global
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{227C3B55-80E5-4E7E-A802-BE16C5128B9D} = {2849E9D4-3B4E-40A3-A309-F3CB4F0E125F}
|
||||
{9E4C8A12-FBE0-4673-8CE2-DF99D5D57817} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
{5B03EF4E-E0AC-4905-861B-8C3EC1A0D458} = {227C3B55-80E5-4E7E-A802-BE16C5128B9D}
|
||||
{53594E5B-64A2-4545-8367-E3627D266AE8} = {FD962632-184C-4005-A5F3-E705D92FC645}
|
||||
{3A33ADC9-C6C0-4DB1-A613-A9AF0210DF3D} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
{C7311C00-2184-409B-B506-52A5FAEA8736} = {FD962632-184C-4005-A5F3-E705D92FC645}
|
||||
|
||||
Reference in New Issue
Block a user