Files
Umbraco-CMS/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj
Bjarke Berg 699626a650 Bugfix: Reintroduces DefaultItemExcludes in Umbraco.Cms.StaticAssets (#12335)
* DefaultItemExcludes from Umbraco.Cms.StaticAssets

* Update src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj

Co-authored-by: Ronald Barendse <ronald@barend.se>

Co-authored-by: Ronald Barendse <ronald@barend.se>
2022-05-03 12:35:52 +02:00

84 lines
4.8 KiB
XML

<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>
<None Include="buildTransitive\**\*.*">
<Pack>true</Pack>
<PackagePath>buildTransitive</PackagePath>
</None>
</ItemGroup>
<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>
<!--
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\**" />
<ContentWithTargetPath Include="@(_UmbracoFolderFiles)" Exclude="@(ContentWithTargetPath)" TargetPath="%(Identity)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
</Target>
</Project>