-
Notifications
You must be signed in to change notification settings - Fork 529
/
build.xml
51 lines (48 loc) · 1.82 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
<?xml version="1.0" encoding="utf-8"?>
<project name="chronos">
<target name="install" description="Install dependencies">
<exec executable="npm" dir="${sourceDir}" failonerror="true">
<arg value="install"/>
</exec>
<echo message="install project dependencies" />
</target>
<target name="eslint" description="Check source lint">
<exec executable="npm" dir="${sourceDir}" failonerror="true">
<arg value="run"/>
<arg value="lint"/>
</exec>
</target>
<target name="build" description="Generate assets">
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${sourceDir}/build" includes="**/*"/>
</delete>
<exec executable="npm" dir="${sourceDir}" failonerror="true">
<arg value="run"/>
<arg value="build"/>
</exec>
<echo message="build project with npm" />
<mkdir dir="${sourceDir}/build/assets" />
<copy todir="${sourceDir}/build/assets">
<fileset dir="${sourceDir}/assets" />
</copy>
<copy file="${sourceDir}/index.html" tofile="${sourceDir}/build/index.html"/>
</target>
<target name="assets.uptodate" depends="sourceDir.check" if="sourceDir.nochanges">
<echo>${sourceDir} Hasn't been updated, skipping asset compilation.</echo>
</target>
<target name="sourceDir.check">
<uptodate property="sourceDir.nochanges">
<srcfiles dir="${sourceDir}" includes="**/*.js" />
<srcfiles dir="${sourceDir}" includes="**/*.jsx" />
<srcfiles dir="${sourceDir}" includes="**/*.css" />
<mapper type="merge" to="${sourceDir}/build/assets/js/bundle.js" />
</uptodate>
</target>
<target name="generateAssets" depends="assets.uptodate" unless="sourceDir.nochanges">
<echo message="Building assets" />
<antcall target="install">
</antcall>
<antcall target="build">
</antcall>
</target>
</project>