This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.PrepareWorkspace.msbuild
62 lines (54 loc) · 2.65 KB
/
Build.PrepareWorkspace.msbuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0"
DefaultTargets="Run"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Build flags -->
<ShouldClean>true</ShouldClean>
<ShouldCleanPackages>false</ShouldCleanPackages>
<!-- Directories -->
<DirWorkspace>$(MSBuildProjectDirectory)</DirWorkspace>
<DirPackages>$(DirWorkspace)\packages</DirPackages>
<DirTools>$(DirWorkspace)\tools</DirTools>
<DirBuild>$(DirWorkspace)\build</DirBuild>
<DirBuildBin>$(DirBuild)\bin\$(PlatformTranslated)\$(Configuration)</DirBuildBin>
<DirBuildDeploy>$(DirBuild)\deploy</DirBuildDeploy>
<DirBuildLogs>$(DirBuild)\logs</DirBuildLogs>
<DirBuildTemp>$(DirBuild)\temp</DirBuildTemp>
<DirSrc>$(DirWorkspace)\src</DirSrc>
<!-- Tools -->
<MsBuildExtensionsPath>$(DirTools)\msbuild.extensions</MsBuildExtensionsPath>
</PropertyGroup>
<Import Project="$(MsBuildExtensionsPath)\NugetRestore.msbuild"
Condition="Exists('$(MsBuildExtensionsPath)\NugetRestore.msbuild')"/>
<Target Name="Run" DependsOnTargets="_RestorePackages">
<!-- Do nothing here -->
</Target>
<!-- Display info -->
<Target Name="_DisplayInfo">
<Message Text="Preparing workspace ..." />
</Target>
<!-- Clean -->
<Target Name="_Clean" DependsOnTargets="_DisplayInfo" Condition="$(ShouldClean)">
<!--
Don't try to delete the directory because that fails randomly because
some file is being locked. This then leads to a failing task, but ..
the next task is run and then the delete command still executes (delayed
by the OS). Unfortunately the next task is the task that puts the directories
back ...
-->
<ItemGroup>
<BuildFilesToDelete Include="$(DirBuild)\**\*.*"/>
</ItemGroup>
<Delete Files="@(BuildFilesToDelete)" />
<RemoveDir Directories="$(DirPackages)" Condition="$(ShouldCleanPackages)" />
</Target>
<!-- Run Nuget for the global build -->
<PropertyGroup>
<FileNuGetExe>$(DirSrc)\.nuget\NuGet.exe</FileNuGetExe>
<PackagesConfig>$([System.IO.Path]::Combine($(DirWorkspace), "packages.config"))</PackagesConfig>
</PropertyGroup>
<Target Name="_RestorePackages" DependsOnTargets="_DisplayInfo;_Clean">
<NugetRestore NugetPath="$(FileNuGetExe)" PackageFile="$(PackagesConfig)" PackageDirectory="$(DirPackages)" />
</Target>
</Project>