|
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | | -<Project ToolsVersion="4.0" InitialTargets="Validate" DefaultTargets="Bootstrap" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 2 | +<Project ToolsVersion="4.0" InitialTargets="Validate" DefaultTargets="Bootstrap;Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | 3 | <!-- |
4 | 4 | The main Ciao point of entry. Continuous Integration builds should invoke |
5 | 5 | this build script with MSBuild 4.0 or later. |
|
9 | 9 | <Import Project="Ciao.props" Condition="Exists('Ciao.props')"/> |
10 | 10 |
|
11 | 11 | <PropertyGroup> |
| 12 | + <ProjectDirectory>$(MSBuildThisFileDirectory)</ProjectDirectory> |
12 | 13 | <BuildDirectory Condition=" '$(BuildDirectory)' == '' ">$([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)', 'build'))$([System.IO.Path]::DirectorySeparatorChar)</BuildDirectory> |
13 | 14 | <ToolsDirectory Condition=" '$(ToolsDirectory)' == '' ">$([System.IO.Path]::Combine('$(BuildDirectory)', 'tools'))$([System.IO.Path]::DirectorySeparatorChar)</ToolsDirectory> |
14 | 15 | <NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$([System.IO.Path]::Combine('$(ToolsDirectory)', 'NuGet.exe'))</NuGetExePath> |
|
18 | 19 | <NuGetClientDownloadUrl Condition=" '$(NuGetClientDownloadUrl)' == '' ">https://www.nuget.org/nuget.exe</NuGetClientDownloadUrl> |
19 | 20 | </PropertyGroup> |
20 | 21 |
|
| 22 | + <PropertyGroup> |
| 23 | + <CiaoVersion>1.1.0</CiaoVersion> |
| 24 | + <CiaoPackageEntryProject>$(ProjectDirectory)packages\Ciao.$(CiaoVersion)\tools\Ciao.targets</CiaoPackageEntryProject> |
| 25 | + </PropertyGroup> |
| 26 | + |
21 | 27 | <PropertyGroup> |
22 | 28 | <BootstrapDependsOn> |
23 | 29 | DownloadNuGetCommandLineClient; |
24 | 30 | RestoreSolutionPackages; |
25 | | - ResolveCiao; |
26 | | - Build |
27 | 31 | </BootstrapDependsOn> |
28 | 32 | </PropertyGroup> |
29 | 33 |
|
|
35 | 39 | <Target Name="Bootstrap" DependsOnTargets="$(BootstrapDependsOn)"/> |
36 | 40 |
|
37 | 41 | <Target Name="RestoreSolutionPackages" DependsOnTargets="DownloadNuGetCommandLineClient"> |
38 | | - <Exec Command="$(NuGetCommand) restore "$(SolutionFile)" -NonInteractive -Source http://www.nuget.org/api/v2/"/> |
39 | | - </Target> |
40 | | - |
41 | | - <Target Name="ResolveCiao" Condition=" '$(CiaoPackageEntryProject)' == '' "> |
| 42 | + <Exec Command="$(NuGetCommand) restore "$(SolutionFile)" -NonInteractive"/> |
42 | 43 | <PropertyGroup> |
43 | | - <SolutionDirectory Condition="Exists('$(SolutionFile)')">$([System.IO.Path]::GetDirectoryName($([System.IO.Path]::GetFullPath('$(SolutionFile)'))))$([System.IO.Path]::DirectorySeparatorChar)</SolutionDirectory> |
44 | | - <SolutionPackageDirectory Condition="Exists('$(SolutionDirectory)')">$([System.IO.Path]::Combine('$(SolutionDirectory)', 'packages'))$([System.IO.Path]::DirectorySeparatorChar)</SolutionPackageDirectory> |
| 44 | + <_CiaoRestoreSolutionPackagesCompleted>True</_CiaoRestoreSolutionPackagesCompleted> |
45 | 45 | </PropertyGroup> |
46 | | - <ItemGroup> |
47 | | - <CiaoPackageEntryProject Include="$(SolutionPackageDirectory)Ciao.*\tools\Ciao.proj"/> |
48 | | - </ItemGroup> |
49 | | - <CreateProperty Value="%(CiaoPackageEntryProject.Identity)"> |
50 | | - <Output TaskParameter="Value" PropertyName="CiaoPackageEntryProject"/> |
51 | | - </CreateProperty> |
52 | | - <Error Text="Unable to locate Caio package in Solution packages directory $(SolutionPackageDirectory) (is Ciao installed in the Solution?)" Condition="!Exists('$(CiaoPackageEntryProject)')"/> |
53 | 46 | </Target> |
54 | 47 |
|
55 | | - <Target Name="Build"> |
56 | | - <MSBuild Projects="$(CiaoPackageEntryProject)" Targets="$(CiaoTargets)" Properties="ProjectDirectory=$(MSBuildThisFileDirectory)"/> |
| 48 | + <!-- |
| 49 | + Standard Targets |
| 50 | +
|
| 51 | + These targets are defined in Ciao.targets which will override them when the Ciao package |
| 52 | + is restored and present. In case the build is restoring Ciao these targets are here |
| 53 | + to enable targets to be executed after Ciao is restored. |
| 54 | + --> |
| 55 | + |
| 56 | + <Target Name="Clean" DependsOnTargets="ValidateCiaoInstalled;CreateProperties"> |
| 57 | + <MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Clean" Properties="$(_CiaoProperties)"/> |
| 58 | + </Target> |
| 59 | + |
| 60 | + <Target Name="Build" DependsOnTargets="ValidateCiaoInstalled;CreateProperties"> |
| 61 | + <MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Build" Properties="$(_CiaoProperties)"/> |
| 62 | + </Target> |
| 63 | + |
| 64 | + <Target Name="Compile" DependsOnTargets="ValidateCiaoInstalled;CreateProperties"> |
| 65 | + <MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Compile" Properties="$(_CiaoProperties)"/> |
| 66 | + </Target> |
| 67 | + |
| 68 | + <Target Name="Test" DependsOnTargets="ValidateCiaoInstalled;CreateProperties"> |
| 69 | + <MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Test" Properties="$(_CiaoProperties)"/> |
| 70 | + </Target> |
| 71 | + |
| 72 | + <Target Name="Package" DependsOnTargets="ValidateCiaoInstalled;CreateProperties"> |
| 73 | + <MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Package" Properties="$(_CiaoProperties)"/> |
| 74 | + </Target> |
| 75 | + |
| 76 | + <Target Name="Rebuild" DependsOnTargets="ValidateCiaoInstalled;CreateProperties"> |
| 77 | + <MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Rebuild" Properties="$(_CiaoProperties)"/> |
| 78 | + </Target> |
| 79 | + |
| 80 | + |
| 81 | + <!-- End of Standard Targets --> |
| 82 | + |
| 83 | + <Target Name="ValidateCiaoInstalled"> |
| 84 | + <Error Text="Ciao targets must be restored using the Bootstrap target before executing other targets." |
| 85 | + Condition="!Exists('$(CiaoPackageEntryProject)') and '$(_CiaoRestoreSolutionPackagesCompleted)' != 'True' "/> |
| 86 | + <Error Text="Ciao targets file '$(CiaoPackageEntryProject)' does not exist. Make sure to install Ciao in $(SolutionFile)." |
| 87 | + Condition="!Exists('$(CiaoPackageEntryProject)')"/> |
| 88 | + </Target> |
| 89 | + |
| 90 | + <Target Name="CreateProperties"> |
| 91 | + <PropertyGroup> |
| 92 | + <_CiaoProperties> |
| 93 | + ImportCiaoProperties=True; |
| 94 | + ProjectDirectory=$(ProjectDirectory); |
| 95 | + SolutionFile=$([System.IO.Path]::Combine('$(ProjectDirectory)', '$(SolutionFile)')); |
| 96 | + BuildDirectory=$(BuildDirectory); |
| 97 | + ToolsDirectory=$(ToolsDirectory); |
| 98 | + NuGetExePath=$(NuGetExePath); |
| 99 | + </_CiaoProperties> |
| 100 | + </PropertyGroup> |
57 | 101 | </Target> |
58 | 102 |
|
59 | 103 | <Target Name="DownloadNuGetCommandLineClient" Condition="!Exists('$(NuGetExePath)')"> |
|
63 | 107 | <Exec Command="curl -L -o "$(NuGetExePath)" $(NuGetClientDownloadUrl)" Condition=" '$(OS)' != 'Windows_NT' "/> |
64 | 108 | </Target> |
65 | 109 |
|
| 110 | + <Import Project="$(CiaoPackageEntryProject)" Condition="Exists('$(CiaoPackageEntryProject)')"/> |
| 111 | + |
66 | 112 | <UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> |
67 | 113 | <ParameterGroup> |
68 | 114 | <Url ParameterType="System.String" Required="true" /> |
|
0 commit comments