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:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -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
|
||||
|
||||
@@ -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!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
|
||||
@@ -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 "../Umbraco.Cms/appsettings-schema.json"" />
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="buildTransitive\**" PackagePath="buildTransitive" />
|
||||
</ItemGroup>
|
||||
|
||||
16
src/Umbraco.Cms/buildTransitive/Umbraco.Cms.targets
Normal file
16
src/Umbraco.Cms/buildTransitive/Umbraco.Cms.targets
Normal 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>
|
||||
@@ -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 '&dotnet run --project $pwd/src/JsonSchema/JsonSchema.csproj -c Release -- --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 "$(ProjectDir)appsettings-schema.json"" />
|
||||
</Target>
|
||||
|
||||
<Target Name="AppsettingsBuild">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema" : "./umbraco/config/appsettings-schema.json",
|
||||
"$schema" : "./appsettings-schema.json",
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "./umbraco/config/appsettings-schema.json",
|
||||
"$schema": "./appsettings-schema.json",
|
||||
"ConnectionStrings": {
|
||||
"umbracoDbDSN": ""
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "./umbraco/config/appsettings-schema.json",
|
||||
"$schema": "./appsettings-schema.json",
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "./umbraco/config/appsettings-schema.json",
|
||||
"$schema": "./appsettings-schema.json",
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
|
||||
Reference in New Issue
Block a user