-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
158 lines (138 loc) · 7.08 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
<project name="MongoJdbc" default="Compile" >
<property file="build.properties"/>
<path id="driver.classpath">
<fileset id="lib" dir="driver/src/main/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<pathconvert property="driver.classpath.jar" refid="driver.classpath" pathsep=" ">
<map from="C:\work\mongodb-jdbc-driver\driver\src\main\lib\" to="./"/>
</pathconvert>
<target name="Compile" description="compile">
<!-- THE STARTDARD ANT TASK buildnumber DOES READ, THAN INCREMENT AND SAVE. THIS MAKE PROBLEMS WITH UPDATES -->
<propertyfile file="buildnum.properties">
<entry key="buildnum" type="int" default="0" operation="+" pattern="00"/>
</propertyfile>
<property file="buildnum.properties"/>
<echo message="------------------ Compile #${buildnum} -----------------"/>
<mkdir dir="target/classes"/>
<javac destdir="target/classes" debug="true" debuglevel="lines,source" deprecation="on" source="1.8" target="1.8">
<classpath refid="driver.classpath" />
<src path="driver/src/main/java"/>
</javac>
<jar destfile="target/dist/mongojdbc${driver.version}.jar">
<fileset dir="target/classes" />
<fileset dir="driver/src/main/resources/jar"/>
<manifest>
<attribute name="Main-Class" value="com.dbschema.MongoJdbcDriver"/>
<!--<attribute name="Class-Path" value="${driver.classpath.jar}"/>-->
<attribute name="Specification-Version" value="${driver.version}"/>
<attribute name="Specification-Vendor" value="Wise Coders Technologies"/>
<attribute name="Implementation-Vendor-Id" value="dbschema.com"/>
<attribute name="Implementation-Vendor" value="Wise Coders Technologies"/>
<attribute name="Implementation-Version" value="${buildnum}"/>
</manifest>
</jar>
</target>
<target name="DeployLocal" depends="Compile">
<delete>
<fileset dir="/work/dbs/dbs-app/src/main/pack/drivers/MongoDb">
<include name="*.jar"/>
</fileset>
</delete>
<copy todir="/work/dbs/dbs-app/src/main/pack/drivers/MongoDb">
<fileset file="target/dist/mongojdbc${driver.version}.jar"/>
<fileset file="driver/src/main/lib/mongo-java-driver-3.4.2.jar"/>
</copy>
</target>
<target name="DeployWebSite" depends="Compile">
<delete file="target/dist/MongoDbJdbcDriver.zip"/>
<zip destfile="target/dist/MongoDbJdbcDriver.zip">
<zipfileset file="target/dist/mongojdbc${driver.version}.jar" />
<zipfileset file="driver/src/main/lib/mongo-java-driver-3.4.2.jar" />
</zip>
<scp todir="${dbs.deploy.url}" trust="true" sftp="true">
<!-- 'PASSIVE' FLAG HELPS TO GO EASIER THROUGH WINDOWS FIREWALL -->
<fileset file="target/dist/MongoDbJdbcDriver.zip"/>
</scp>
</target>
<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" >
<classpath id="izp">
<fileset id="antlib" dir="./antlib">
<include name="**/*.jar"/>
</fileset>
<fileset id="lib" dir="driver/src/main/lib">
<include name="**/*.jar"/>
</fileset>
<fileset file="target/dist/mongojdbc${driver.version}.jar"/>
</classpath>
</taskdef>
<target name="Extract Completion Keywords2">
<groovy><![CDATA[
def listMethodNames = { clz ->
def result = []
clz.metaClass.methods.each { method ->
if ( method.isPublic() && ( !'equals'.equals(method.name) && !'notify'.equals(method.name) && !'notifyAll'.equals(method.name) && !'wait'.equals(method.name) && !'hashCode'.equals(method.name) )){
StringBuilder sbParams = new StringBuilder()
for( Class paramType : method.nativeParameterTypes ){
if ( sbParams.length() > 0 ) sbParams.append(", ")
if ( 'Map'.equals(paramType.getSimpleName()) || 'Bson'.equals(paramType.getSimpleName())){
sbParams.append("{ }")
} else {
sbParams.append(paramType.getSimpleName())
}
}
result.add( "${clz.getSimpleName()}|${method.name}(${sbParams})|${method.returnType.getSimpleName()}\\n\\" )
//println "${clz.getSimpleName()}|${method.name}(${method.nativeParameterTypes*.getSimpleName().join( ', ' )})|${method.returnType.getSimpleName()}\\n\\"
}
}
for ( String str : result.unique() ){
println str
}
}
listMethodNames( com.dbschema.mongo.JMongoDatabase.class )
listMethodNames( com.dbschema.mongo.JMongoCollection.class )
listMethodNames( com.dbschema.mongo.JFindIterable.class )
]]></groovy>
</target>
</project>
<!--
<target name="OldExtract">
<groovy><![CDATA[
import java.io.*
import java.util.*
import java.util.regex.*
def extractCompletionList = { file ->
className = file.getName()
className = className.substring( 0, className.length() - ( className.endsWith('.java') ? '.java'.length() : 0 ))
TreeMap patterns = new TreeMap()
if ( file.exists() ){
String content = file.getText('UTF-8')
file.withReader { reader ->
while ((line = reader.readLine())!=null ) {
line = line.trim()
if ( line.startsWith( 'public') ){
line = line.substring('public'.length(), (line.endsWith('{') ? line.length()-1 : line.length()) ).trim()
idx = line.indexOf(' ')
if ( idx > 0 ){
String methodName = line.substring(idx).trim()
String retValue = line.substring(0,idx).trim()
if ( !methodName.startsWith( className )){
patterns.put( methodName, retValue )
}
}
}
}
}
}
println file.getName()
for (String methodName : patterns.keySet()) {
String retValue = patterns.get(methodName);
println "${className},${methodName},${retValue}"
}
}
extractCompletionList( new File('driver/src/main/java/com/dbschema/mongo/JMongoDatabase.java') )
extractCompletionList( new File('driver/src/main/java/com/dbschema/mongo/JMongoIterable.java') )
]]></groovy>
</target>
-->