File build.xml added (mode: 100644) (index 0000000..02c67ca) |
|
1 |
|
<project name="sorcererw3n" default="package"> |
|
2 |
|
<!-- Check Ant version --> |
|
3 |
|
<antversion atleast="1.10.9" property="project.antversion.atleast"/> |
|
4 |
|
<fail unless="project.antversion.atleast"/> |
|
5 |
|
<!-- Mandatory properties --> |
|
6 |
|
<loadproperties encoding="UTF-8"> |
|
7 |
|
<file file="build.properties"/> |
|
8 |
|
</loadproperties> |
|
9 |
|
<!-- Optional override properties, user and build environment specific --> |
|
10 |
|
<property file="local.properties"/> |
|
11 |
|
<fileset id="project.base.fileset.jass" dir="src/base"> |
|
12 |
|
<include name="**/*.j"/> |
|
13 |
|
<exclude name="**/*.m4"/> |
|
14 |
|
</fileset> |
|
15 |
|
<fileset id="project.spellbook.fileset.jass" dir="src/spellbook"> |
|
16 |
|
<include name="**/*.j"/> |
|
17 |
|
<exclude name="**/*.m4"/> |
|
18 |
|
</fileset> |
|
19 |
|
<fileset id="project.sorcerer.fileset.jass" dir="src/sorcerer"> |
|
20 |
|
<include name="**/*.j"/> |
|
21 |
|
<exclude name="**/*.m4"/> |
|
22 |
|
</fileset> |
|
23 |
|
<fileset id="project.map1.fileset.jass" dir="src/map1"> |
|
24 |
|
<include name="**/*.j"/> |
|
25 |
|
<exclude name="**/*.m4"/> |
|
26 |
|
</fileset> |
|
27 |
|
<path id="project.map1.path.jass"> |
|
28 |
|
<fileset refid="project.base.fileset.jass" /> |
|
29 |
|
<fileset refid="project.spellbook.fileset.jass" /> |
|
30 |
|
<fileset refid="project.sorcerer.fileset.jass" /> |
|
31 |
|
<fileset refid="project.map1.fileset.jass" /> |
|
32 |
|
</path> |
|
33 |
|
<target name="pjass"> |
|
34 |
|
<exec executable="${project.executable.pjass}" failonerror="true" failifexecutionfails="true"> |
|
35 |
|
<!-- load native declarations --> |
|
36 |
|
<arg file="${project.scriptsdir}/common.j"/> |
|
37 |
|
<arg file="${project.scriptsdir}/Blizzard.j"/> |
|
38 |
|
<arg file="${project.scriptsdir}/common.ai"/> |
|
39 |
|
<!-- reliance on Return bug is forbidden --> |
|
40 |
|
<arg value="-rb"/> |
|
41 |
|
<!-- enable all available code static analysis --> |
|
42 |
|
<arg value="+filter"/> |
|
43 |
|
<arg value="+shadow"/> |
|
44 |
|
<arg value="+checkglobalsinit"/> |
|
45 |
|
<arg value="+checkstringhash"/> |
|
46 |
|
<arg line="${project.target.pjass.line}"/> |
|
47 |
|
</exec> |
|
48 |
|
</target> |
|
49 |
|
<target name="validate" description="check if the build environment is ready for work"> |
|
50 |
|
<echo>validate:m4</echo> |
|
51 |
|
<exec executable="${project.executable.m4}" failonerror="true" failifexecutionfails="true"> |
|
52 |
|
<arg value="--version"/> |
|
53 |
|
</exec> |
|
54 |
|
<echo>validate:smpq</echo> |
|
55 |
|
<exec executable="${project.executable.smpq}" failonerror="true" failifexecutionfails="true"> |
|
56 |
|
<arg value="--version"/> |
|
57 |
|
</exec> |
|
58 |
|
<echo>validate:pjass</echo> |
|
59 |
|
<antcall target="pjass"> |
|
60 |
|
<param name="project.target.pjass.line" value=""/> |
|
61 |
|
</antcall> |
|
62 |
|
</target> |
|
63 |
|
<target name="process-sources" description="parse all Jass source snippets with pjass"> |
|
64 |
|
<!-- Load a colon separated strip of Jass snippet file names, |
|
65 |
|
then replace the colon with empty space, |
|
66 |
|
and pass it as a command line argument to pjass. --> |
|
67 |
|
<pathconvert refid="project.map1.path.jass" pathsep=" " property="project.map1.path.jass.line"/> |
|
68 |
|
<antcall target="pjass"> |
|
69 |
|
<param name="project.target.pjass.line" value="${project.map1.path.jass.line}"/> |
|
70 |
|
</antcall> |
|
71 |
|
</target> |
|
72 |
|
<target name="generate-sources" description="generate final war3map.j scripts for all maps with m4"> |
|
73 |
|
<!-- TODO Use MacroDef or subproject builds to adapt tasks for all individual maps. --> |
|
74 |
|
<mkdir dir="${project.builddir}/map1"/> |
|
75 |
|
<exec executable="${project.executable.m4}" output="${project.builddir}/map1/war3map.j" failonerror="true" failifexecutionfails="true"> |
|
76 |
|
<arg value="--debug=aeqp"/> |
|
77 |
|
<arg value="-I ${basedir}"/> |
|
78 |
|
<arg value="src/map1/map1.m4"/> |
|
79 |
|
</exec> |
|
80 |
|
</target> |
|
81 |
|
<target name="compile" depends="process-sources,generate-sources" description="parse Jass scripts that will be packaged with pjass"> |
|
82 |
|
<antcall target="pjass"> |
|
83 |
|
<param name="project.target.pjass.line" value="${project.builddir}/map1/war3map.j"/> |
|
84 |
|
</antcall> |
|
85 |
|
</target> |
|
86 |
|
<target name="process-resources"> |
|
87 |
|
</target> |
|
88 |
|
<target name="prepare-package" depends="compile,process-resources" description="copy and arrange files before packaging"> |
|
89 |
|
<!-- TODO Files *.w3a, *.w3u or *.wts require localization --> |
|
90 |
|
<mkdir dir="${project.builddir}/map1"/> |
|
91 |
|
<copy file="src/sorcerer/war3campaign.w3a" overwrite="true" todir="${project.builddir}"/> |
|
92 |
|
<copy file="src/sorcerer/war3campaign.w3u" overwrite="true" todir="${project.builddir}"/> |
|
93 |
|
<copy file="src/sorcerer/war3campaign.wts" overwrite="true" todir="${project.builddir}"/> |
|
94 |
|
<!-- FIXME It might not be needed to duplicate metadata in both campaign and map. --> |
|
95 |
|
<copy file="src/sorcerer/war3campaign.w3a" overwrite="true" tofile="${project.builddir}/map1/war3map.w3a"/> |
|
96 |
|
<copy file="src/sorcerer/war3campaign.w3u" overwrite="true" tofile="${project.builddir}/map1/war3map.w3u"/> |
|
97 |
|
<copy file="src/sorcerer/sorcererstub.w3n" overwrite="true" tofile="${project.builddir}/sorcerer-${project.version}-1.27-en.w3n"/> |
|
98 |
|
<copy file="src/map1/war3map.wts" overwrite="true" todir="${project.builddir}/map1"/> |
|
99 |
|
<copy file="src/map1/map1.w3x" overwrite="true" todir="${project.builddir}"/> |
|
100 |
|
</target> |
|
101 |
|
<target name="package" depends="prepare-package" description="produce valid custom campaign MPQ archive (w3n) with smpq"> |
|
102 |
|
<!-- NOTE The path to subject MPQ archive MUST be absolute. --> |
|
103 |
|
<!-- NOTE The paths to files that are added to the subject MPQ archive MUST be relative. --> |
|
104 |
|
<exec executable="${project.executable.smpq}" dir="${project.builddir}/map1" failonerror="true" failifexecutionfails="true"> |
|
105 |
|
<arg value="--add"/> |
|
106 |
|
<arg value="--overwrite"/> |
|
107 |
|
<arg value="--compression"/> |
|
108 |
|
<arg value="zlib"/> |
|
109 |
|
<arg file="${project.builddir}/map1.w3x"/> |
|
110 |
|
<arg value="war3map.w3a"/> |
|
111 |
|
<arg value="war3map.w3u"/> |
|
112 |
|
<arg value="war3map.wts"/> |
|
113 |
|
<arg value="war3map.j"/> |
|
114 |
|
</exec> |
|
115 |
|
<exec executable="${project.executable.smpq}" dir="${project.builddir}" failonerror="true" failifexecutionfails="true"> |
|
116 |
|
<arg value="--add"/> |
|
117 |
|
<arg value="--overwrite"/> |
|
118 |
|
<arg value="--compression"/> |
|
119 |
|
<arg value="zlib"/> |
|
120 |
|
<arg file="${project.builddir}/sorcerer-${project.version}-1.27-en.w3n"/> |
|
121 |
|
<arg value="war3campaign.w3a"/> |
|
122 |
|
<arg value="war3campaign.w3u"/> |
|
123 |
|
<arg value="war3campaign.wts"/> |
|
124 |
|
</exec> |
|
125 |
|
<exec executable="${project.executable.smpq}" dir="${project.builddir}" failonerror="true" failifexecutionfails="true"> |
|
126 |
|
<arg value="--add"/> |
|
127 |
|
<arg value="--overwrite"/> |
|
128 |
|
<arg value="--single-unit"/> |
|
129 |
|
<arg value="--compression"/> |
|
130 |
|
<arg value="none"/> |
|
131 |
|
<arg file="${project.builddir}/sorcerer-${project.version}-1.27-en.w3n"/> |
|
132 |
|
<arg value="map1.w3x"/> |
|
133 |
|
</exec> |
|
134 |
|
</target> |
|
135 |
|
<target name="verify" description="print final custom campaign MPQ archive information"> |
|
136 |
|
<exec executable="${project.executable.smpq}" dir="${project.builddir}" failonerror="true" failifexecutionfails="true"> |
|
137 |
|
<arg value="--info"/> |
|
138 |
|
<arg file="${project.builddir}/sorcerer-${project.version}-1.27-en.w3n"/> |
|
139 |
|
</exec> |
|
140 |
|
<exec executable="${project.executable.smpq}" dir="${project.builddir}" failonerror="true" failifexecutionfails="true"> |
|
141 |
|
<arg value="--list"/> |
|
142 |
|
<arg file="${project.builddir}/sorcerer-${project.version}-1.27-en.w3n"/> |
|
143 |
|
</exec> |
|
144 |
|
<exec executable="${project.executable.smpq}" dir="${project.builddir}" failonerror="true" failifexecutionfails="true"> |
|
145 |
|
<arg value="--info"/> |
|
146 |
|
<arg file="${project.builddir}/map1.w3x"/> |
|
147 |
|
</exec> |
|
148 |
|
<exec executable="${project.executable.smpq}" dir="${project.builddir}" failonerror="true" failifexecutionfails="true"> |
|
149 |
|
<arg value="--list"/> |
|
150 |
|
<arg file="${project.builddir}/map1.w3x"/> |
|
151 |
|
</exec> |
|
152 |
|
</target> |
|
153 |
|
</project> |