-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
130 lines (115 loc) · 4.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
<project name="jreql" default="dist" basedir=".">
<description>
A RethinkDB Java driver
</description>
<property file="local.properties" />
<!-- set global properties for this build -->
<property name="proto.exec" value="/usr/local/bin/protoc" />
<property name="src" location="src"/>
<property name="src.main" location="${src}/main"/>
<property name="lib" location="lib" />
<property name="build" location="${basedir}/build"/>
<property name="build.classes" location="${build}/classes"/>
<property name="build.tests" location="${build}/tests" />
<property name="build.proto" location="${build}/proto"/>
<property name="build.gen" location="${build}/generated" />
<property name="dist" location="dist"/>
<path id="compile.cp">
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="maven" description="Execute maven build">
<exec executable="mvn">
<arg value="clean" />
<arg value="install" />
</exec>
</target>
<target name="init" description="folder setup">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${build.classes}" />
<mkdir dir="${build.tests}" />
</target>
<!-- protobuf -->
<target name="-proto:init" depends="init">
<mkdir dir="${build.proto}" />
<mkdir dir="${build.gen}" />
</target>
<target name="proto:get" depends="-proto:init">
<get src="https://raw.github.com/rethinkdb/rethinkdb/next/src/rdb_protocol/ql2.proto"
dest="${build.proto}/ql2.proto.new" />
<!--<echo message="Proto diff: ${newprotofile}" />-->
<condition property="new.protofile">
<not>
<filesmatch file1="${build.proto}/ql2.proto"
file2="${build.proto}/ql2.proto.new"
/>
</not>
</condition>
</target>
<target name="-proto:merge" depends="proto:get" if="new.protofile">
<tstamp>
<format property="diff.time"
pattern="MM/dd/yyyy hh:mmaa" />
</tstamp>
<echo message="${line.separator}${line.separator}Diff: ${diff.time}${line.separator}${line.separator}"
file="${build.proto}/ql2.diff.txt"
append="true" />
<exec executable="/usr/bin/diff"
failonerror="false"
output="${build.proto}/ql2.diff.txt"
append="true">
<arg value="${build.proto}/ql2.proto" />
<arg value="${build.proto}/ql2.proto.new" />
</exec>
<echo message="New ql2.proto file available. Diff written to: ${build.proto}/ql2.diff.txt" />
<move file="${build.proto}/ql2.proto.new" tofile="${build.proto}/ql2.proto" />
<concat dest="${build.proto}/ql2_java.proto">
<header filtering="no" trimleading="yes">
option java_package = "com.mypopescu.jreql";
option java_outer_classname = "ReqlProto";
</header>
<path path="${build.proto}/ql2.proto" />
</concat>
</target>
<target name="-proto:clean" unless="new.protofile">
<delete file="${build.proto}/ql2.proto.new" />
</target>
<target name="proto" depends="-proto:merge,-proto:clean" description="generates protobufs source files">
<exec executable="${proto.exec}">
<arg value="--version" />
</exec>
<exec executable="${proto.exec}">
<arg value="--java_out=${build.gen}" />
<arg value="--proto_path=${build.proto}" />
<arg value="${build.proto}/ql2_java.proto" />
</exec>
</target>
<target name="compile" depends="init"
description="compile the source">
<javac destdir="${build.classes}"
classpathref="compile.cp"
debug="on"
source="1.6"
target="1.6"
includeantruntime="false">
<src path="${src.main}" />
<src path="${build.gen}" />
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/jreql-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<delete dir="${build.classes}"/>
<delete dir="${build.tests}" />
</target>
</project>