-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathbuild.xml
executable file
·738 lines (658 loc) · 31.3 KB
/
build.xml
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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
<project name="SWGBuild" default="echoprops" xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="git_targets.xml" />
<description>
This build file will build all aspects of the SWG Source Code. Created by Cekis (cekisswg@gmail.com).
</description>
<!-- Get our host info -->
<hostinfo/>
<!-- Property File -->
<property file="local.properties" />
<property file="build.properties" />
<!-- Global Properties -->
<property name="build" location="${basedir}/build"/>
<!-- Database Service Name is derived to make it easier in the properties file -->
<property name="service_name" value="//127.0.0.1/${db_service}"/>
<property name="dbip" value="${ADDR4}"/>
<!-- Setup Source Directories -->
<property name="exe" location="${basedir}/exe"/>
<property name="src" location="${basedir}/src"/>
<property name="dsrc" location="dsrc" relative="true" basedir="${basedir}"/>
<property name="data" location="data" relative="true" basedir="${basedir}"/>
<property name="stationapi" location="${basedir}/stationapi"/>
<property name="src_library" location="${src}/external/3rd/library"/>
<property name="chat_build" location="${stationapi}/build"/>
<property name="serverdata" location="${basedir}/serverdata"/>
<property name="configs" location="configs" relative="true" basedir="${basedir}"/>
<!-- Setup Key Game Directories -->
<property name="dsrc_server" location="${dsrc}/sku.0/sys.server/compiled/game"/>
<property name="dsrc_shared" location="${dsrc}/sku.0/sys.shared/compiled/game"/>
<property name="data_server" location="${data}/sku.0/sys.server/compiled/game"/>
<property name="data_shared" location="${data}/sku.0/sys.shared/compiled/game"/>
<property name="data_client" location="${data}/sku.0/sys.client/compiled"/>
<!-- Setup CRC Files to load into the database -->
<property name="object_crc_file" location="${dsrc}/sku.0/sys.server/built/game/misc/object_template_crc_string_table.tab"/>
<property name="templates_sql_file" location="${build}/templates.sql"/>
<!-- ACM Customization directories and related properties -->
<property name="perl_tools" location="${basedir}/tools" />
<property name="swgperllib" location="${perl_tools}/perllib" />
<property name="treexlat" value="${build}/treefile-xlat.dat" description="treefileLookupDataFileName"/>
<property name="custinfo" value="${build}/custinfo-raw.dat" description="unoptimizedCustomizationInfoFileName" />
<property name="custopt" value="${build}/custinfo-raw-optimized.dat" description="optimizedCustomizationInfoFileName" />
<property name="artlog" value="art-asset-customization-report.log" />
<property name="acmmif" value="${dsrc_shared}/customization/asset_customization_manager.mif" />
<property name="cimmif" value="${dsrc_shared}/customization/customization_id_manager.mif" />
<property name="acmiff" value="${data_shared}/customization/asset_customization_manager.iff" />
<property name="cimiff" value="${data_shared}/customization/customization_id_manager.iff" />
<!-- Define where most of our compiled tools will live -->
<property name="tools_home" location="${build}/bin"/>
<property name="bin_home" location="${exe}/linux/bin"/>
<property environment="env"/>
<!-- The init target handles the environment setup - not much to do but create directories -->
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
<mkdir dir="${data_server}"/>
<mkdir dir="${data_shared}"/>
<mkdir dir="${data_client}"/>
</target>
<target name="echoprops">
<echoproperties/>
<echo>IP Address: ${ADDR4}</echo>
</target>
<target name="swg" description="builds the entire SWG codebase for the first run" depends="clean,git_update_submods,update_configs,create_database,compile">
</target>
<!-- Clean simply calls the other clean targets -->
<target name="clean" depends="clean_src,clean_dsrc,init">
</target>
<!-- Delete the SRC Build folder -->
<target name="clean_src">
<echo>Cleaning the SRC build directory.</echo>
<delete dir="${build}" verbose="false" failonerror="false"/>
</target>
<!-- Delete the DSRC Build folder -->
<target name="clean_dsrc">
<echo>Cleaning the DSRC directory.</echo>
<delete includeemptydirs="true" removeNotFollowedSymlinks="true" failonerror="false">
<fileset dir="${data}" includes="**/*" followsymlinks="false"/>
</delete>
</target>
<!-- Delete the DSRC Build folder -->
<target name="clean_java">
<echo>Cleaning the DSRC script directory.</echo>
<delete dir="${data_server}/script" verbose="false"/>
</target>
<!-- Gets the architecture we're on - uses old way of getting it from original build_linux.sh script -->
<target name="get_arch">
<exec executable="arch" dir="." outputproperty="arch"/>
<condition property="compile.x86">
<equals arg1="${arch}" arg2="x86_64"/>
</condition>
<echo>Architecture is ${arch}</echo>
<condition property="is_debug_build">
<equals arg1="${src_build_type}" arg2="Debug"/>
</condition>
<echo>Creating a ${src_build_type} build</echo>
<condition property="use_gcc">
<equals arg1="${compiler}" arg2="gcc"/>
</condition>
</target>
<target name="set_compiler" description="sets the compiler to use based on what is set in build.properties" depends="set_gcc,set_clang">
</target>
<target name="set_gcc" if="${use_gcc}">
<echo>Using the GCC compiler</echo>
<property name="cc_compiler" value="gcc"/>
<property name="cxx_compiler" value="g++"/>
</target>
<target name="set_clang" unless="${use_gcc}">
<echo>Using the CLang compiler</echo>
<property name="cc_compiler" value="clang"/>
<property name="cxx_compiler" value="clang++"/>
</target>
<!-- Gets the number of processors at our disposal -->
<target name="get_num_procs">
<exec executable="nproc" dir="." outputproperty="nproc"/>
<echo>We have ${nproc} processors (cores) to use.</echo>
</target>
<target name="git_update_submod_src_check" description="Check if the src_branch property is set">
<condition property="src_branch_is_set" else="false">
<isset property="src_branch"/>
</condition>
</target>
<target name="git_update_submod_src" description="Checkout the src branch" depends="git_update_submod_src_check" if="src_branch_is_set">
<git-checkout branch="${src_branch}" dir="${src}"/>
</target>
<target name="git_update_submod_dsrc_check" description="Check if the dsrc_branch property is set">
<condition property="dsrc_branch_is_set" else="false">
<isset property="dsrc_branch"/>
</condition>
</target>
<target name="git_update_submod_dsrc" description="Checkout the dsrc branch" depends="git_update_submod_dsrc_check" if="dsrc_branch_is_set">
<git-checkout branch="${dsrc_branch}" dir="${dsrc}"/>
</target>
<target name="git_update_submod_configs_check" description="Check if the configs_branch property is set">
<condition property="configs_branch_is_set" else="false">
<isset property="configs_branch"/>
</condition>
</target>
<target name="git_update_submod_configs" description="Checkout the configs branch" depends="git_update_submod_configs_check" if="configs_branch_is_set">
<git-checkout branch="${configs_branch}" dir="${basedir}/exe"/>
</target>
<target name="git_update_submod_serverdata_check" description="Check if the serverdata_branch property is set">
<condition property="serverdata_branch_is_set" else="false">
<isset property="serverdata_branch"/>
</condition>
</target>
<target name="git_update_submod_serverdata" description="Checkout the serverdata branch" depends="git_update_submod_serverdata_check" if="serverdata_branch_is_set">
<git-checkout branch="${serverdata_branch}" dir="${serverdata}"/>
</target>
<target name="git_update_submod_stationapi_check" description="Check if the stationapi_branch property is set">
<condition property="stationapi_branch_is_set" else="false">
<isset property="stationapi_branch"/>
</condition>
</target>
<target name="git_update_submod_stationapi" description="Checkout the stationapi branch" depends="git_update_submod_stationapi_check" if="stationapi_branch_is_set">
<git-checkout branch="${stationapi_branch}" dir="${stationapi}"/>
</target>
<target name="git_update_submods" description="Pull down the sub-modules for swg-main">
<git-update-submods dir="${basedir}"/>
<antcall target="git_update_submod_src"/>
<antcall target="git_update_submod_dsrc"/>
<antcall target="git_update_submod_configs"/>
<antcall target="git_update_submod_serverdata"/>
<antcall target="git_update_submod_stationapi"/>
</target>
<target name="update_configs" description="updates the configuration files with the desired settings" if="firstrun">
<replace dir="${exe}" propertyFile="${basedir}/build.properties">
<include name="**/*.cfg"/>
<replacefilter token="CLUSTERNAME" property="cluster_name"/>
<replacefilter token="HOSTIP" value="${ADDR4}"/>
<replacefilter token="DBUSERNAME" property="db_username"/>
<replacefilter token="DBSERVICE" value="${service_name}"/>
<replacefilter token="DBPASSWORD" property="db_password"/>
</replace>
</target>
<!-- Creates the Make files for our SRC that will be used during compile stage (Intel) -->
<target name="prepare_src_x86" depends="init,get_arch,set_compiler" description="prepare server code - Intel" if="compile.x86">
<exec executable="cmake" dir="${build}" failonerror="true">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<env key="CC" value="${cc_compiler}" unless:true="${use_gcc}"/>
<env key="CXX" value="${cxx_compiler}" unless:true="${use_gcc}"/>
<env key="LDFLAGS" value="-L/usr/lib32"/>
<env key="CMAKE_PREFIX_PATH" value="/usr/lib32:/lib32:/usr/lib/i386-linux-gnu:/usr/include/i386-linux-gnu"/>
<arg value="-DCMAKE_C_FLAGS=-m32"/>
<arg value="-DCMAKE_CXX_FLAGS=-m32"/>
<arg value="-DCMAKE_EXE_LINKER_FLAGS=-m32"/>
<arg value="-DCMAKE_MODULE_LINKER_FLAGS=-m32"/>
<arg value="-DCMAKE_SHARED_LINKER_FLAGS=-m32"/>
<arg value="-DCMAKE_BUILD_TYPE=${src_build_type}"/>
<arg value="${src}"/>
</exec>
</target>
<!-- Creates the Make files for our SRC that will be used during compile stage (Non-Intel) -->
<target name="prepare_src" depends="init,get_arch,set_compiler" description="compile server code - non Intel" unless="compile.x86">
<exec executable="cmake" dir="${build}" failonerror="true">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<env key="CC" value="${cc_compiler}" unless:true="${use_gcc}"/>
<env key="CXX" value="${cxx_compiler}" unless:true="${use_gcc}"/>
<arg value="-DCMAKE_BUILD_TYPE=${src_build_type}"/>
<arg value="${src}"/>
</exec>
</target>
<target name="strip_src" unless="${is_debug_build}" description="removes debugging information from release builds, making them smaller">
<exec executable="strip" dir="${build}">
<arg value="-d"/>
<arg value="bin/*"/>
</exec>
</target>
<!-- Compiles the SRC (C++) code -->
<target name="compile_src" description="compile server code" depends="init,prepare_src,prepare_src_x86,get_num_procs,strip_src">
<exec executable="make" dir="${build}" failonerror="true">
<env key="CC" value="${cc_compiler}"/>
<env key="CXX" value="${cxx_compiler}"/>
<arg value="-j${nproc}"/>
</exec>
<echo message="SRC Compiled to Build Type: ${src_build_type}" />
</target>
<!-- Prepares the Station API (chat server) code for building -->
<target name="prepare_chat" description="creates a symbolic link to the udplibrary">
<mkdir dir="${chat_build}"/>
<mkdir dir="${basedir}/chat"/>
<symlink link="${stationapi}/externals/udplibrary" resource="${src_library}/udplibrary" overwrite="true"/>
</target>
<!-- Cleans up the station chat compilation process -->
<target name="clean_chat" description="removes the symbolic link to the udplibrary">
<delete dir="${chat_build}"/>
<symlink action="delete" link="${stationapi}/externals/udplibrary"/>
</target>
<!-- Compiles the Station API (chat server) code -->
<target name="compile_chat" description="compile chat server code" depends="prepare_chat">
<exec executable="cmake" dir="${chat_build}" failonerror="true">
<arg value="${stationapi}"/>
<arg value="-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${basedir}/chat"/>
</exec>
<exec executable="cmake" dir="${chat_build}" failonerror="true">
<arg value="--build"/>
<arg value="."/>
</exec>
<copy file="${stationapi}/extras/logger.cfg.dist" tofile="${basedir}/chat/etc/stationapi/logger.cfg"/>
<copy file="${stationapi}/extras/swgchat.cfg.dist" tofile="${basedir}/chat/etc/stationapi/swgchat.cfg"/>
<copy file="${stationapi}/extras/stationchat.db.dist" tofile="${basedir}/chat/var/stationapi/stationchat.db" failonerror="false"/>
<copy file="${stationapi}/extras/init_database.sql" tofile="${basedir}/chat/init_database.sql"/>
</target>
<!-- Compiles the DSRC (Java) code -->
<target name="compile_java" depends="init" description="compile java code">
<javac srcdir="${dsrc_server}" destdir="${data_server}" includeantruntime="false" classpath="${data_server}" encoding="utf8" sourcepath="${dsrc_server}" debug="true" deprecation="on">
<compilerarg value="-Xlint:-options"/>
</javac>
<antcall target="create_symlinks"/>
</target>
<!-- Compiles all code necessary for server execution -->
<target name="compile" depends="compile_src,compile_chat,compile_java,compile_miff,compile_tab,compile_tpf,load_templates">
</target>
<!-- Compiles all .mif files -->
<target name="compile_miff">
<fileset id="miff_files" dir="${dsrc}" includes="**/*.mif" excludes="**/asset_customization_manager.mif"/>
<touch mkdirs="true" verbose="false">
<fileset refid="miff_files"/>
<mapper type="glob" from="*.mif" to="${data}/*/.tmp" />
</touch>
<delete>
<fileset dir="${data}" includes="**/.tmp"/>
</delete>
<apply executable="./Miff" dir="${tools_home}" dest="${data}" parallel="false" type="file">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<arg value="-i"/>
<srcfile prefix=""" suffix="""/>
<arg value="-o"/>
<targetfile prefix=""" suffix="""/>
<fileset refid="miff_files"/>
<mapper type="glob" from="*.mif" to="*.iff"/>
</apply>
<antcall target="cleanup"/>
</target>
<!-- Compiles all .tab files -->
<target name="compile_tab">
<property name="server_datatables" location="${dsrc_server}/datatables"/>
<property name="shared_datatables" location="${dsrc_shared}/datatables"/>
<property name="include_datatables" location="${shared_datatables}/include"/>
<touch mkdirs="true" verbose="false">
<fileset dir="${dsrc}" includes="**/*.tab"/>
<mapper type="glob" from="*.tab" to="${data}/*/.tmp" />
</touch>
<delete>
<fileset dir="${data}" includes="**/.tmp"/>
</delete>
<apply executable="./DataTableTool" dir="${tools_home}" dest="${data}" parallel="false" type="file" failonerror="true">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<arg value="-i"/>
<srcfile prefix=""" suffix="""/>
<arg value="-- -s SharedFile"/>
<arg value="searchPath10=${data_shared}"/>
<arg value="searchPath10=${data_server}"/>
<arg value="searchPath10=${data_server}"/>
<fileset dir="${dsrc}" includes="**/*.tab" excludes="**/object_template_crc_string_table.tab,**/quest_crc_string_table.tab"/>
<mapper type="glob" from="*.tab" to="*.iff"/>
</apply>
<antcall target="cleanup"/>
</target>
<!-- Compiles all Template Files (.tpf) -->
<target name="compile_tpf" description="compile the template files (*.tpf) into .iff">
<echo message="Looking for Template Files to compile... please wait..."/>
<touch mkdirs="true" verbose="false">
<fileset dir="${dsrc}" includes="**/*.tpf"/>
<mapper type="glob" from="*.tpf" to="${data}/*/.tmp" />
</touch>
<delete>
<fileset dir="${data}" includes="**/.tmp"/>
</delete>
<apply executable="${tools_home}/TemplateCompiler" dir="${basedir}" dest="${basedir}" parallel="false" type="file" failonerror="false" relative="true">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<arg value="-compile"/>
<srcfile/>
<fileset dir="${basedir}" includes="${dsrc}/**/*.tpf"/>
<mapper type="glob" from="${dsrc}/*.tpf" to="${data}/*.iff"/>
</apply>
<antcall target="cleanup"/>
</target>
<!-- Compiles all Template Definition Files (.tdf) -->
<!--
<target name="compile_tdf" description="compile the template definition files (*.tdf) into .iff">
<touch mkdirs="true" verbose="false">
<fileset dir="${dsrc}" includes="**/*.tdf"/>
<mapper type="glob" from="*.tdf" to="${data}/*/.tmp" />
</touch>
<delete>
<fileset dir="${data}" includes="**/.tmp"/>
</delete>
<apply executable="${tools_home}/TemplateDefinitionCompiler" dir="${basedir}" dest="${basedir}" parallel="false" type="file" failonerror="false" relative="true">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<arg value="-compile"/>
<srcfile/>
<fileset dir="${basedir}" includes="${dsrc}/**/*.tdf"/>
<mapper type="glob" from="${dsrc}/*.tdf" to="${data}/*.iff"/>
</apply>
<antcall target="cleanup"/>
</target>
-->
<!-- Creates the Object Template CRC file -->
<target name="build_object_template_crc" description="creates the object template crc file" depends="compile_tpf, compile_miff">
<exec executable="utils/build_object_template_crc_string_tables.py" dir="${basedir}">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
</exec>
</target>
<!-- Creates the Quest CRC file -->
<target name="build_quest_crc" description="creates the quest crc file" depends="compile_tab">
<exec executable="utils/build_quest_crc_string_tables.py" dir="${basedir}">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
</exec>
</target>
<!-- Creates the Planet CRC file -->
<target name="build_planet_crc" description="creates the planet crc file" depends="compile_tab">
<exec executable="utils/build_planet_crc_string_tables.py" dir="${basedir}">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
</exec>
</target>
<!-- Creates SQL (insert statements) to get all the CRC Templates into the database -->
<target name="process_templates" description="generates sql from generated crc files" depends="build_object_template_crc,build_quest_crc">
<exec executable="perl" dir="${basedir}/src/game/server/database/templates" input="${object_crc_file}" output="${templates_sql_file}">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<arg value="processTemplateList.pl"/>
</exec>
</target>
<!-- Executes the generated Template CRC SQL in SQL*Plus -->
<target name="load_templates" description="loads generated templates into the database" depends="process_templates">
<exec executable="sqlplus" dir="${build}">
<arg value="${db_username}/${db_password}@${dbip}/${db_service}"/>
<arg value="@${templates_sql_file}"/>
</exec>
</target>
<!-- Target used to create database tables -->
<target name="create_database" description="creates database tables from existing sql scripts" if="firstrun">
<replace file="build.properties" token="firstrun = true" value="firstrun = false"/>
<exec executable="perl" dir="${basedir}/src/game/server/database/build/linux">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<arg value="database_update.pl"/>
<arg value="--username=${db_username}"/>
<arg value="--password=${db_password}"/>
<arg value="--service=${dbip}/${db_service}"/>
<arg value="--goldusername=${db_username}"/>
<arg value="--loginusername=${db_username}"/>
<arg value="--createnewcluster"/>
<arg value="--packages"/>
</exec>
<antcall target="add_new_cluster"/>
<antcall target="configure_limits"/>
<antcall target="update_database"/>
</target>
<!-- Target used to update the game database with the latest changes -->
<target name="update_database" description="runs the database update script to acquire the latest changes to the database">
<replace file="build.properties" token="firstrun = true" value="firstrun = false"/>
<exec executable="perl" dir="${basedir}/src/game/server/database/build/linux">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<arg value="database_update.pl"/>
<arg value="--username=${db_username}"/>
<arg value="--password=${db_password}"/>
<arg value="--service=${dbip}/${db_service}"/>
<arg value="--goldusername=${db_username}"/>
<arg value="--loginusername=${db_username}"/>
<arg value="--delta"/>
</exec>
</target>
<target name="add_new_cluster" description="Adds the cluster name to the database" if="firstrun">
<sql classpath="${env.ORACLE_HOME}/lib/ojdbc8.jar"
driver="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@${dbip}:1521:${db_service}"
userid="${db_username}"
password="${db_password}">
insert into cluster_list (id, name, num_characters, address, secret, locked, not_recommended)
select (select nvl(max(id)+1,1) from cluster_list), '${cluster_name}', 0, '${ADDR4}', 'N', 'N', 'N' from dual
where not exists (select '${cluster_name}', '${ADDR4}' from cluster_list);
</sql>
</target>
<target name="configure_limits" description="Defines the limits of the cluster and accounts in the database">
<sql classpath="${env.ORACLE_HOME}/lib/ojdbc8.jar"
driver="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@${dbip}:1521:${db_service}"
userid="${db_username}"
password="${db_password}">
update default_char_limits set account_limit = ${max_characters_per_account}, cluster_limit = ${max_characters_per_cluster};
update default_character_slots set num_slots = ${character_slots} where character_type_id = 1;
</sql>
</target>
<!-- Target used to delete database tables - change properties file "firstrun" from "false" to "true" to enable execution -->
<target name="drop_database" description="completely wipes database data">
<input message="All data WILL BE DELETED from SWG DB!!! ARE YOU SURE YOU WANT TO DELETE? Type the word DELETE if you do: " addproperty="do.delete"/>
<condition property="do.drop">
<equals arg1="DELETE" arg2="${do.delete}"/>
</condition>
<fail unless="do.drop">Database Drop Aborted.</fail>
<replace file="build.properties" token="firstrun = true" value="firstrun = false"/>
<exec executable="perl" dir="${basedir}/src/game/server/database/build/linux">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<arg value="database_update.pl"/>
<arg value="--username=${db_username}"/>
<arg value="--password=${db_password}"/>
<arg value="--service=${dbip}/${db_service}"/>
<arg value="--goldusername=${db_username}"/>
<arg value="--loginusername=${db_username}"/>
<arg value="--drop"/>
<arg value="--packages"/>
</exec>
</target>
<target name="create_symlinks">
<symlink link="${basedir}/data/sku.0/sys.client/compiled/clientdata" resource="${serverdata}" overwrite="true"/>
<symlink link="${basedir}/exe/linux/bin" resource="${tools_home}" overwrite="true"/>
</target>
<target name="webcfg-check-for-file">
<available file="webcfg.properties" property="webcfg.properties.present"/>
</target>
<target name="webcfg" description="Fetches the settings using the SWG Auth WebCFG API" depends="webcfg-check-for-file" if="webcfg.properties.present">
<property file="webcfg.properties" />
<echo message="Server path: ${serverpath}" />
<echo message="File Path: ${filepath}" />
<get src="${serverpath}" dest="${filepath}" />
</target>
<target name="start" description="starts the server" depends="create_symlinks,stop,webcfg">
<exec executable="./exec.sh" />
</target>
<target name="stop" description="stops the login server">
<exec executable="killall" dir="${basedir}">
<arg value="LoginServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="CentralServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="ChatServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="CommoditiesServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="ConnectionServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="CustomerServiceServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="LogServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="MetricsServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="PlanetServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="ServerConsole"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="SwgDatabaseServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="-9"/>
<arg value="SwgGameServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="TransferServer"/>
</exec>
<exec executable="killall" dir="${basedir}">
<arg value="TaskManager"/>
</exec>
</target>
<!-- Cleans up empty folders from the build folder -->
<target name="cleanup" description="Clean up">
<delete includeemptydirs="true">
<fileset dir="${data}">
<and>
<size value="0"/>
<type type="dir"/>
</and>
</fileset>
</delete>
</target>
<target name="git_update_main" description="Checkout the swg-main branch" >
<git-pull dir="${basedir}" branch="${swg_main_branch}"/>
</target>
<target name="git_update_submods_to_latest_commit" description="Updates all submodules to the latest remote repository commit">
<exec executable="git" dir="${basedir}">
<arg value="submodule"/>
<arg value="foreach"/>
<arg line="'(git checkout master; git pull)&'"/>
</exec>
</target>
<!-- Call this to simply update SWG when you want your code updated to the latest version -->
<target name="update_swg" description="Updates the entire codebase with latest from the remote repositories and recompiles" depends="git_update_main,git_update_submods_to_latest_commit,update_database,compile">
</target>
<!-- Begin ACM Related Targets -->
<target name="cleanup_acm">
<echo>Preface: Clean up any existing files so we don't get wires crossed.</echo>
<delete>
<fileset dir="${build}" includes="*.tab,*.dat"/>
<fileset dir="${dsrc_shared}/customization" includes="asset_customization_manager.mif"/>
<fileset dir="${data_shared}/customization" includes="asset_customization_manager.iff,customization_id_manager.iff"/>
</delete>
</target>
<target name="copy_files">
<echo>Step 1: Copy customization data files from repo.</echo>
<copy todir="${build}">
<fileset dir="${dsrc_shared}/customization">
<include name="*.tab"/>
<include name="customization_id_manager.mif"/>
</fileset>
<fileset dir="${dsrc_shared}/datatables/mount">
<include name="logical_saddle_name_map.tab"/>
<include name="saddle_appearance_map.tab"/>
</fileset>
</copy>
</target>
<target name="create_lookup_table">
<echo>Step 2: Scanning serverdata and creating the Tree File Lookup Table.</echo>
<fileset id="shared" dir="${serverdata}">
<include name="**/*"/>
<exclude name="*.md"/>
</fileset>
<pathconvert pathsep=":0${line.separator}" property="assets" refid="shared">
<map from="${serverdata}/" to="e "/>
</pathconvert>
<concat destfile="${treexlat}"><header filtering="no" trim="yes">p ${serverdata}/:0</header>${line.separator}${assets}:0${line.separator}</concat>
</target>
<target name="collect_info">
<echo>Step 3a: Collecting information on customizable assets from our serverdata.</echo>
<exec executable="perl" dir="${perl_tools}" output="${custinfo}">
<env key="PERL5LIB" value="${env.PERL5LIB}:${swgperllib}"/>
<arg value="collectAssetCustomizationInfo.pl"/>
<arg value="-t"/>
<arg value="${treexlat}"/>
</exec>
<echo>Step 3b: Adding manual variable usage.</echo>
<concat destfile="${custinfo}" append="true">
<path path="${dsrc_shared}/customization/force_add_variable_usage.dat" />
<filterchain>
<striplinecomments>
<comment value="#"/>
</striplinecomments>
</filterchain>
</concat>
</target>
<target name="optimize_info">
<echo>Step 4a: Creating an optimized customizations info file.</echo>
<exec executable="perl" dir="${perl_tools}">
<env key="PERL5LIB" value="${env.PERL5LIB}:${swgperllib}"/>
<arg value="buildAssetCustomizationManagerData.pl"/>
<arg value="-a"/>
<arg value="${artlog}"/>
<arg value="-i"/>
<arg value="${custinfo}"/>
<arg value="-r"/>
<arg value="-t"/>
<arg value="${treexlat}"/>
</exec>
<echo>Step 4b: Sorting and removing duplicate entries from the optimized file.</echo>
<copy file="${custopt}" tofile="${custopt}.sort">
<filterchain>
<sortfilter />
<uniqfilter />
</filterchain>
</copy>
<move file="${custopt}.sort" tofile="${custopt}"/>
</target>
<target name="build_acm_data">
<echo>Step 5: Building the ACM MIF data file</echo>
<exec executable="perl" dir="${perl_tools}">
<env key="PERL5LIB" value="${env.PERL5LIB}:${swgperllib}"/>
<arg value="buildAssetCustomizationManagerData.pl"/>
<arg value="-i"/>
<arg value="${custopt}"/>
<arg value="-o"/>
<arg value="${acmmif}"/>
<arg value="-m"/>
<arg value="${cimmif}"/>
<arg value="-t"/>
<arg value="${treexlat}"/>
</exec>
</target>
<target name="miff_acm">
<echo>Step 6: Building the ACM IFF</echo>
<exec executable="./Miff" dir="${tools_home}">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<arg value="-i"/>
<arg value=""${acmmif}""/>
<arg value="-o"/>
<arg value=""${acmiff}""/>
</exec>
</target>
<target name="miff_cim">
<echo>Step 6a: Building the CIM IFF (final step)</echo>
<exec executable="./Miff" dir="${tools_home}">
<env key="PATH" value="${env.PATH}:${tools_home}"/>
<arg value="-i"/>
<arg value=""${cimmif}""/>
<arg value="-o"/>
<arg value=""${cimiff}""/>
</exec>
</target>
<target name="copy_acm" description="Copies the completed file to our serverdata folder as well so serverdata stays up to date.">
<copy file="${acmiff}" tofile="${serverdata}/customization/asset_customization_manager.iff"/>
<copy file="${cimiff}" tofile="${serverdata}/customization/customization_id_manager.iff"/>
</target>
<target name="build_acm" depends="cleanup_acm,copy_files,create_lookup_table,collect_info,optimize_info,build_acm_data,miff_acm,miff_cim,copy_acm">
</target>
<!-- Performs a hard reset on the src and dsrc repo to remove local changes potentially blocking update_swg from working -->
<target name="reset_repos">
<input message="This will remove any pending or stached changes to any files in the src or dsrc. Are you sure you want to proceed? Type YES and hit enter if you do." addproperty="do.reset"/>
<condition property="do.remove">
<equals arg1="YES" arg2="${do.reset}"/>
</condition>
<fail unless="do.remove">Git Reset Aborted!</fail>
<exec executable="git" dir="${src}">
<arg line="reset --hard" />
</exec>
<echo>Reset of src repository was successful.</echo>
<exec executable="git" dir="${dsrc}">
<arg line="reset --hard" />
</exec>
<echo>Reset of dsrc repository was successful.</echo>
</target>
<!-- End ACM Related targets -->
</project>