V10: Reintroduce appsettings-schema.json (#12416)

* Reintroduce language files tests (#12367)

* Reintroducing language files tests

* Fix casing

* Update tests/Umbraco.Tests.UnitTests/Umbraco.Core/EmbeddedResources/LanguageXmlTests.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Change Umbraco.Cms and Umbraco.Templates nuspecs to csproj

* Remove Umbraco.Templates from VerifyNuGet step

* Remove duplicate and unnecessary properties

* Generate json schema on build

* Add targets file

* Gitignore auto generated appsettings schema

* Fix build not copying file

* Use the new path in appsettings

* Update copy message

* Build json schema as release

* Update json schema options

Otherwise just running the project will put the file in the wrong place

* Generate schema if it doesn't exist in Web.Ui

* Update json schema options

Otherwise just running the project will put the file in the wrong place

Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com>
Co-authored-by: Ronald Barendse <ronald@barend.se>
This commit is contained in:
Mole
2022-05-19 09:57:21 +02:00
committed by GitHub
parent dd617ede80
commit ee8359af75
10 changed files with 52 additions and 13 deletions

3
.gitignore vendored
View File

@@ -102,4 +102,5 @@ cypress.env.json
/tests/Umbraco.Tests.UnitTests/[Uu]mbraco/[Dd]ata/TEMP/
# Ignore auto-generated schema
/src/Umbraco.Web.UI/[Uu]mbraco/config/appsettings-schema.json
/src/Umbraco.Web.UI/appsettings-schema.json
/src/Umbraco.Cms/appsettings-schema.json

View File

@@ -7,7 +7,7 @@ namespace JsonSchema
{
internal class Options
{
[Option('o', "outputFile", Required = false, HelpText = "Set path of the output file.", Default = "../../../../Umbraco.Web.UI/umbraco/config/appsettings-schema.json")]
[Option('o', "outputFile", Required = false, HelpText = "Set path of the output file.", Default = "../../../../Umbraco.Web.UI/appsettings-schema.json")]
public string OutputFile { get; set; } = null!;
}
}

View File

@@ -37,8 +37,6 @@
<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>
@@ -57,8 +55,6 @@
<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>

View File

@@ -7,6 +7,7 @@
<Description>Installs Umbraco CMS in your ASP.NET Core project</Description>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Cms.Persistence.Sqlite\Umbraco.Cms.Persistence.Sqlite.csproj" />
<ProjectReference Include="..\Umbraco.Cms.Persistence.SqlServer\Umbraco.Cms.Persistence.SqlServer.csproj" />
@@ -15,6 +16,29 @@
<ProjectReference Include="..\Umbraco.Web.Website\Umbraco.Web.Website.csproj" />
</ItemGroup>
<PropertyGroup>
<JsonSchemaPath>$(ProjectDir)appsettings-schema.json</JsonSchemaPath>
<JsonSchemaProjectPath>$(ProjectDir)../JsonSchema/</JsonSchemaProjectPath>
</PropertyGroup>
<ItemGroup>
<Content Include="buildTransitive\**" PackagePath="buildTransitive" />
<Content Include="$(JsonSchemaPath)" PackagePath="."/>
</ItemGroup>
<Target Name="CheckPreConditions" BeforeTargets="Build">
<Message Text="JsonSchemaPath: $(JsonSchemaPath)" Importance="high" />
<Message Text="Skip JsonSchema generation because $(JsonSchemaPath) exists." Condition="Exists('$(JsonSchemaPath)')" />
<Message Text="Generate the appsettings json schema." Importance="high" Condition="!Exists('$(JsonSchemaPath)')" />
<CallTarget Targets="JsonSchemaBuild" Condition="!Exists('$(JsonSchemaPath)')" />
</Target>
<Target Name="JsonSchemaBuild">
<Exec WorkingDirectory="$(JsonSchemaProjectPath)" Command="dotnet run -c Release -o &quot;../Umbraco.Cms/appsettings-schema.json&quot;" />
</Target>
<ItemGroup>
<Content Include="buildTransitive\**" PackagePath="buildTransitive" />
</ItemGroup>

View File

@@ -0,0 +1,16 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SchemaFilePath>$(MSBuildThisFileDirectory)..\appsettings-schema.json</SchemaFilePath>
</PropertyGroup>
<Target Name="CopyUmbracoSchema" BeforeTargets="Build">
<ItemGroup>
<SchemaFile Include="$(SchemaFilePath)"/>
</ItemGroup>
<Message Text="Copying Umbraco json schema file" Importance="high"/>
<Copy SourceFiles="@(SchemaFile)"
DestinationFolder="$(MSBuildProjectDirectory)"
SkipUnchangedFiles="true" />
</Target>
</Project>

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@@ -41,7 +41,8 @@
</PropertyGroup>
<PropertyGroup>
<JsonSchemaPath>$(ProjectDir)umbraco/config/appsettings-schema.json</JsonSchemaPath>
<JsonSchemaPath>$(ProjectDir)appsettings-schema.json</JsonSchemaPath>
<JsonSchemaProjectPath>$(ProjectDir)../JsonSchema/JsonSchema.csproj</JsonSchemaProjectPath>
</PropertyGroup>
<Target Name="CheckPreconditions" BeforeTargets="Build">
@@ -58,7 +59,8 @@
<Target Name="JsonSchemaBuild">
<!-- <Exec WorkingDirectory="$(ProjectDir)/../../" Command="powershell -ExecutionPolicy RemoteSigned -Command '&amp;dotnet run &#45;&#45;project $pwd/src/JsonSchema/JsonSchema.csproj -c Release &#45;&#45; &#45;&#45;outputFile $pwd/src/Umbraco.Web.UI/$(JsonSchemaPath)'" /> -->
<Exec Command="dotnet run -c Release --project $(JsonSchemaProjectPath) -o $(ProjectDir)appsettings-schema.json" />
<Exec Command="dotnet run -c Release --project $(JsonSchemaProjectPath) -o &quot;$(ProjectDir)appsettings-schema.json&quot;" />
</Target>
<Target Name="AppsettingsBuild">

View File

@@ -1,5 +1,5 @@
{
"$schema" : "./umbraco/config/appsettings-schema.json",
"$schema" : "./appsettings-schema.json",
"Serilog": {
"MinimumLevel": {
"Default": "Information",

View File

@@ -1,5 +1,5 @@
{
"$schema": "./umbraco/config/appsettings-schema.json",
"$schema": "./appsettings-schema.json",
"ConnectionStrings": {
"umbracoDbDSN": ""
},

View File

@@ -1,5 +1,5 @@
{
"$schema": "./umbraco/config/appsettings-schema.json",
"$schema": "./appsettings-schema.json",
"Serilog": {
"MinimumLevel": {
"Default": "Information"

View File

@@ -1,5 +1,5 @@
{
"$schema": "./umbraco/config/appsettings-schema.json",
"$schema": "./appsettings-schema.json",
"Serilog": {
"MinimumLevel": {
"Default": "Information",