This repository has been archived by the owner on Jul 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOpenPetra.build
423 lines (366 loc) · 20 KB
/
OpenPetra.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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
<?xml version="1.0"?>
<project name="OpenPetra" default="help">
<echo>operating system=${operating-system::to-string(environment::get-operating-system())}</echo>
<echo>platform=${platform::get-name()}</echo>
<include buildfile="inc/nant/OpenPetra.common.xml"/>
<!-- nant -projecthelp does not show imported targets-->
<target name="help" depends="" description="Displays the available targets and parameters.">
<echo>
list of available commands:
quickClean: cleans all generated files and the delivery directory
generateSolution: compiles OpenPetra and generates the project and solution files
generateTools: build the basic tools only
minimalGenerateSolution: generates the project and solution files. compiles what it needs, but does not compile all code
generateSolutionNoCompile: generates the project and solution files. minimalGenerateSolution should already be executed
quickCompile: will just compile the solution file, with msbuild (Windows) or our own builder (Linux)
nant quickCompile will compile the OpenPetra.sln
nant quickCompile -D:solution=Tools will compile the OpenPetra.Tools.sln
other solutions are: Client, Server, Testing
compileProject: compile a single project file
nant compileProject -D:file=delivery/projects/sharpdevelop4/Ict.Testing.ControlTestBench.csproj
start: start both the local server and client
startServer: run a local OpenPetra Server
stopServer: stop the local OpenPetra server
startClient: run the OpenPetra Client
startStandalone: run the OpenPetra standalone application, if generateSolution was run with -D:compileForStandalone=true
deleteBakFiles: delete all backup files
initConfigFiles: write and overwrite the config files for client, server and testing, and the version.txt
test: will run the NUnit tests (smaller tests: test-without-display, test-client)
devzip: build a zip file for developers for easy start
compat:
createSQLStatements: generates the sql create table statements etc from the petra.xml
dbdoc: generates database design documentation using sql2diagram
apiDoc: generates doxygen doc
errorCodeDoc: generates doc for used error codes
schemaSpy: generates database documentation using schemaSpy
recreateDatabase: needed after changes in table structure in petra.xml
resetDatabase: just resets the data, resets the permissions
patchDatabase: update the database to the latest development version
dumpDatabase: dump the database to a db specific format.
nant dumpDatabase -D:file=test.sql
loadDatabase: load the database from a db specific dump
nant loadDatabase -D:file=test.sql
loadDatabaseFromBackup: load the database from a backup
(includes table specification)
generateORM: generates Object Relational Mapping routines from petra.xml
sub items: generateORMCachedTables, generateORMData, generateORMAccess, generateORMReferenceCounts
generateGlue: generates the interfaces and instantiators, which is the glue between client and server
generateWinforms: generates all yaml files in csharp\ICT\Petra\Client
generateWinform: generate a single yaml file, and optionally compile and start the client
nant generateWinform startPetraClient -D:file=MFinance/Gui/GL/GLBatch.yaml
nant generateWinform -D:file=MFinance/Gui/GL/GLBatch.yaml -D:donotcompile=true
previewWinform: preview a single yaml file
nant previewWinform -D:file=MFinance/Gui/GL/GLBatch.yaml
cleanPetra: prepare for a clean build
compilePetra: build all Petra C# code
translation: download new language files, and create the dlls required to be delivered with a new release
buildTranslationTemplate: extracts string in winforms, creates and updates the .po files
generateGuidedTranslations: Simplifies the translation of the .po files
createI18NYamlFiles: create localised yaml files
createI18NYamlFiles -language=de-DE -path=...
releases:
buildWindowsStandalone: will build the standalone installer for Windows. Only works on Windows with InnoSetup.
buildLinuxSourceforgeRelease: will build the linux files that we upload to Sourceforge. creates tar files for local server and client
buildRemoteInstallers -D:ReleaseID=0.0.2.0 -D:OrgName="Your Organisation" -D:PublisherUrl=www.ProviderWebsite.com -D:HostedServer=app.Provider.com -D:HostedPort=9000 -D:WithLinuxClient=false
demodata:
generateDemodata: create demo data
importDemodata: imports demo data into the database
list of commands, which works in the specific csharp directories:
indent: beautify the code according to coding style guide
uncrustify: calls indent
not supported
loc, ploc: count the lines of code, to be used for COCOMO etc
generateWebforms: generates the User Interface using the Ext.js AJAX framework
generateWebform: generate a single Webform. requires parameter: -D:file=SampleApplicationForm
startWebServer: start a webservice with Mono XSP and Postgresl (does not work with sqlite at the moment)
useful parameters
-logfile:test.log
</echo>
</target>
<target name="apiDoc" description="Generates API documentation. nant depend should have been run" >
<exec program="${external.doxygen}">
<arg value=""${external.doxygen.configfile}"" />
</exec>
</target>
<target name="errorCodeDoc" description="Generates documentation of the error codes" >
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('ExecDotNet')}"/>
<ExecDotNet program="${dir.bin}/Ict.Tools.GenerateI18N.exe"
commandline=""-csharppath:${dir.csharp}" "-templatefilepath:${dir.incdir.template}/doc/errorcodes.html" "-outfilepath:${dir.delivery}/errorcodes.html" -do:errorcodedoc" />
</target>
<target name="translation" description="create the dlls with the i18n messages" >
<property name="target" value="compile" overwrite="false" />
<nant inheritall="true" target="${target}"
buildfile="i18n/i18n.build" />
</target>
<target name="buildTranslationTemplate" description="extracts string in winforms, creates and updates the .po files" >
<property name="target" value="compile" overwrite="false" />
<nant inheritall="false" target="extractMsgs"
buildfile="i18n/i18n.build" />
</target>
<target name="generateGuidedTranslations" description="simplifies the translation of the .po files" >
<property name="target" value="compile" overwrite="false" />
<nant inheritall="false" target="guidedTrans"
buildfile="i18n/i18n.build" />
</target>
<target name="createI18NYamlFiles" description="create localised yaml files" >
<nant inheritall="true" target="createI18NYamlFiles"
buildfile="i18n/i18n.build" />
</target>
<target name="custclean" description="Cleans the solution and project files">
<foreach item="String" property="devenv-name" delim="," in="${projectfiles.templates-list}" >
<delete>
<fileset basedir="${path::combine(dir.projectfiles,devenv-name)}">
<include name="OpenPetra*.sln" />
<include name="*.csproj" />
</fileset>
</delete>
</foreach>
<delete>
<fileset basedir="${dir.delivery}" >
<include name="OpenPetraSetup-*.exe" />
</fileset>
</delete>
<property name="target" value="clean" />
</target>
<target name="quickClean" description="cleans all generated files and the delivery directory">
<!-- Do not remove dir.delivery, because this would change all UUIDs from the project files -->
<!-- Do not remove dir.bin, because this fails on Windows Jenkins server for NUnit tests -->
<delete>
<fileset basedir="${dir.bin}">
<include name="**" />
<exclude name="."/>
</fileset>
</delete>
<delete>
<fileset basedir="${dir.obj}">
<include name="**" />
<exclude name="."/>
</fileset>
</delete>
<delete file="${namespaceFile}"/>
<delete file="${projectDependenciesFile}"/>
<foreach item="String" property="devenv-name" delim="," in="${projectfiles.templates-list}" >
<delete dir="${path::combine(dir.projectfiles,devenv-name)}" />
</foreach>
<delete>
<fileset basedir="${dir.root}">
<include name="**/*-generated.build" />
<include name="**/*-generated.cs" />
<include name="**/*-generated.resx" />
<include name="**/*-generated.Designer.cs" />
<include name="**/*.generated.refs" />
<include name="**/*.dll.xml" />
<include name="tmp/**/AssemblyInfo.cs" />
</fileset>
</delete>
</target>
<target name="setuptools" description="goes into the directory setup/tools">
<property name="target" value="indent" overwrite="false" />
<nant inheritall="false" target="${target}"
buildfile="setup/tools/setuptools.build" />
</target>
<target name="nanttasks" description="goes into the directory inc/nanttasks">
<property name="target" value="compile" overwrite="false" />
<nant inheritall="false" target="${target}"
buildfile="inc/nanttasks/nanttasks.build" />
</target>
<target name="csharp" depends="nanttasks" description="goes into the directory csharp">
<property name="target" value="compile" overwrite="false" />
<nant inheritall="false" target="${target}"
buildfile="csharp/csharp.build" />
</target>
<target name="webserver" depends="nanttasks" description="goes into the directory webserver">
<property name="target" value="compile" overwrite="false" />
<nant inheritall="false" target="${target}"
buildfile="webserver/webserver.build" />
</target>
<target name="internal-subdirs" description="Goes into all necessary subdirectories"
depends="csharp,nanttasks,webserver,setuptools" />
<target name="generateSolutionNoCompile" description="generates the project and solution files. minimalGenerateSolution should already be executed"
depends="generateProjectFiles"/>
<target name="minimalGenerateSolution" description="compile minimal code for generating source code and the project and solution files">
<call target="generateTools"/>
<call target="generateWinforms"/>
<call target="generateORM"/>
<call target="generateGlue"/>
<!-- need to call generateNamespaceMap again, even though it was called in generateTools already. but now the winforms and ORM have been generated -->
<call target="generateNamespaceMap"/>
<call target="generateProjectFiles"/>
</target>
<target name="generateSolution" description="compiles OpenPetra and generates the project and solution files"
depends="minimalGenerateSolution">
<call target="quickCompile"/>
</target>
<target name="generateNamespaceMap">
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('GenerateNamespaceMap')}"/>
<GenerateNamespaceMap
CodeRootDir="${dir.csharp}"
NamespaceMapFilename="${namespaceFile}"
NamespaceMap3rdParty="${namespaceFile3rdParty}"
CompilingForStandalone="${compileForStandalone}"
DependencyMapFilename="${projectDependenciesFile}"/>
</target>
<target name="generateTools">
<call target="nanttasks"/>
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('GenerateNamespaceMap')}"/>
<GenerateNamespaceMap
CodeRootDir="${dir.csharp}"
NamespaceMapFilename="${namespaceFile}"
NamespaceMap3rdParty="${namespaceFile3rdParty}"
DependencyMapFilename="${projectDependenciesFile}"
ShowWarnings="false"
LimitToNamespaces="Ict.Common,Ict.Common.IO,Ict.Common.DB,Ict.Tools*"/>
<nant inheritall="false" target="compile"
buildfile="csharp/ThirdParty/ThirdParty.build" />
<call target="generateProjectFilesInternal"/>
<call target="quickCompile"/>
</target>
<target name="generateProjectFiles" depends="nanttasks,generateNamespaceMap,generateProjectFilesInternal"/>
<target name="generateProjectFilesInternal">
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('GenerateProjectFiles')}"/>
<GenerateProjectFiles
CodeRootDir="${dir.csharp}"
DependencyMapFilename="${projectDependenciesFile}"
GUIDMapFilename="${uuidFile}"
TemplateDir="${dir.incdir.template}"
DevEnvironments="${devenv-msbuild},${projectfiles.templates-list}"
DirBin="${dir.bin}"
DirProjectFiles="${dir.projectfiles}"
NetFrameworkVersion="${NETframework-version}"
ProjectVersion="${ReleaseID}"
DebugParameters="PetraClient,-C:${ClientConfigFile},PetraServerConsole,-C:${ServerConfigFile}"
/>
</target>
<!-- Include default implementation -->
<include buildfile="inc/nant/OpenPetra.subdirs.xml"/>
<!-- Compat targets -->
<include buildfile="inc/nant/OpenPetra.tobe.migrated.xml"/>
<!-- tasks for building releases -->
<include buildfile="setup/setup.build"/>
<!-- tasks for creating demodata -->
<include buildfile="demodata/demodata.build"/>
<target name="MsBuildTarget">
<msbuild project="${solution.file}" verbosity="Minimal">
<property name="Configuration" value="${Configuration}"/>
</msbuild>
</target>
<target name="quickCompile">
<!-- this is very different from the compile target. quickCompile does not generate any code.
quickCompile uses the solution and csproj files and msbuild.
quickCompile is intended as an alternative to compile in SharpDevelop directly.
-->
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('CompileSolution')}"/>
<property name="solution" value="OpenPetra" overwrite="false"/>
<property name="solution.file" value="${path::combine(dir.projectfiles,
path::combine(devenv-msbuild, 'OpenPetra.'+solution+'.sln'))}"/>
<property name="solution.file" value="${string::replace(solution.file, 'OpenPetra.OpenPetra.sln', 'OpenPetra.sln')}"/>
<CompileSolution SolutionFile="${solution.file}"/>
</target>
<target name="compileProject">
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('GenerateNamespaceMap')}"/>
<CompileProject CSProjFile="${path::get-full-path(file)}" ProjectFilesDir="${dir.projectfiles}/${devenv-msbuild}" CodeRootDir="${dir.csharp}"/>
</target>
<target name="generateORM" depends="generateORMCachedTables,generateORMData,generateORMAccess,generateORMReferenceCounts">
<echo message="please compile the code after the files have been regenerated"/>
</target>
<target name="generateORMData">
<!-- generate the files for Ict.Petra.Shared.lib.data, ie. the tables and datasets -->
<nant inheritall="false" target="custdepend" buildfile="${path::combine(dir.csharp, 'ICT/Petra/Shared/Ict.Petra.Shared.build')}" verbose="${verbose}"/>
</target>
<target name="generateORMAccess">
<!-- generate the files for Ict.Petra.Server.lib.data, ie. the access files for reading from and writing to the database -->
<nant inheritall="false" target="custdepend" buildfile="${path::combine(dir.csharp, 'ICT/Petra/Server/Ict.Petra.Server.build')}" verbose="${verbose}"/>
</target>
<target name="generateWinforms">
<property name="WithWindowsClient" value="true" overwrite="false"/>
<property name="WithLinuxClient" value="false" overwrite="false"/>
<if test="${WithWindowsClient or WithLinuxClient}">
<nant inheritall="true" target="custdepend" buildfile="${path::combine(dir.csharp, 'ICT/Petra/Client/Ict.Petra.Client.build')}" verbose="${verbose}"/>
<nant inheritall="true" target="custdepend" buildfile="${path::combine(dir.csharp, 'ICT/Petra/PetraClient/PetraClient.build')}" verbose="${verbose}"/>
</if>
</target>
<target name="generateWinform">
<nant inheritall="true" target="generateWinform" buildfile="${path::combine(dir.csharp, 'ICT/Petra/Client/Ict.Petra.Client.build')}" verbose="${verbose}"/>
</target>
<target name="previewWinform">
<nant inheritall="true" target="previewWinform" buildfile="${path::combine(dir.csharp, 'ICT/Petra/Client/Ict.Petra.Client.build')}" verbose="${verbose}"/>
</target>
<target name="test" depends="initConfigFiles, set-server-port-for-jenkins">
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('GenerateNamespaceMap')}"/>
<nant inheritall="false" target="test-all" buildfile="${path::combine(dir.csharp, 'ICT/Testing/ICT.Testing.build')}" verbose="${verbose}"/>
</target>
<target name="test-without-display" depends="initConfigFiles, set-server-port-for-jenkins">
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('GenerateNamespaceMap')}"/>
<nant inheritall="false" target="test-without-display" buildfile="${path::combine(dir.csharp, 'ICT/Testing/ICT.Testing.build')}" verbose="${verbose}"/>
</target>
<target name="test-main-navigation-screens" depends="initConfigFiles, set-server-port-for-jenkins">
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('GenerateNamespaceMap')}"/>
<nant inheritall="false" target="test-main-navigation-screens" buildfile="${path::combine(dir.csharp, 'ICT/Testing/ICT.Testing.build')}" verbose="${verbose}"/>
</target>
<target name="test-client" depends="initConfigFiles, set-server-port-for-jenkins">
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('GenerateNamespaceMap')}"/>
<nant inheritall="false" target="test-client" buildfile="${path::combine(dir.csharp, 'ICT/Testing/ICT.Testing.build')}" verbose="${verbose}"/>
</target>
<target name="enable-sqlite-config-for-jenkins">
<echo file="OpenPetra.build.config"><?xml version="1.0"?>
<project name="OpenPetra-userconfig">
<property name="DBMS.Type" value="sqlite"/>
<property name="DBMS.Password" value=""/>
<property name="Server.Port" value="${Server.Port}"/>
</project>
</echo>
</target>
<!-- need to set the server port here, since it is not passed when called the Unit tests, so they are not using the server port defined on the command line;
only applies if no local OpenPetra.build.config file exists -->
<target name="set-server-port-for-jenkins">
<if test="${not file::exists('OpenPetra.build.config') and not file::exists('OpenPetra.build.config.my')}">
<echo file="OpenPetra.build.config"><?xml version="1.0"?>
<project name="OpenPetra-userconfig">
<property name="Server.Port" value="${Server.Port}"/>
<property name="PostgreSQL.Version" value="${PostgreSQL.Version}"/>
<property name="DBMS.Type" value="${DBMS.Type}"/>
<property name="DBMS.DBHostOrFile" value="${DBMS.DBHostOrFile}"/>
<property name="DBMS.DBName" value="${DBMS.DBName}"/>
<property name="DBMS.UserName" value="${DBMS.UserName}"/>
<property name="DBMS.Password" value="${DBMS.Password}"/>
</project>
</echo>
</if>
</target>
<target name="devzip">
<!-- calling script must get a fresh bzr tree, write OpenPetra.build.config with sqlite -->
<call target="quickClean"/>
<call target="generateSolution"/>
<call target="recreateDatabase"/>
<call target="resetDatabase"/>
<!-- download another demo database, and load it -->
<delete file="demoWith2ledgers.yml.gz" />
<exec program="wget" commandline="http://sourceforge.net/projects/openpetraorg/files/openpetraorg/demodata/demoWith2ledgers.yml.gz/download -OdemoWith2ledgers.yml.gz"/>
<call target="startPetraServer"/>
<sleep seconds="3"/>
<loadtasks assembly="${Ict.Tools.NAntTasks.DLL}" unless="${task::exists('GenerateNamespaceMap')}"/>
<ExecDotNet program="${dir.bin}/PetraServerAdminConsole.exe"
commandline="-C:${dir.root}/etc/ServerAdmin.config -Command:LoadYmlGz -YmlGzFile:${dir.root}/demoWith2ledgers.yml.gz"/>
<call target="stopPetraServer"/>
<copy file="${dir.delivery}/bin/Ict.Tools.DevelopersAssistant.exe" todir="${dir.root}"/>
<script prefix="utils" language="C#">
<code>
<![CDATA[
[Function("GetFormattedDate")]
public static string GetFormattedDate() {
return System.DateTime.Now.ToString("yyyy-MM-dd");
}
]]>
</code>
</script>
<property name="zipfile" value="${dir.root}/../openpetra_development_${utils::GetFormattedDate()}.zip"/>
<zip zipfile="${zipfile}">
<fileset basedir="${dir.root}" prefix="openpetra">
<include name="**/*" />
<exclude name="**/.bzr/**"/>
<exclude name="**/.git/**"/>
</fileset>
</zip>
<!-- calling script must upload the zip file to sourceforge -->
</target>
</project>