-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_kort.xml
150 lines (133 loc) · 4.49 KB
/
build_kort.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
<project name="kort-build" basedir="." default="build">
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib/antlibs/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<property environment="env"/>
<property name="uml.dir" value="_DOCUMENTATION/03_Model" />
<property name="php.dir" value="server" />
<property name="php.test.dir" value="server/php" />
<property name="php.doc.dir" value="docs/Kort-backend" />
<property name="js.dir" value="app" />
<property name="js.doc.dir" value="docs/Kort"/>
<property name="js.leaflet.dir" value="ux" />
<property name="js.leaflet.doc.dir" value="docs/Ext.ux.LeafletMap"/>
<property name="js.config" value="app/util/Config.js" />
<property name="js.config.prod" value="build/Kort/production/app.js" />
<property name="test.dir" value="test" />
<target name="build" depends="css,version,lint,docs,test">
<echo message="BUILD FINISHED!"/>
</target>
<target name="test">
<antcall target="js-test"/>
<antcall target="php-test"/>
</target>
<target name="lint">
<antcall target="js-lint"/>
<antcall target="php-lint"/>
</target>
<target name="docs">
<antcall target="js-docs"/>
<antcall target="php-docs"/>
</target>
<target name="php-test">
<echo message="Running tests"/>
<foreach target="exec_test_php" param="filename">
<path>
<fileset dir="${php.test.dir}" includes="**/Test*.php"/>
</path>
</foreach>
</target>
<target name="js-test">
<echo message="Running tests"/>
<exec executable="grunt" failonerror="true">
<arg value="qunit"/>
<arg value="--verbose"/>
<arg value="--force"/>
</exec>
</target>
<target name="js-lint">
<echo message="Linting JavaScript files"/>
<exec executable="grunt">
<arg value="lint"/>
<arg value="--verbose"/>
<arg value="--force"/>
</exec>
</target>
<target name="php-lint">
<echo message="Linting PHP files"/>
<exec executable="bin/phpcs">
<arg value="--standard=code_standard.xml"/>
<arg value="--report-width=60"/>
<arg value="${php.dir}"/>
</exec>
</target>
<target name="js-docs">
<echo message="Generating JavaScript docs (JSDuck)"/>
<mkdir dir="${js.doc.dir}"/>
<exec executable="jsduck">
<arg value="${js.dir}"/>
<arg value="--output"/>
<arg value="${js.doc.dir}"/>
<arg value="--config"/>
<arg value="jsduck/jsduck_kort_config.json" />
</exec>
<exec executable="jsduck">
<arg value="${js.leaflet.dir}"/>
<arg value="--output"/>
<arg value="${js.leaflet.doc.dir}"/>
<arg value="--config"/>
<arg value="jsduck/jsduck_leaflet_config.json" />
</exec>
</target>
<target name="php-docs">
<echo message="Generating PHP docs (phpDocumentor)"/>
<mkdir dir="${php.doc.dir}"/>
<exec executable="phpdoc">
<arg value="-d"/>
<arg value="${php.dir}"/>
<arg value="-t"/>
<arg value="${php.doc.dir}"/>
</exec>
</target>
<target name="css">
<echo message="Compile sass files to css"/>
<foreach target="compile_sass" param="dir">
<path>
<dirset dir="${basedir}">
<include name="**/styles"/>
</dirset>
</path>
</foreach>
</target>
<target name="version">
<replace file="${js.config}"
summary="true"
token='{BUILD_NR}'
value='${env.TRAVIS_BUILD_NUMBER}' />
<replace file="${js.config.prod}"
summary="true"
token='{BUILD_NR}'
value='${env.TRAVIS_BUILD_NUMBER}' />
</target>
<target name="compile_sass">
<echo message="Compile sass files in ${dir}"/>
<apply executable="sass" dest="${dir}" verbose="true" force="true" failonerror="true">
<arg value="--unix-newlines" />
<srcfile />
<targetfile />
<fileset dir="${dir}" includes="**/*.scss" />
<mapper type="glob" from="*.scss" to="*.css"/>
</apply>
</target>
<target name="exec_test_php">
<basename file="${filename}" property="basename"/>
<echo message="Run ${basename}"/>
<exec executable="php" dir="${php.dir}" logError="true" failonerror="true">
<arg value="-f"/>
<arg value="${basedir}/${test.dir}/index.php"/>
<arg value="${filename}" />
</exec>
</target>
</project>