|
26 | 26 | <ProjectReference Include="..\Umbraco.Web.Website\Umbraco.Web.Website.csproj" />
|
27 | 27 | </ItemGroup>
|
28 | 28 |
|
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 --> |
30 | 37 | <PropertyGroup>
|
31 | 38 | <BackofficeProjectDirectory Condition="'$(BackofficeProjectDirectory)' == ''">..\Umbraco.Web.UI.Client\</BackofficeProjectDirectory>
|
32 |
| - <BackofficeAssetsPath>wwwroot\umbraco\backoffice</BackofficeAssetsPath> |
| 39 | + <BackofficeAssetsPath>$(ProjectDir)wwwroot\umbraco\backoffice</BackofficeAssetsPath> |
33 | 40 | </PropertyGroup>
|
34 | 41 |
|
35 | 42 | <ItemGroup>
|
36 |
| - <BackofficeAssetsInputs Include="$(BackofficeProjectDirectory)package.json;$(BackofficeProjectDirectory)package-lock.json;$(BackofficeProjectDirectory)src\**" Exclude="$(DefaultItemExcludes)" /> |
37 | 43 | <Content Remove="$(BackofficeAssetsPath)\**" />
|
38 | 44 | </ItemGroup>
|
39 | 45 |
|
| 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 | + |
40 | 53 | <Target Name="RestoreBackoffice" Inputs="$(BackofficeProjectDirectory)package-lock.json" Outputs="$(BackofficeProjectDirectory)node_modules\.package-lock.json">
|
41 | 54 | <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)" /> |
43 | 56 | </Target>
|
44 | 57 |
|
45 |
| - <Target Name="BuildBackoffice" DependsOnTargets="RestoreBackoffice" BeforeTargets="AssignTargetPaths" Inputs="@(BackofficeAssetsInputs)" Outputs="$(IntermediateOutputPath)backoffice.complete.txt"> |
| 58 | + <Target Name="BuildBackoffice" DependsOnTargets="RestoreBackoffice"> |
46 | 59 | <Message Importance="high" Text="Executing Backoffice NPM build script..." />
|
47 | 60 | <Exec Command="npm run build:for:cms" WorkingDirectory="$(BackofficeProjectDirectory)" />
|
48 | 61 | <ItemGroup>
|
|
61 | 74 | </DefineStaticWebAssets>
|
62 | 75 | </Target>
|
63 | 76 |
|
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 --> |
65 | 95 | <PropertyGroup>
|
66 | 96 | <LoginProjectDirectory Condition="'$(LoginProjectDirectory)' == ''">..\Umbraco.Web.UI.Login\</LoginProjectDirectory>
|
67 |
| - <LoginAssetsPath>wwwroot\umbraco\login</LoginAssetsPath> |
| 97 | + <LoginAssetsPath>$(ProjectDir)wwwroot\umbraco\login</LoginAssetsPath> |
68 | 98 | </PropertyGroup>
|
69 | 99 |
|
70 | 100 | <ItemGroup>
|
71 |
| - <LoginAssetsInputs Include="$(LoginProjectDirectory)**" Exclude="$(DefaultItemExcludes)" /> |
72 | 101 | <Content Remove="$(LoginAssetsPath)\**" />
|
73 | 102 | </ItemGroup>
|
74 | 103 |
|
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> |
78 | 110 |
|
79 | 111 | <Target Name="RestoreLogin" Inputs="$(LoginProjectDirectory)package-lock.json" Outputs="$(LoginProjectDirectory)node_modules/.package-lock.json">
|
80 | 112 | <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)" /> |
82 | 114 | </Target>
|
83 | 115 |
|
84 |
| - <Target Name="BuildLogin" DependsOnTargets="RestoreLogin" BeforeTargets="AssignTargetPaths" Inputs="@(LoginAssetsInputs)" Outputs="$(IntermediateOutputPath)login.complete.txt"> |
| 116 | + <Target Name="BuildLogin" DependsOnTargets="RestoreLogin"> |
85 | 117 | <Message Importance="high" Text="Executing Login NPM build script..." />
|
86 | 118 | <Exec Command="npm run build" WorkingDirectory="$(LoginProjectDirectory)" />
|
87 | 119 | <ItemGroup>
|
|
99 | 131 | <Output TaskParameter="Assets" ItemName="StaticWebAsset" />
|
100 | 132 | </DefineStaticWebAssets>
|
101 | 133 | </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 --> |
102 | 149 | </Project>
|
0 commit comments