Skip to content

Commit a1379f1

Browse files
committed
Merge branch 'contrib' into v15/dev
2 parents dfc6ead + 38e9781 commit a1379f1

File tree

1 file changed

+60
-13
lines changed

1 file changed

+60
-13
lines changed

src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,36 @@
2626
<ProjectReference Include="..\Umbraco.Web.Website\Umbraco.Web.Website.csproj" />
2727
</ItemGroup>
2828

29-
<!-- Restore and build backoffice project -->
29+
<!-- General ignored files -->
30+
<ItemGroup>
31+
<Content Remove="wwwroot\umbraco\assets\README.md" />
32+
</ItemGroup>
33+
34+
35+
36+
<!-- BEGIN: Restore and build backoffice project -->
3037
<PropertyGroup>
3138
<BackofficeProjectDirectory Condition="'$(BackofficeProjectDirectory)' == ''">..\Umbraco.Web.UI.Client\</BackofficeProjectDirectory>
32-
<BackofficeAssetsPath>wwwroot\umbraco\backoffice</BackofficeAssetsPath>
39+
<BackofficeAssetsPath>$(ProjectDir)wwwroot\umbraco\backoffice</BackofficeAssetsPath>
3340
</PropertyGroup>
3441

3542
<ItemGroup>
36-
<BackofficeAssetsInputs Include="$(BackofficeProjectDirectory)package.json;$(BackofficeProjectDirectory)package-lock.json;$(BackofficeProjectDirectory)src\**" Exclude="$(DefaultItemExcludes)" />
3743
<Content Remove="$(BackofficeAssetsPath)\**" />
3844
</ItemGroup>
3945

46+
<Target Name="BuildStaticAssetsPreconditions" BeforeTargets="AssignTargetPaths">
47+
<Message Text="Skip BuildBackoffice target because UmbracoBuild is '$(UmbracoBuild)' (this is not Visual Studio)" Importance="high" Condition="'$(UmbracoBuild)' != ''" />
48+
<Message Text="Skip BuildBackoffice target because '$(BackofficeAssetsPath)' already exists" Importance="high" Condition="Exists('$(BackofficeAssetsPath)')" />
49+
<Message Text="Call BuildBackoffice target because UmbracoBuild is empty (this is Visual Studio) and '$(BackofficeAssetsPath)' doesn't exist" Importance="high" Condition="'$(UmbracoBuild)' == '' and !Exists('$(BackofficeAssetsPath)')" />
50+
<CallTarget Targets="BuildBackoffice" Condition="'$(UmbracoBuild)' == '' and !Exists('$(BackofficeAssetsPath)')" />
51+
</Target>
52+
4053
<Target Name="RestoreBackoffice" Inputs="$(BackofficeProjectDirectory)package-lock.json" Outputs="$(BackofficeProjectDirectory)node_modules\.package-lock.json">
4154
<Message Importance="high" Text="Restoring Backoffice NPM packages..." />
42-
<Exec Command="npm ci --no-fund --no-audit --prefer-offline" WorkingDirectory="$(BackofficeProjectDirectory)" />
55+
<Exec Command="npm i --no-fund --no-audit" WorkingDirectory="$(BackofficeProjectDirectory)" />
4356
</Target>
4457

45-
<Target Name="BuildBackoffice" DependsOnTargets="RestoreBackoffice" BeforeTargets="AssignTargetPaths" Inputs="@(BackofficeAssetsInputs)" Outputs="$(IntermediateOutputPath)backoffice.complete.txt">
58+
<Target Name="BuildBackoffice" DependsOnTargets="RestoreBackoffice">
4659
<Message Importance="high" Text="Executing Backoffice NPM build script..." />
4760
<Exec Command="npm run build:for:cms" WorkingDirectory="$(BackofficeProjectDirectory)" />
4861
<ItemGroup>
@@ -61,27 +74,46 @@
6174
</DefineStaticWebAssets>
6275
</Target>
6376

64-
<!-- Restore and build login project -->
77+
<Target Name="CleanStaticAssetsPreconditions" AfterTargets="Clean" Condition="'$(UmbracoBuild)' == ''">
78+
<Message Text="Skip CleanBackoffice target because '$(BackofficeAssetsPath)' doesn't exist" Importance="high" Condition="!Exists('$(BackofficeAssetsPath)')" />
79+
<Message Text="Skip CleanBackoffice target because preserve.backoffice marker file exists" Importance="high" Condition="Exists('$(BackofficeAssetsPath)') and Exists('$(SolutionDir)preserve.backoffice')" />
80+
<Message Text="Call CleanBackoffice target because '$(BackofficeAssetsPath)' exists and preserve.backoffice marker file doesn't exist" Importance="high" Condition="Exists('$(BackofficeAssetsPath)') and !Exists('$(SolutionDir)preserve.backoffice')" />
81+
<CallTarget Targets="CleanBackoffice" Condition="Exists('$(BackofficeAssetsPath)') and !Exists('$(SolutionDir)preserve.backoffice')" />
82+
</Target>
83+
84+
<Target Name="CleanBackoffice">
85+
<ItemGroup>
86+
<BackofficeDirectories Include="$(BackofficeAssetsPath)" />
87+
</ItemGroup>
88+
<RemoveDir Directories="@(BackofficeDirectories)" />
89+
</Target>
90+
<!-- END: Restore and build backoffice project -->
91+
92+
93+
94+
<!-- BEGIN: Restore and build login project -->
6595
<PropertyGroup>
6696
<LoginProjectDirectory Condition="'$(LoginProjectDirectory)' == ''">..\Umbraco.Web.UI.Login\</LoginProjectDirectory>
67-
<LoginAssetsPath>wwwroot\umbraco\login</LoginAssetsPath>
97+
<LoginAssetsPath>$(ProjectDir)wwwroot\umbraco\login</LoginAssetsPath>
6898
</PropertyGroup>
6999

70100
<ItemGroup>
71-
<LoginAssetsInputs Include="$(LoginProjectDirectory)**" Exclude="$(DefaultItemExcludes)" />
72101
<Content Remove="$(LoginAssetsPath)\**" />
73102
</ItemGroup>
74103

75-
<ItemGroup>
76-
<Content Remove="wwwroot\umbraco\assets\README.md" />
77-
</ItemGroup>
104+
<Target Name="BuildLoginStaticAssetsPreconditions" BeforeTargets="AssignTargetPaths">
105+
<Message Text="Skip BuildLogin target because UmbracoBuild is '$(UmbracoBuild)' (this is not Visual Studio)" Importance="high" Condition="'$(UmbracoBuild)' != ''" />
106+
<Message Text="Skip BuildLogin target because '$(LoginAssetsPath)' already exists" Importance="high" Condition="Exists('$(LoginAssetsPath)')" />
107+
<Message Text="Call BuildLogin target because UmbracoBuild is empty (this is Visual Studio) and '$(LoginAssetsPath)' doesn't exist" Importance="high" Condition="'$(UmbracoBuild)' == '' and !Exists('$(LoginAssetsPath)')" />
108+
<CallTarget Targets="BuildLogin" Condition="'$(UmbracoBuild)' == '' and !Exists('$(LoginAssetsPath)')" />
109+
</Target>
78110

79111
<Target Name="RestoreLogin" Inputs="$(LoginProjectDirectory)package-lock.json" Outputs="$(LoginProjectDirectory)node_modules/.package-lock.json">
80112
<Message Importance="high" Text="Restoring Login NPM packages..." />
81-
<Exec Command="npm ci --no-fund --no-audit --prefer-offline" WorkingDirectory="$(LoginProjectDirectory)" />
113+
<Exec Command="npm i --no-fund --no-audit" WorkingDirectory="$(LoginProjectDirectory)" />
82114
</Target>
83115

84-
<Target Name="BuildLogin" DependsOnTargets="RestoreLogin" BeforeTargets="AssignTargetPaths" Inputs="@(LoginAssetsInputs)" Outputs="$(IntermediateOutputPath)login.complete.txt">
116+
<Target Name="BuildLogin" DependsOnTargets="RestoreLogin">
85117
<Message Importance="high" Text="Executing Login NPM build script..." />
86118
<Exec Command="npm run build" WorkingDirectory="$(LoginProjectDirectory)" />
87119
<ItemGroup>
@@ -99,4 +131,19 @@
99131
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
100132
</DefineStaticWebAssets>
101133
</Target>
134+
135+
<Target Name="CleanLoginStaticAssetsPreconditions" AfterTargets="Clean" Condition="'$(UmbracoBuild)' == ''">
136+
<Message Text="Skip CleanLogin target because '$(LoginAssetsPath)' doesn't exist" Importance="high" Condition="!Exists('$(LoginAssetsPath)')" />
137+
<Message Text="Skip CleanLogin target because preserve.login marker file exists" Importance="high" Condition="Exists('$(LoginAssetsPath)') and Exists('$(SolutionDir)preserve.login')" />
138+
<Message Text="Call CleanLogin target because '$(LoginAssetsPath)' exists and preserve.login marker file doesn't exist" Importance="high" Condition="Exists('$(LoginAssetsPath)') and !Exists('$(SolutionDir)preserve.login')" />
139+
<CallTarget Targets="CleanLogin" Condition="Exists('$(LoginAssetsPath)') and !Exists('$(SolutionDir)preserve.login')" />
140+
</Target>
141+
142+
<Target Name="CleanLogin">
143+
<ItemGroup>
144+
<LoginDirectories Include="$(LoginAssetsPath)" />
145+
</ItemGroup>
146+
<RemoveDir Directories="@(LoginDirectories)" />
147+
</Target>
148+
<!-- END: Restore and build login project -->
102149
</Project>

0 commit comments

Comments
 (0)