forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.build
252 lines (214 loc) · 14.9 KB
/
default.build
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?xml version="1.0"?>
<project name="MonoGame Build Script" default="build" basedir=".">
<description>The MonoGame automated build script.</description>
<property name="os" value="${operating-system::get-platform(environment::get-operating-system())}" />
<property name="msbuild12dir" value="C:\Program Files (x86)\MSBuild\12.0\Bin" />
<property name="msbuild14dir" value="C:\Program Files (x86)\MSBuild\14.0\Bin" />
<!-- Helper default target. -->
<target name="build"
description="Build, run tests, generate docs, and create installers."
depends="build_code,run_tests,build_docs,build_installer" />
<!-- Some additional helper dependencies. -->
<target name="_default" depends="_checkos" />
<target name="_prebuild" depends="_default,_clean" />
<!-- Do some OS checks required by the other steps. -->
<target name="_checkos">
<property name="os" value="${operating-system::get-platform(environment::get-operating-system())}"/>
<if test="${os == 'Unix'}">
<if test="${directory::exists('/Applications') and directory::exists('/Library')}">
<property name="os" value="MacOS"/>
</if>
</if>
<echo message="Detected : ${os}"/>
</target>
<!-- Clean the build output directories. -->
<target name="_clean">
<delete dir="${project::get-base-directory()}\MonoGame.Framework\obj" />
<delete dir="${project::get-base-directory()}\MonoGame.Framework.Content.Pipeline\obj" />
</target>
<!-- Shortcut for building all valid target platforms -->
<target name="build_code" description="Build all the projects.">
<call target="build_windows"/>
<call target="build_windows10" />
<call target="build_web" />
<call target="build_linux"/>
<call target="build_android" />
<call target="build_mac" />
<call target="build_ios" />
</target>
<!-- Build targets for the various platforms. -->
<target name="build_windows" description="Build Windows" depends="_prebuild">
<if test="${os == 'Win32NT'}">
<exec program="Protobuild" commandline="-generate Windows" />
<exec program="${nuget3path}/nuget.exe" commandline="restore MonoGame.Framework.Windows.sln -NonInteractive" />
<exec program="msbuild " commandline="MonoGame.Framework.Windows.sln /t:Clean /p:Configuration=Release" />
<exec program="msbuild " commandline="MonoGame.Framework.Windows.sln /t:Build /p:Configuration=Release" />
<exec program="msbuild " commandline="MonoGame.Framework.Windows.sln /t:Clean /p:Configuration=Debug" />
<exec program="msbuild " commandline="MonoGame.Framework.Windows.sln /t:Build /p:Configuration=Debug" />
<exec program="Protobuild" commandline="-generate WindowsGL" />
<exec program="msbuild " commandline="MonoGame.Framework.WindowsGL.sln /t:Clean /p:Configuration=Release" />
<exec program="msbuild " commandline="MonoGame.Framework.WindowsGL.sln /t:Build /p:Configuration=Release" />
<call target="build_portable"/>
</if>
<if test="${os == 'Unix'}">
<exec program="mono" commandline="Protobuild.exe -generate Windows" />
<exec program="${nuget3path}/nuget.exe" commandline="restore MonoGame.Framework.Windows.sln -NonInteractive" />
<exec program="xbuild" commandline="/t:Clean /p:Configuration=Release MonoGame.Framework.Windows.sln" />
<exec program="xbuild" commandline="/t:Build /p:Configuration=Release MonoGame.Framework.Windows.sln" />
<exec program="mono" commandline="Protobuild.exe -generate WindowsGL" />
<exec program="xbuild" commandline="/t:Clean /p:Configuration=Release MonoGame.Framework.WindowsGL.sln" />
<exec program="xbuild" commandline="/t:Build /p:Configuration=Release MonoGame.Framework.WindowsGL.sln" />
</if>
</target>
<target name="build_portable" description="Build Portable" depends="_prebuild">
<!-- Convert MonoGame.Framework.dll -->
<mkdir dir="MonoGame.Framework\bin\Portable\AnyCPU" />
<exec program="ThirdParty\Dependencies\Piranha\Piranha.exe " commandline='make-portable-skeleton -i MonoGame.Framework\bin\Windows\AnyCPU\Release\MonoGame.Framework.dll -o MonoGame.Framework\bin\Portable\AnyCPU\MonoGame.Framework.dll -p ".NETPortable,Version=v4.0,Profile=Profile328"' />
<!-- Convert MonoGame.Framework.Net.dll -->
<copy file="MonoGame.Framework\bin\Windows\AnyCPU\Release\MonoGame.Framework.Net.dll" tofile="MonoGame.Framework\bin\Portable\AnyCPU\temp.dll" overwrite="true"/>
<exec program="ThirdParty\Dependencies\Piranha\Piranha.exe " workingdir="MonoGame.Framework\bin\Portable\AnyCPU" commandline='make-portable-skeleton -i temp.dll -o MonoGame.Framework.Net.dll -p ".NETPortable,Version=v4.0,Profile=Profile328"' />
<delete file="MonoGame.Framework\bin\Portable\AnyCPU\temp.dll" />
<!-- Convert MonoGame.Framework.Content.Pipeline.dll -->
<mkdir dir="MonoGame.Framework.Content.Pipeline\bin\Portable\AnyCPU" />
<copy file="MonoGame.Framework\bin\Portable\AnyCPU\MonoGame.Framework.dll" tofile="MonoGame.Framework.Content.Pipeline\bin\Portable\AnyCPU\MonoGame.Framework.dll" overwrite="true"/>
<copy file="MonoGame.Framework.Content.Pipeline\bin\Windows\AnyCPU\Release\MonoGame.Framework.Content.Pipeline.dll" tofile="MonoGame.Framework.Content.Pipeline\bin\Portable\AnyCPU\temp.dll" overwrite="true"/>
<exec program="ThirdParty\Dependencies\Piranha\Piranha.exe " workingdir="MonoGame.Framework.Content.Pipeline\bin\Portable\AnyCPU" commandline='make-portable-skeleton -i temp.dll -o MonoGame.Framework.Content.Pipeline.dll -p ".NETPortable,Version=v4.0,Profile=Profile328"' />
<delete file="MonoGame.Framework.Content.Pipeline\bin\Portable\AnyCPU\temp.dll" />
</target>
<target name="build_linux" description="Build Linux" depends="_prebuild">
<if test="${os == 'Win32NT'}">
<exec program="Protobuild" commandline="-generate Linux" />
<exec program="${nuget3path}/nuget.exe" commandline="restore MonoGame.Framework.Linux.sln -NonInteractive" />
<exec program="msbuild " commandline="MonoGame.Framework.Linux.sln /t:Clean /p:Configuration=Release" />
<exec program="msbuild " commandline="MonoGame.Framework.Linux.sln /t:Build /p:Configuration=Release" />
<exec program="msbuild " commandline="MonoGame.Framework.Linux.sln /t:Clean /p:Configuration=Debug" />
<exec program="msbuild " commandline="MonoGame.Framework.Linux.sln /t:Build /p:Configuration=Debug" />
</if>
<if test="${os == 'Unix'}">
<exec program="mono" commandline="Protobuild.exe -generate Linux" />
<exec program="${nuget3path}/nuget.exe" commandline="restore MonoGame.Framework.Linux.sln -NonInteractive" />
<exec program="msbuild" commandline="/t:Clean /p:Configuration=Release MonoGame.Framework.Linux.sln" />
<exec program="msbuild" commandline="/t:Build /p:Configuration=Release MonoGame.Framework.Linux.sln" />
<exec program="msbuild" commandline="/t:Clean /p:Configuration=Debug MonoGame.Framework.Linux.sln" />
<exec program="msbuild" commandline="/t:Build /p:Configuration=Debug MonoGame.Framework.Linux.sln" />
</if>
<if test="${os == 'MacOS'}">
<exec program="mono" commandline="Protobuild.exe -generate Linux" />
<exec program="${nuget3path}/nuget.exe" commandline="restore MonoGame.Framework.Linux.sln -NonInteractive" />
<exec program="msbuild" commandline="MonoGame.Framework.Linux.sln /t:Clean /p:Configuration=Release" />
<exec program="msbuild" commandline="MonoGame.Framework.Linux.sln /t:Build /p:Configuration=Release" />
<exec program="msbuild" commandline="MonoGame.Framework.Linux.sln /t:Clean /p:Configuration=Debug" />
<exec program="msbuild" commandline="MonoGame.Framework.Linux.sln /t:Build /p:Configuration=Debug" />
<!--
The Linux build is considered the DesktopGL build. For this
reason need the Mac ffmpeg binaries to be able to run the
Linux unit tests on a Mac system.
-->
<copy file="ThirdParty/Dependencies/ffmpeg/MacOS/ffmpeg" tofile="Test/bin/Linux/AnyCPU/Debug/ffmpeg" overwrite="true"/>
<copy file="ThirdParty/Dependencies/ffmpeg/MacOS/ffprobe" tofile="Test/bin/Linux/AnyCPU/Debug/ffprobe" overwrite="true"/>
</if>
</target>
<target name="build_web" description="Build Web JSIL" depends="_prebuild">
<if test="${os == 'Win32NT'}">
<exec program="Protobuild" commandline="-generate Web">
<environment>
<variable name="JSIL_DIRECTORY" value="C:\JSIL" />
</environment>
</exec>
<exec program="msbuild " commandline="MonoGame.Framework.Web.sln /t:Clean /p:Configuration=Release" />
<exec program="msbuild " commandline="MonoGame.Framework.Web.sln /t:Build /p:Configuration=Release" />
</if>
<if test="${os == 'Unix'}">
<exec program="mono" commandline="Protobuild.exe -generate Web" />
<exec program="xbuild" commandline="/t:Clean /p:Configuration=Release MonoGame.Framework.Web.sln" />
<exec program="xbuild" commandline="/t:Build /p:Configuration=Release MonoGame.Framework.Web.sln" />
</if>
</target>
<target name="build_mac" description="Build MacOS" depends="_prebuild">
<if test="${os == 'MacOS'}">
<exec program="mono" commandline="Protobuild.exe -generate MacOS" />
<exec program="${nuget3path}/nuget.exe" commandline="restore MonoGame.Framework.MacOS.sln -NonInteractive" />
<exec program="msbuild" commandline="MonoGame.Framework.MacOS.sln /t:Clean /p:Configuration=Release" />
<exec program="msbuild" commandline="MonoGame.Framework.MacOS.sln /t:Build /p:Configuration=Release" />
<exec program="msbuild" commandline="MonoGame.Framework.MacOS.sln /t:Clean /p:Configuration=Debug" />
<exec program="msbuild" commandline="MonoGame.Framework.MacOS.sln /t:Build /p:Configuration=Debug" />
</if>
</target>
<target name="build_ios" description="Build iOS" depends="_prebuild">
<if test="${os == 'MacOS'}">
<if test="${file::exists('/Developer/MonoTouch/MSBuild/Xamarin.ObjcBinding.CSharp.targets') or file::exists('/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Xamarin.ObjcBinding.CSharp.targets')}">
<exec program="mono" commandline="Protobuild.exe -generate iOS" />
<exec program="xbuild" commandline="MonoGame.Framework.iOS.sln /t:Clean /p:Configuration=Release" />
<exec program="xbuild" commandline="MonoGame.Framework.iOS.sln /t:Build /p:Configuration=Release" />
</if>
<if test="${file::exists('/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/TVOS/Xamarin.TVOS.CSharp.targets')}" >
<exec program="mono" commandline="Protobuild.exe -generate tvOS" />
<exec program="xbuild" commandline="MonoGame.Framework.tvOS.sln /t:Clean /p:Configuration=Release" />
<exec program="xbuild" commandline="MonoGame.Framework.tvOS.sln /t:Build /p:Configuration=Release" />
</if>
</if>
</target>
<target name="build_android" description="Build Android" depends="_prebuild">
<if test="${os == 'Win32NT'}">
<if test="${file::exists('C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.CSharp.targets')}">
<exec program="Protobuild" commandline="-generate Android" />
<exec program="msbuild " commandline="MonoGame.Framework.Android.sln /t:Clean /p:Configuration=Release" />
<exec program="msbuild " commandline="MonoGame.Framework.Android.sln /t:Build /p:Configuration=Release" />
</if>
</if>
<if test="${os == 'MacOS'}">
<if test="${file::exists('/Developer/MonoAndroid/usr/bin/mandroid')}">
<exec program="mono" commandline="Protobuild.exe -generate Android" />
<exec program="xbuild" commandline="MonoGame.Framework.Android.sln /t:Clean /p:Configuration=Release" />
<exec program="xbuild" commandline="MonoGame.Framework.Android.sln /t:Build /p:Configuration=Release" />
</if>
</if>
</target>
<!-- old targets left here for TeamCity -->
<target name="build_windows8" />
<target name="build_windowsphone81" />
<target name="build_windows10" description="Build Windows 10 UAP" depends="_prebuild">
<if test="${os == 'Win32NT'}">
<if test="${file::exists('c:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\Microsoft.Windows.UI.Xaml.CSharp.targets')}">
<exec program="Protobuild" commandline="-generate WindowsUniversal" />
<!--
Currently MSBuild doesn't restore the nuget packages like buiding from the
IDE does. So we have to do it ourselves using the recommended work around.
-->
<exec program="${nuget3path}/nuget.exe " commandline='restore MonoGame.Framework\MonoGame.Framework.WindowsUniversal.project.json -NonInteractive' />
<exec program="${nuget3path}/nuget.exe " commandline='restore MonoGame.Framework\MonoGame.Framework.Net.WindowsUniversal.project.json -NonInteractive' />
<exec program="${msbuild14dir}\msbuild.exe " commandline='MonoGame.Framework.WindowsUniversal.sln /t:Clean /p:Configuration=Release /p:Platform="Any CPU"' />
<exec program="${msbuild14dir}\msbuild.exe " commandline='MonoGame.Framework.WindowsUniversal.sln /t:Build /p:Configuration=Release /p:Platform="Any CPU"' />
</if>
</if>
</target>
<!-- Run the unit tests... will fail if the code hasn't been built. -->
<target name="run_tests" description="Run all the tests" depends="_default">
<if test="${os == 'Win32NT'}">
<exec program="MonoGameTests.exe" commandline="--teamcity" workingdir="Test/bin/Windows/AnyCPU/Debug/" basedir="Test/bin/Windows/AnyCPU/Debug/"/>
</if>
<if test="${os == 'MacOS'}">
<exec program="chmod" commandline="u+x Test/bin/Linux/AnyCPU/Debug/ffmpeg" />
<exec program="chmod" commandline="u+x Test/bin/Linux/AnyCPU/Debug/ffprobe" />
<exec program="mono" commandline="MonoGameTests.exe --teamcity" workingdir="Test/bin/Linux/AnyCPU/Debug/" />
</if>
</target>
<!-- Generate the docs... will fail if the code hasn't been built. -->
<target name="build_docs" description="Build the documentation." depends="_default">
<if test="${os == 'Win32NT'}">
<delete dir="${project::get-base-directory()}\Documentation\Output" />
<exec program="SharpDoc.exe" basedir="ThirdParty\Dependencies\SharpDoc" commandline="-config Documentation\config.xml" />
</if>
</target>
<!-- Create the installers... will fail if the code hasn't been built. -->
<target name="build_installer" description="Build the installers." depends="_default">
<nant buildfile="ProjectTemplates/VisualStudio2010/default.build" target="build" />
<nant buildfile="ProjectTemplates/VisualStudio2013/default.build" target="build" />
<nant buildfile="ProjectTemplates/VisualStudio2015/default.build" target="build" />
<nant buildfile="ProjectTemplates/VisualStudio2017/default.build" target="build" />
<nant buildfile="ProjectTemplates/DotNetTemplate/default.build" target="build" />
<nant buildfile="IDE/MonoDevelop/default.build" target="build" />
<nant buildfile="IDE/VisualStudioForMac/default.build" target="build" />
<nant buildfile="Installers/default.build" target="build" />
</target>
</project>