forked from themotleyfool/NuGet.Lucene
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ciao.proj
142 lines (117 loc) · 6.79 KB
/
Ciao.proj
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" InitialTargets="Validate" DefaultTargets="Bootstrap;Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
The main Ciao point of entry. Continuous Integration builds should invoke
this build script with MSBuild 4.0 or later.
Do not modify this file. To customize your build, modify Ciao.props and Ciao.targets.
-->
<Import Project="Ciao.props" Condition="Exists('Ciao.props')"/>
<PropertyGroup>
<ProjectDirectory>$(MSBuildThisFileDirectory)</ProjectDirectory>
<BuildDirectory Condition=" '$(BuildDirectory)' == '' ">$([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)', 'build'))$([System.IO.Path]::DirectorySeparatorChar)</BuildDirectory>
<ToolsDirectory Condition=" '$(ToolsDirectory)' == '' ">$([System.IO.Path]::Combine('$(BuildDirectory)', 'tools'))$([System.IO.Path]::DirectorySeparatorChar)</ToolsDirectory>
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$([System.IO.Path]::Combine('$(ToolsDirectory)', 'NuGet.exe'))</NuGetExePath>
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT' ">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
<NuGetClientDownloadUrl Condition=" '$(NuGetClientDownloadUrl)' == '' ">https://www.nuget.org/nuget.exe</NuGetClientDownloadUrl>
</PropertyGroup>
<PropertyGroup>
<CiaoVersion>1.1.0</CiaoVersion>
<CiaoPackageEntryProject>$(ProjectDirectory)packages\Ciao.$(CiaoVersion)\tools\Ciao.targets</CiaoPackageEntryProject>
</PropertyGroup>
<PropertyGroup>
<BootstrapDependsOn>
DownloadNuGetCommandLineClient;
RestoreSolutionPackages;
</BootstrapDependsOn>
</PropertyGroup>
<Target Name="Validate">
<Error Text="$(MSBuildThisFileDirectory)Ciao.props must define the SolutionFile property" Condition=" '$(SolutionFile)' == '' "/>
<Error Text="The Solution $(SolutionFile) does not exist" Condition="!Exists('$(SolutionFile)')"/>
</Target>
<Target Name="Bootstrap" DependsOnTargets="$(BootstrapDependsOn)"/>
<Target Name="RestoreSolutionPackages" DependsOnTargets="DownloadNuGetCommandLineClient">
<Exec Command="$(NuGetCommand) restore "$(SolutionFile)" -NonInteractive"/>
<PropertyGroup>
<_CiaoRestoreSolutionPackagesCompleted>True</_CiaoRestoreSolutionPackagesCompleted>
</PropertyGroup>
</Target>
<!--
Standard Targets
These targets are defined in Ciao.targets which will override them when the Ciao package
is restored and present. In case the build is restoring Ciao these targets are here
to enable targets to be executed after Ciao is restored.
-->
<Target Name="Clean" DependsOnTargets="ValidateCiaoInstalled;CreateProperties">
<MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Clean" Properties="$(_CiaoProperties)"/>
</Target>
<Target Name="Build" DependsOnTargets="ValidateCiaoInstalled;CreateProperties">
<MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Build" Properties="$(_CiaoProperties)"/>
</Target>
<Target Name="Compile" DependsOnTargets="ValidateCiaoInstalled;CreateProperties">
<MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Compile" Properties="$(_CiaoProperties)"/>
</Target>
<Target Name="Test" DependsOnTargets="ValidateCiaoInstalled;CreateProperties">
<MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Test" Properties="$(_CiaoProperties)"/>
</Target>
<Target Name="Package" DependsOnTargets="ValidateCiaoInstalled;CreateProperties">
<MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Package" Properties="$(_CiaoProperties)"/>
</Target>
<Target Name="Rebuild" DependsOnTargets="ValidateCiaoInstalled;CreateProperties">
<MSBuild Projects="$(CiaoPackageEntryProject)" Targets="Rebuild" Properties="$(_CiaoProperties)"/>
</Target>
<!-- End of Standard Targets -->
<Target Name="ValidateCiaoInstalled">
<Error Text="Ciao targets must be restored using the Bootstrap target before executing other targets."
Condition="!Exists('$(CiaoPackageEntryProject)') and '$(_CiaoRestoreSolutionPackagesCompleted)' != 'True' "/>
<Error Text="Ciao targets file '$(CiaoPackageEntryProject)' does not exist. Make sure to install Ciao in $(SolutionFile)."
Condition="!Exists('$(CiaoPackageEntryProject)')"/>
</Target>
<Target Name="CreateProperties">
<PropertyGroup>
<_CiaoProperties>
ImportCiaoProperties=True;
ProjectDirectory=$(ProjectDirectory);
SolutionFile=$([System.IO.Path]::Combine('$(ProjectDirectory)', '$(SolutionFile)'));
BuildDirectory=$(BuildDirectory);
ToolsDirectory=$(ToolsDirectory);
NuGetExePath=$(NuGetExePath);
</_CiaoProperties>
</PropertyGroup>
</Target>
<Target Name="DownloadNuGetCommandLineClient" Condition="!Exists('$(NuGetExePath)')">
<MakeDir Directories="$(ToolsDirectory)"/>
<Message Text="Downloading $(NuGetClientDownloadUrl) to $(NuGetExePath)"/>
<DownloadNuGet OutputFilename="$(NuGetExePath)" Url="$(NuGetClientDownloadUrl)" Condition=" '$(OS)' == 'Windows_NT' "/>
<Exec Command="curl -L -o "$(NuGetExePath)" $(NuGetClientDownloadUrl)" Condition=" '$(OS)' != 'Windows_NT' "/>
</Target>
<Import Project="$(CiaoPackageEntryProject)" Condition="Exists('$(CiaoPackageEntryProject)')"/>
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Url ParameterType="System.String" Required="true" />
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
WebClient webClient = new WebClient();
webClient.DownloadFile(Url, OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>