-
Notifications
You must be signed in to change notification settings - Fork 12
/
build-compile.xml
104 lines (86 loc) · 3.38 KB
/
build-compile.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
<?xml version="1.0" encoding="UTF-8"?>
<project default="clean" basedir="." name="mongodb-compile">
<description>
Build MongoDB Extension - Compile
</description>
<buildnumber file="build.number"/>
<property file="build.properties"/>
<property name="lib" location="source/java/libs"/>
<property name="src" location="source/java/src"/>
<property name="build" location="build"/>
<property name="fld" location="${build}/flds"/>
<property name="temp" location="temp"/>
<property name="dist" location="dist"/>
<scriptdef name="replace" language="javascript">
<attribute name="haystack" />
<attribute name="needle" />
<attribute name="repl" />
<attribute name="property" />
<![CDATA[
var text = attributes.get("haystack");
var needle = attributes.get("needle");
var repl = attributes.get("repl");
text=text.trim();
var regex = new RegExp(needle,'g');
text=text.replace(regex,repl);
project.setProperty(attributes.get("property"), text);
]]>
</scriptdef>
<path id="classpath">
<!-- use the loader project directly <pathelement location="${luceeLoader}" /> -->
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<delete dir="${temp}"/>
<delete dir="${dist}"/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${temp}"/>
<mkdir dir="${temp}/classes"/>
<mkdir dir="${dist}/"/>
<tstamp>
<format property="NOW" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile Java source -->
<javac srcdir="${src}" target="1.8" source="1.8" destdir="${temp}/classes" debug="true" debuglevel="lines,vars,source" includeantruntime="false">
<classpath refid="classpath" />
</javac>
<!-- Put everything in ${build} into .jar file -->
<jar
jarfile="${dist}/extension/jars/mongodb-extension-${bundleversion}${build.number}.jar" basedir="${temp}/classes" manifest="${src}/META-INF/MANIFEST.MF">
<manifest>
<attribute name="Bundle-Version" value="${bundleversion}${build.number}"/>
<attribute name="Built-Date" value="${NOW}"/>
<attribute name="Bundle-SymbolicName" value="${bundlename}"/>
</manifest>
</jar>
</target>
<target name="copyBase" depends="compile"
description="compile the source " >
<!-- copy the fld necessary -->
<loadfile property="content1" srcFile="${fld}/mongodb.fld" />
<replace haystack="${content1}" needle="{bundle-name}" repl="${bundlename}" property="content2"/>
<replace haystack="${content2}" needle="{bundle-version}" repl="${bundleversion}${build.number}" property="content3"/>
<echo message="${content3}" file="${dist}/extension/flds/mongodb.fld"/>
<!-- copy the functions necessary -->
<copy todir="${dist}/extension/functions">
<fileset dir="${build}/functions">
<include name="**/*.*"/>
</fileset>
</copy>
<!-- copy the jars necessary -->
<copy todir="${dist}/extension/jars">
<fileset dir="${lib}">
<include name="**/*.jar"/>
<exclude name="**/javax.servlet.jar"/>
<exclude name="**/lucee.jar"/>
</fileset>
</copy>
</target>
</project>