forked from eXist-db/eXide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
173 lines (173 loc) · 7.68 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
<project basedir="." default="all" name="eXide">
<property file="local.build.properties"/>
<property file="build.properties"/>
<property name="src" value="./src"/>
<property name="tools" value="./tools"/>
<property name="build" value="./build"/>
<property name="scripts" value="./resources/scripts"/>
<property name="top.dir" value="../.."/>
<property name="templates.dir" value="./templates"/>
<property name="templates.default.dir" value="${templates.dir}/default"/>
<property name="xqlint.dir" value="./support/xqlint"/>
<property name="closure.compiler.url" value="http://closure-compiler.googlecode.com/files/compiler-latest.zip"/>
<property name="rhino.url" value="https://raw.github.com/jrburke/r.js/master/lib/rhino/js.jar"/>
<property name="rhino.jar" value="tools/js.jar"/>
<property name="r.js.url" value="http://requirejs.org/docs/release/2.1.4/r.js"/>
<property name="server.url" value="http://demo.exist-db.org/exist/apps/public-repo/public/"/>
<condition property="rhino.optimize.interpret" value="-opt -1" else="">
<isset property="32bit"/>
</condition>
<condition property="git.commit" value="${git.commit}" else="">
<isset property="git.commit"/>
</condition>
<target name="check-closure-available">
<available property="closure.available" file="${tools}/compiler.jar"/>
</target>
<target name="get-closure" depends="check-closure-available" unless="${closure.available}">
<echo message="Downloading closure..."/>
<mkdir dir="${tools}"/>
<get src="${closure.compiler.url}" dest="${tools}"/>
<unzip dest="${tools}">
<fileset dir="${tools}">
<include name="*.zip"/>
</fileset>
</unzip>
<delete file="${tools}/compiler-latest.zip"/>
</target>
<target name="check-rhino-available">
<available property="rhino.available" file="${tools}/js.jar"/>
</target>
<target name="get-rhino" depends="check-rhino-available" unless="${rhino.available}">
<echo message="Downloading rhino..."/>
<mkdir dir="${tools}"/>
<get src="${rhino.url}" dest="${tools}"/>
<get src="${r.js.url}" dest="${tools}"/>
</target>
<target name="prepare" depends="get-closure,get-rhino">
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="${tools}/compiler.jar"/>
</target>
<target name="all" depends="xqlint,compress,xar"/>
<target name="rebuild" depends="clean,all"/>
<target name="compress" depends="prepare">
<echo message="Optimizing eXide sources"/>
<jscomp compilationLevel="simple" debug="false" output="${scripts}/eXide.min.js" languageIn="ECMASCRIPT5">
<sources dir="${basedir}/src">
<file name="ace-modes.js"/>
<file name="util.js"/>
<file name="history.js"/>
<file name="popup.js"/>
<file name="events.js"/>
<file name="commands.js"/>
<file name="mode-helper.js"/>
<file name="xquery-helper.js"/>
<file name="xml-helper.js"/>
<file name="less-helper.js"/>
<file name="javascript-helper.js"/>
<file name="css-helper.js"/>
<file name="outline.js"/>
<file name="directory.js"/>
<file name="debuger.js"/>
<file name="codevalidator.js"/>
<file name="editor.js"/>
<file name="deployment.js"/>
<file name="menu.js"/>
<file name="help.js"/>
<file name="preferences.js"/>
<file name="eXide.js"/>
<file name="templates.js"/>
<file name="resources.js"/>
<file name="find.js"/>
<file name="visitor.js"/>
<file name="xquery-utils.js"/>
<file name="quickfix.js"/>
<file name="snippets.js"/>
<file name="snippet-helper.js"/>
<file name="layout.js"/>
<file name="dnd.js"/>
</sources>
</jscomp>
<jscomp compilationLevel="simple" debug="false" output="${scripts}/jquery/jquery.plugins.min.js">
<sources dir="${scripts}/jquery">
<file name="jquery.event.drag-2.2.js"/>
<!--file name="jquery.layout-1.3.0.rc30.79.js"/-->
<file name="jquery.fileupload.js"/>
<file name="jquery.fileupload-ui.js"/>
<file name="jquery.fileupload-process.js"/>
<file name="slick.core.js"/>
<file name="slick.rowselectionmodel.js"/>
<file name="slick.grid.js"/>
<file name="slick.editors.js"/>
<file name="slick.formatters.js"/>
<file name="slick.cellselectionmodel.js"/>
<file name="slick.cellrangeselector.js"/>
</sources>
</jscomp>
</target>
<target name="xqlint" depends="get-rhino">
<echo message="Optimizing xqlint ..."/>
<copy file="tools/build.js" tofile="${xqlint.dir}/build.js"/>
<copy file="tools/main/main.js" tofile="${xqlint.dir}/main.js"/>
<java classpath="${rhino.jar}:${tools}/compiler.jar" classname="org.mozilla.javascript.tools.shell.Main" fork="true" failonerror="true">
<arg line="${rhino.optimize.interpret}"/>
<arg line="${xqlint.dir}/r.js"/>
<arg line="-o ${xqlint.dir}/build.js"/>
</java>
</target>
<target name="clean">
<delete>
<fileset dir="${scripts}">
<include name="eXide-*.min.js"/>
</fileset>
</delete>
<delete>
<fileset dir="${tools}">
<include name="js.jar"/>
<include name="r.js"/>
</fileset>
</delete>
<delete failonerror="false">
<fileset dir="${build}">
<include name="*.xar"/>
</fileset>
</delete>
<delete file="${scripts}/jquery/jquery.plugins.min.js"/>
<delete file="${scripts}/xqlint.min.js"/>
<delete file="index.html"/>
<delete file="expath-pkg.xml"/>
</target>
<target name="xar">
<copy file="index.html.tmpl" tofile="index.html" filtering="true" overwrite="true">
<filterset>
<filter token="project.version" value="${project.version}"/>
</filterset>
</copy>
<copy file="expath-pkg.xml.tmpl" tofile="expath-pkg.xml" filtering="true" overwrite="true">
<filterset>
<filter token="project.version" value="${project.version}"/>
</filterset>
</copy>
<mkdir dir="${build}"/>
<zip destfile="${build}/eXide-${project.version}${git.commit}.xar">
<fileset dir=".">
<include name="*.*"/>
<include name="modules/**"/>
<include name="resources/**"/>
<include name="templates/**"/>
<include name="src/**"/>
<include name="docs/**"/>
<exclude name=".git*"/>
<exclude name="*.tmpl"/>
<exclude name="*.properties"/>
</fileset>
</zip>
</target>
<target name="upload">
<property name="xar" value="eXide-${project.version}.xar"/>
<input message="Enter password:" addproperty="server.pass" defaultvalue="">
<handler type="secure"/>
</input>
<exec executable="curl">
<arg line="-T ${build}/${xar} -u admin:${server.pass} ${server.url}/${xar}"/>
</exec>
</target>
</project>