-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathbuild.proj
More file actions
126 lines (101 loc) · 6.81 KB
/
build.proj
File metadata and controls
126 lines (101 loc) · 6.81 KB
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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration>Debug</Configuration>
<Version Condition=" '$(bamboo_GitVersion_NuGetVersion)' != '' ">$(bamboo_GitVersion_NuGetVersion)</Version>
<Version Condition=" '$(bamboo_GitVersion_NuGetVersion)' == '' ">0.0.0-dev</Version>
<PaketVersion>2.66.9</PaketVersion>
<PaketBootstrapper>$(MSBuildThisFileDirectory.Replace('build\','.paket'))\paket.bootstrapper.exe</PaketBootstrapper>
<Paket>$(MSBuildThisFileDirectory.Replace('build\','.paket'))\paket.exe</Paket>
<PackagesFolder>$(MSBuildThisFileDirectory.Replace('build\','packages'))</PackagesFolder>
<NuGet>$(PackagesFolder)\NuGet.CommandLine\tools\NuGet.exe</NuGet>
<MSBuild>"$(MSBuildToolsPath)\MSBuild.exe"</MSBuild>
<XUnit>$(PackagesFolder)\xunit.runner.console\tools\xunit.console.exe</XUnit>
<XUnitXslt>$(PackagesFolder)\xunit.runner.console\tools\NUnitXml.xslt</XUnitXslt>
<ILMerge>$(PackagesFolder)\ILMerge\tools\ILMerge.exe</ILMerge>
</PropertyGroup>
<Target Name="CI">
<PropertyGroup>
<Configuration>Release</Configuration>
</PropertyGroup>
<CallTarget Targets="Build" />
<CallTarget Targets="Documentation" />
<CallTarget Targets="UnitTest" />
<CallTarget Targets="IntegrationTest" />
<CallTarget Targets="Package" />
</Target>
<Target Name="Build" DependsOnTargets="RestorePackages">
<Message Text="Building version $(Version)..." />
<Exec Command="$(MSBuild) ..\src\openstack.net.sln /p:Configuration=$(Configuration) /nologo /v:minimal" />
</Target>
<Target Name="Documentation" DependsOnTargets="Build">
<PropertyGroup>
<SHFBROOT>$(PackagesFolder)\EWSoftware.SHFB\tools</SHFBROOT>
</PropertyGroup>
<Exec Command="(set SHFBROOT=$(SHFBROOT)) & $(MSBuild) ..\src\Documentation\Documentation.sln /p:Configuration=$(Configuration) /nologo /v:minimal" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="DownloadPaket">
<Exec Command="%22$(PaketBootstrapper)%22" />
<Exec Command="%22$(Paket)%22 install" />
</Target>
<Target Name="DownloadPaket" Condition="!Exists('$(PaketBootstrapper)')">
<Exec Command="@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://github.com/fsprojects/Paket/releases/download/$(PaketVersion)/paket.bootstrapper.exe' -OutFile '$(PaketBootstrapper)'"" />
<Exec Command="..\.paket\paket.bootstrapper.exe $(PaketVersion)" />
</Target>
<Target Name="UnitTest" DependsOnTargets="Build">
<PropertyGroup>
<MSTest Condition=" '$(VS140COMNTOOLS)' != '' ">"$(VS140COMNTOOLS)..\IDE\MSTest.exe"</MSTest>
<MSTest Condition=" '$(VS120COMNTOOLS)' != '' ">"$(VS120COMNTOOLS)..\IDE\MSTest.exe"</MSTest>
</PropertyGroup>
<RemoveDir Directories="..\artifacts\TestResults\" />
<MakeDir Directories="..\artifacts\TestResults\" />
<Exec Command="$(XUnit) ..\src\testing\unit\bin\$(Configuration)\OpenStackNet.Testing.Unit.dll -nunit ..\artifacts\TestResults\unit-tests.nunit.xml" ContinueOnError="true" />
<Exec Command="$(MSTest) /testcontainer:..\src\testing\unit\bin\$(Configuration)\OpenStackNet.Testing.Unit.dll /category:Unit /resultsfile:..\artifacts\TestResults\unit.trx" ContinueOnError="true" />
</Target>
<Target Name="IntegrationTest" DependsOnTargets="Build">
<MakeDir Directories="..\artifacts\TestResults\" />
<Exec Command="$(XUnit) ..\src\testing\integration\bin\$(Configuration)\OpenStackNet.Testing.Integration.dll -xml ..\artifacts\TestResults\integration-tests.xml -notrait ci=false" ContinueOnError="true" />
<!-- Convert test results to the NUnit format for easier reporting -->
<XslTransformation XmlInputPaths="..\artifacts\TestResults\integration-tests.xml" XslInputPath="$(XUnitXslt)"
OutputPaths="..\artifacts\TestResults\integration-tests.nunit.xml" />
</Target>
<Target Name="MigrationTest" DependsOnTargets="RestorePackages">
<PropertyGroup>
<MigrationSln>..\src\testing\migration\migration.sln</MigrationSln>
</PropertyGroup>
<!-- Remove cached prerelease packages so that the latest is grabed from MyGet -->
<ItemGroup>
<PrereleasePackages Include="$(LOCALAPPDATA)\NuGet\Cache\*beta*"/>
</ItemGroup>
<Delete Files="@(PrereleasePackages)" />
<Exec Command="$(NuGet) restore $(MigrationSln)" />
<Message Text="Updating NuGet packages to the latest available releases (including prereleases available on MyGet)..." />
<Exec Command="$(NuGet) update -Prerelease $(MigrationSln)" />
<Message Text="Verifying that the migration solution builds..." />
<Exec Command="$(MSBuild) $(MigrationSln) /nologo /clp:ErrorsOnly" />
</Target>
<Target Name="Package" DependsOnTargets="Build;Documentation">
<MakeDir Directories="..\src\corelib\bin\v4.0\$(Configuration)\deploy" />
<Exec Command="$(ILMerge) /t:library /v4 /out:deploy/openstacknet.dll openstacknet.dll SimpleRESTServices.dll"
WorkingDirectory="..\src\corelib\bin\v4.0\$(Configuration)" />
<MakeDir Directories="..\artifacts\packages\" />
<Exec Command="$(NuGet) pack ..\src\corelib\corelib.nuspec -OutputDirectory ..\artifacts\packages -Prop Configuration=$(Configuration) -Version $(Version)" />
</Target>
<!-- The publish targets don't depend upon Package because of how they are used on the CI server. At this point the code has been packaged and all that needs
to happen is to publish the artifact. -->
<Target Name="PublishNuGet">
<Exec Command="@powershell -NoProfile -ExecutionPolicy unrestricted -File check-nuget-version-exists.ps1 $(Version)" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="ShouldPublishToNuGet" />
</Exec>
<!-- The environment variable BAMBOO_NUGET_PASSWORD comes from the nuget.password variable defined on the openstack.net plan in Bamboo -->
<Message Text="Skipping publish to NuGet because version $(Version) has already been published."
Condition=" '$(ShouldPublishToNuGet)' == 'False' " />
<Exec Command="$(NuGet) push ..\artifacts\packages\openstack.net.$(Version).nupkg %25BAMBOO_NUGET_PASSWORD%25 -Source https://api.nuget.org/v3/index.json"
Condition=" '$(ShouldPublishToNuGet)' == 'True' " />
</Target>
<Target Name="PublishMyGet">
<!-- We don't need to check for existing versions because MyGet lets you overwrite -->
<!-- The environment variable BAMBOO_MYGET_PASSWORD comes from the nuget.password variable defined on the openstack.net plan in Bamboo -->
<Exec Command="$(NuGet) push ..\artifacts\packages\openstack.net.$(Version).nupkg %25BAMBOO_MYGET_PASSWORD%25 -Source https://www.myget.org/F/openstacknetsdk/api/v2"/>
</Target>
</Project>