-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
148 lines (124 loc) · 6.27 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
<project name="Rangy" default="build" basedir="">
<property file="${basedir}/build.properties"/>
<tstamp>
<format property="TODAY" pattern="d MMMM yyyy" locale="en,UK"/>
<format property="YEAR" pattern="yyyy" locale="en,UK"/>
</tstamp>
<target name="init">
<delete dir="${svn.checkout.dir}"/>
<delete dir="${working.dir}"/>
<delete dir="${output.dir}"/>
<delete includeemptydirs="true">
<fileset dir="${build.dir}" includes="**/*"/>
</delete>
<mkdir dir="${build.dir}"/>
<mkdir dir="${svn.checkout.dir}"/>
</target>
<!--
Note: this task requires SvnAnt to be installed on your machine, and the
jar files in SvanAnt's lib dir being copied to Ant's lib directory.
See http://subclipse.tigris.org/svnant.html
-->
<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask"/>
<target name="svncheckout" depends="init" description="Checks out code from Subversion">
<svn>
<checkout url="${svn.url}" destPath="${svn.checkout.dir}" />
<wcVersion path="${svn.checkout.dir}" prefix="svncheckout." />
</svn>
<property name="build.version" value="${version.base}"/>
<property name="build.svn.version" value="${svncheckout.revision.max}"/>
<echo message="Set build version to ${build.version}" />
</target>
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask"
classpath="${googlecompressor.jar.path}"/>
<target name="build.js.file">
<!-- Params: js.file, uncompressed.dir, compressed.dir-->
<!-- Replace version number -->
<replace file="${uncompressed.dir}/${js.file}" token="%%build:version%%" value="${build.version}"/>
<!-- Replace build date -->
<replace file="${uncompressed.dir}/${js.file}" token="%%build:date%%" value="${TODAY}"/>
<replace file="${uncompressed.dir}/${js.file}" token="%%build:year%%" value="${YEAR}"/>
<!-- Remove all logging calls -->
<replaceregexp file="${uncompressed.dir}/${js.file}" byline="true" match="^\s*log\.(trace|debug|info|warn|error|fatal|time|timeEnd|group|groupEnd).*$" replace=""/>
<replaceregexp file="${uncompressed.dir}/${js.file}" byline="true" match="^\s*var\s+log\s*=.*$" replace=""/>
<!-- Compress -->
<jscomp compilationLevel="${googlecompressor.level}" debug="false" output="${compressed.dir}/${js.file}">
<sources dir="${uncompressed.dir}">
<file name="${js.file}"/>
</sources>
</jscomp>
</target>
<target name="build.core.js" depends="svncheckout">
<filelist id="files.js" dir="${svn.checkout.js.core.dir}">
<file name="core.js" />
<file name="dom.js" />
<file name="domrange.js" />
<file name="wrappedrange.js" />
<file name="wrappedselection.js" />
</filelist>
<concat destfile="${build.uncompressed.js.dir}/${build.core.js.file}" >
<filelist refid="files.js"/>
</concat>
<antcall target="build.js.file" inheritall="true">
<param name="js.file" value="${build.core.js.file}"/>
<param name="uncompressed.dir" value="${build.uncompressed.js.dir}"/>
<param name="compressed.dir" value="${build.compressed.js.dir}"/>
</antcall>
</target>
<target name="build.module.js">
<!-- Params: module.js.file -->
<copy file="${svn.checkout.js.modules.dir}/${module.js.file}" todir="${build.uncompressed.js.dir}"/>
<antcall target="build.js.file" inheritall="true">
<param name="js.file" value="${module.js.file}"/>
<param name="uncompressed.dir" value="${build.uncompressed.js.dir}"/>
<param name="compressed.dir" value="${build.compressed.js.dir}"/>
</antcall>
</target>
<target name="build.noncore.module.js">
<!-- Params: module.js.file -->
<copy file="${svn.checkout.js.modules.dir}/${module.js.file}" todir="${build.dir}"/>
<antcall target="build.js.file" inheritall="true">
<param name="js.file" value="${module.js.file}"/>
<param name="uncompressed.dir" value="${build.dir}"/>
<param name="compressed.dir" value="${build.dir}"/>
</antcall>
</target>
<target name="build.modules">
<antcall target="build.module.js" inheritall="true">
<param name="module.js.file" value="rangy-cssclassapplier.js"/>
</antcall>
<antcall target="build.module.js" inheritall="true">
<param name="module.js.file" value="rangy-selectionsaverestore.js"/>
</antcall>
<antcall target="build.module.js" inheritall="true">
<param name="module.js.file" value="rangy-serializer.js"/>
</antcall>
<!--
<antcall target="build.module.js" inheritall="true">
<param name="module.js.file" value="textinputs_jquery.js"/>
</antcall>
<antcall target="build.module.js" inheritall="true">
<param name="module.js.file" value="textinputs_standalone.js"/>
</antcall>
-->
</target>
<!-- Creates zip version of the distribution -->
<target name="build.zip">
<zip destfile="${build.dir}/rangy-${build.version}.zip">
<zipfileset dir="${build.rangy.dir}" prefix="rangy-${build.version}/"/>
</zip>
</target>
<!-- Creates tarball version of the distribution -->
<target name="build.tar.gz">
<tar tarfile="${build.dir}/rangy-${build.version}.tar">
<tarfileset dir="${build.rangy.dir}" prefix="rangy-${build.version}/"/>
</tar>
<gzip zipfile="${build.dir}/rangy-${build.version}.tar.gz" src="${build.dir}/rangy-${build.version}.tar"/>
<delete file="${build.dir}/rangy-${build.version}.tar"/>
</target>
<target name="build" description="Full build" depends="build.core.js, build.modules, build.zip, build.tar.gz">
<antcall target="build.noncore.module.js" inheritall="true">
<param name="module.js.file" value="rangy-position.js"/>
</antcall>
</target>
</project>