forked from phatboyg/Magnum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.step
210 lines (195 loc) · 13.2 KB
/
compile.step
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
<?xml version="1.0" encoding="utf-8" ?>
<project name="Compiler" default="go">
<!-- Project UppercuT - http://projectuppercut.org -->
<!-- DO NOT EDIT THIS FILE - Add custom tasks in BuildTasks.Custom folder with file by the same name - find out more at http://uppercut.pbwiki.com -->
<property name="build.config.settings" value="__NONE__" overwrite="false" />
<include buildfile="${build.config.settings}" if="${file::exists(build.config.settings)}" />
<property name="path.separator" value="${string::trim(path::combine(' ', ' '))}" />
<property name="file.current.no_extension" value="compile" />
<property name="dirs.current" value="${directory::get-parent-directory(project::get-buildfile-path())}" />
<property name="path.to.toplevel" value=".." />
<property name="folder.build_scripts" value="build" overwrite="false" />
<property name="folder.build_scripts_custom" value="build.custom" overwrite="false" />
<property name="dirs.build_scripts_custom" value="${dirs.current}${path.separator}${path.to.toplevel}${path.separator}${folder.build_scripts_custom}" />
<property name="folder.code_build" value="build_output" overwrite="false" />
<property name="dirs.build" value="${dirs.current}${path.separator}${path.to.toplevel}${path.separator}${folder.code_build}" />
<property name="folder.documentation" value="docs" overwrite="false" />
<property name="dirs.docs" value="${dirs.current}${path.separator}${path.to.toplevel}${path.separator}${folder.documentation}" />
<property name="folder.database" value="__DATABASE_FOLDER_NAME__" overwrite="false" />
<property name="dirs.db" value="${dirs.current}${path.separator}${path.to.toplevel}${path.separator}${folder.database}" />
<property name="project.name" value="__SOLUTION_NAME_WITHOUT_SLN_EXTENSION__" overwrite="false" />
<property name="folder.app.drop" value="${project.name}" overwrite="false" />
<property name="path_to_solution" value="." overwrite="false" />
<property name="microsoft.framework" value="net-3.5" overwrite="false" />
<property name="msbuild.configuration" value="Release" overwrite="false" />
<property name="msbuild.platform" value="Any CPU" overwrite="false" />
<property name="msbuild.override_output_path" value="true" overwrite="false" />
<property name="msbuild.outputpath" value="${dirs.build}${path.separator}${folder.app.drop}" overwrite="false" />
<property name="xbuild.outputpath" value=".${path.separator}${folder.code_build}${path.separator}${folder.app.drop}" overwrite="false" />
<property name="solution.path" value="${directory::get-parent-directory(dirs.current)}${path.separator}${path_to_solution}${path.separator}${project.name}.sln" />
<property name="solution.path" value="${directory::get-parent-directory(dirs.current)}${path.separator}${path_to_solution}${path.separator}${project.name}.vbp" if="${microsoft.framework =='vb6'}" />
<property name="nant.settings.currentframework" value="mono-1.0" if="${platform::is-unix()}" />
<property name="nant.settings.currentframework" value="net-3.5" if="${microsoft.framework !='vb6' and platform::is-windows()}" />
<property name="framework.multitargeting" value="false" />
<property name="framework.multitargeting.delimiter" value="," />
<property name="file.custom.step.before" value="${dirs.build_scripts_custom}${path.separator}${file.current.no_extension}.pre.step" />
<property name="file.custom.step.after" value="${dirs.build_scripts_custom}${path.separator}${file.current.no_extension}.post.step" />
<property name="file.custom.step.replace" value="${dirs.build_scripts_custom}${path.separator}${file.current.no_extension}.replace.step" />
<property name="is.replaced" value="false" />
<property name="fail.build.on.error" value="true" />
<target name="go" depends="run_tasks" />
<target name="run_tasks">
<echo message="Running ${project::get-name()} tasks." />
<call target="prepare" if="${target::exists('prepare')}" />
<call target="check_for_multitargeting" if="${target::exists('check_for_multitargeting')}" />
<call target="custom_tasks_before" if="${target::exists('custom_tasks_before')}" />
<call target="custom_tasks_replace" if="${target::exists('custom_tasks_replace')}" />
<call target="run_normal_tasks" if="${not is.replaced}" />
<call target="custom_tasks_after" if="${target::exists('custom_tasks_after')}" />
</target>
<target name="run_normal_tasks"
depends="error_check, build_code, copy_documentation, copy_db"
description="Compiling project." />
<target name="custom_tasks_before">
<echo message="Running custom tasks if ${file.custom.step.before} exists." />
<nant buildfile="${file.custom.step.before}" inheritall="true" if="${file::exists(file.custom.step.before)}" failonerror="${fail.build.on.error}" />
<exec program="powershell.exe" if="${file::exists(file.custom.step.before + '.ps1')}" failonerror="${fail.build.on.error}">
<arg value="${path::get-full-path(file.custom.step.before + '.ps1')}" />
</exec>
<exec program="ruby.exe" if="${file::exists(file.custom.step.before + '.rb')}" failonerror="${fail.build.on.error}">
<arg value="${path::get-full-path(file.custom.step.before + '.rb')}" />
</exec>
</target>
<target name="custom_tasks_replace">
<echo message="Running custom tasks instead of normal tasks if ${file.custom.step.replace} exists." />
<property name="is.replaced" value="true" if="${file::exists(file.custom.step.replace)}" />
<nant buildfile="${file.custom.step.replace}" inheritall="true" if="${file::exists(file.custom.step.replace)}" failonerror="${fail.build.on.error}" />
<property name="is.replaced" value="true" if="${file::exists(file.custom.step.replace + '.ps1')}" />
<exec program="powershell.exe" if="${file::exists(file.custom.step.replace + '.ps1')}" failonerror="${fail.build.on.error}" >
<arg value="${path::get-full-path(file.custom.step.replace + '.ps1')}" />
</exec>
<property name="is.replaced" value="true" if="${file::exists(file.custom.step.replace + '.rb')}" />
<exec program="ruby.exe" if="${file::exists(file.custom.step.replace + '.rb')}" failonerror="${fail.build.on.error}" >
<arg value="${path::get-full-path(file.custom.step.replace + '.rb')}" />
</exec>
</target>
<target name="error_check">
<fail message="You must fill out the project.name, repository.path, and company.name settings in the settings${path.separator}UppercuT.config file. Please do that and retry the build."
if="${project.name=='__SOLUTION_NAME_WITHOUT_SLN_EXTENSION__'}" />
</target>
<target name="check_for_multitargeting">
<if test="${string::contains(microsoft.framework,',')}">
<echo message="You want to multi target, eh? You passed a comma into the framework: ${microsoft.framework}" />
<property name="framework.multitargeting" value="true" />
<property name="framework.multitargeting.delimiter" value="," />
</if>
<if test="${string::contains(microsoft.framework,';')}">
<echo message="You want to multi target, eh? You passed a semicolon into the framework: ${microsoft.framework}" />
<property name="framework.multitargeting" value="true" />
<property name="framework.multitargeting.delimiter" value=";" />
</if>
</target>
<target name="build_code" depends="" description="Building Library">
<echo message="Compiling ${solution.path}."/>
<call target="build_dotNET_code" if="${microsoft.framework !='vb6'}" />
<call target="build_vb6_code" if="${microsoft.framework =='vb6'}" />
</target>
<target name="build_dotNET_code" >
<if test="${framework.multitargeting}">
<foreach item="String" in="${microsoft.framework}" delim="${framework.multitargeting.delimiter}" property="framework.specific">
<property name="msbuild.outputpath" value="${dirs.build}${path.separator}${folder.app.drop}${path.separator}${framework.specific}" />
<property name="xbuild.outputpath" value=".${path.separator}${folder.code_build}${path.separator}${folder.app.drop}${path.separator}${framework.specific}" />
<property name="microsoft.framework.specific" value="${string::trim(framework.specific)}" />
<call target="build_dotNet_code_framework" />
</foreach>
</if>
<if test="${not framework.multitargeting}">
<property name="microsoft.framework.specific" value="${string::trim(microsoft.framework)}" />
<call target="build_dotNet_code_framework" />
</if>
</target>
<target name="build_dotNet_code_framework">
<echo message="Building on ${framework::get-version(microsoft.framework.specific)}" />
<property name="nant.settings.currentframework" value="${string::trim(microsoft.framework.specific)}" />
<mkdir dir="${msbuild.outputpath}" />
<if test="${platform::is-unix()}">
<!-- Do clean and build in two steps since xbuild has a bug with using OutputPath and Rebuild together Bug #628525 at Novell -->
<echo message="Cleaning build..." />
<exec program="xbuild"
basedir="/usr/bin"
workingdir="${dirs.build}"
commandline="${solution.path} /nologo /property:OutputPath='${msbuild.outputpath}' /property:Configuration=${msbuild.configuration} /verbosity:minimal /noconsolelogger /target:Clean" />
<echo message="Building..." />
<exec program="xbuild"
basedir="/usr/bin"
workingdir="${dirs.build}"
commandline="${solution.path} /nologo /property:OutputPath='${msbuild.outputpath}' /property:Configuration=${msbuild.configuration} /verbosity:minimal /noconsolelogger" />
</if>
<if test="${platform::is-windows()}">
<!-- nant is retarded - I had to have four of these instead of throwing an if on the outputpath and targets -->
<if test="${msbuild.override_output_path}">
<if test="${framework.multitargeting}">
<msbuild project="${solution.path}" verbosity="minimal">
<property name="Configuration" value="${msbuild.configuration}" />
<property name="OutputPath" value="${msbuild.outputpath}" />
<property name="Platform" value="${msbuild.platform}" />
<property name="TargetFrameworkVersion" value="v${framework::get-version(microsoft.framework.specific)}" />
<property name="ToolsVersion" value="${framework::get-version(microsoft.framework.specific)}" />
</msbuild>
</if>
<if test="${not framework.multitargeting}">
<msbuild project="${solution.path}" verbosity="minimal">
<property name="Configuration" value="${msbuild.configuration}" />
<property name="OutputPath" value="${msbuild.outputpath}" />
<property name="Platform" value="${msbuild.platform}" />
</msbuild>
</if>
</if>
<if test="${not msbuild.override_output_path}">
<if test="${framework.multitargeting}">
<msbuild project="${solution.path}" verbosity="minimal">
<property name="Configuration" value="${msbuild.configuration}" />
<property name="Platform" value="${msbuild.platform}" />
<property name="TargetFrameworkVersion" value="v${framework::get-version(microsoft.framework.specific)}" />
<property name="ToolsVersion" value="${framework::get-version(microsoft.framework.specific)}" />
</msbuild>
</if>
<if test="${not framework.multitargeting}">
</if>
<msbuild project="${solution.path}" verbosity="minimal">
<property name="Configuration" value="${msbuild.configuration}" />
<property name="Platform" value="${msbuild.platform}" />
</msbuild>
</if>
</if>
</target>
<target name="build_vb6_code">
<vb6 project="${solution.path}" outdir="${dirs.build}${path.separator}${folder.app.drop}" />
</target>
<target name="copy_documentation">
<echo message="Building documentation files to ${dirs.build}${path.separator}${folder.documentation}."/>
<copy todir="${dirs.build}${path.separator}${folder.documentation}">
<fileset basedir="${dirs.docs}">
<include name="**/*.*" />
</fileset>
</copy>
</target>
<target name="copy_db">
<echo message="Building database files to ${dirs.build}${path.separator}${folder.database}."/>
<copy todir="${dirs.build}${path.separator}${folder.database}">
<fileset basedir="${dirs.db}">
<include name="**/*.*" />
</fileset>
</copy>
</target>
<target name="custom_tasks_after">
<echo message="Running custom tasks if ${file.custom.step.after} exists." />
<nant buildfile="${file.custom.step.after}" inheritall="true" if="${file::exists(file.custom.step.after)}" failonerror="${fail.build.on.error}" />
<exec program="powershell.exe" if="${file::exists(file.custom.step.after + '.ps1')}" failonerror="${fail.build.on.error}" >
<arg value="${path::get-full-path(file.custom.step.after + '.ps1')}" />
</exec>
<exec program="ruby.exe" if="${file::exists(file.custom.step.after + '.rb')}" failonerror="${fail.build.on.error}" >
<arg value="${path::get-full-path(file.custom.step.after + '.rb')}" />
</exec>
</target>
</project>