forked from ringcentral/pubnub-jtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
241 lines (213 loc) · 10.2 KB
/
build.xml
File metadata and controls
241 lines (213 loc) · 10.2 KB
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build-all" name="PubnubApi" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<property environment="env"/>
<loadfile property="VERSION" srcFile="../VERSION"><filterchain><striplinebreaks/></filterchain></loadfile>
<property name="pubnub_lib_jar" value="Pubnub-Android-${VERSION}.jar"/>
<property name="pubnub_debug_lib_jar" value="Pubnub-Android-Debug-${VERSION}.jar"/>
<property name="java_core_path" value="../java"/>
<property name="src_pubnub_api_path" value="${java_core_path}/srcPubnubApi"/>
<property name="src_java_path" value="${java_core_path}/src1"/>
<property name="src_logging_path" value="./srcLogging"/>
<property name="src_crypto_path" value="./srcCrypto"/>
<property name="src_android_path" value="./src"/>
<property name="android_jar_path" value="jars"/>
<property name="srcPubnubApi.link" value="../java/srcPubnubApi"/>
<property name="sources_pubnub_api" value="${srcPubnubApi.link}/com/pubnub/api"/>
<property name="sources_pubnub_logging" value="srcLogging/com/pubnub/api"/>
<property name="sources_pubnub_java1" value="../java/src1/com/pubnub/api"/>
<property name="sources_pubnub_java" value="src/com/pubnub/api"/>
<property name="sources_pubnub_crypto" value="srcCrypto/com/pubnub/api"/>
<path id="PubnubApi.classpath">
<pathelement location="bin"/>
<pathelement location="../java/libs/bcprov-jdk15on-1.47.jar"/>
<pathelement location="libs/android-8.jar"/>
</path>
<property name="target" value="1.5"/>
<property name="source" value="1.5"/>
<path id="classpath">
<pathelement location="bin"/>
<pathelement location="${java_core_path}/libs/bcprov-jdk15on-1.47.jar"/>
<pathelement location="libs/android-8.jar"/>
</path>
<target name="test" />
<target name="build-all" depends="clean, debug-build, clean, build" />
<target name="deploy-all" depends="clean, push_to_maven_central, clean, push_debug_to_maven_central" />
<target name="setDebugTrue" >
<replace dir="${src_pubnub_api_path}" token="boolean LOGGING = false" value="boolean LOGGING = true">
<include name="**/*.java"/>
</replace>
</target>
<target name="unsetDebugTrue" >
<replace dir="${src_pubnub_api_path}" token="boolean LOGGING = true" value="boolean LOGGING = false">
<include name="**/*.java"/>
</replace>
</target>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="${src_pubnub_api_path}">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="copy_jars_to_examples" name="build-jar"/>
<target depends="create-jar" name="copy_jars_to_examples">
<copy file="${pubnub_lib_jar}" todir="./examples/PubnubExample/libs/"/>
<copy file="${pubnub_lib_jar}" todir="./examples/SubscribeAtBoot/libs/"/>
</target>
<target name="build" depends="clean">
<delete file="${pubnub_lib_jar}"/>
<antcall target="build-jar">
<param name="jar_name" value="${pubnub_lib_jar}" />
<param name="debug" value="false" />
</antcall>
</target>
<target name="debug-build" depends="clean">
<delete file="${pubnub_debug_lib_jar}"/>
<antcall target="setDebugTrue" />
<antcall target="build-jar">
<param name="jar_name" value="${pubnub_debug_lib_jar}" />
<param name="debug" value="true" />
</antcall>
<antcall target="unsetDebugTrue" />
</target>
<target depends="build-project" name="create-jar">
<jar destfile="${jar_name}"
basedir="bin"
includes="**/**"
/>
</target>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<replace dir="${src_pubnub_api_path}" token='static String VERSION = ""' value='static String VERSION = "${VERSION}"' >
<include name="**/*.java"/>
</replace>
<javac debug="${debug}" destdir="bin" source="${source}" target="${target}">
<src path="${src_pubnub_api_path}"/>
<src path="${src_java_path}"/>
<src path="${src_logging_path}"/>
<src path="${src_android_path}"/>
<src path="${src_crypto_path}"/>
<classpath refid="classpath"/>
</javac>
<replace dir="${src_pubnub_api_path}" token='static String VERSION = "${VERSION}"' value='static String VERSION = ""'>
<include name="**/*.java"/>
</replace>
</target>
<property name="src" location="src" />
<property name="maven" location="maven" />
<property name="build" location="build" />
<property name="dist" location="dist" />
<xmlproperty file="${basedir}/pom.xml" keepRoot="false" semanticAttributes="true"/>
<property name="maven-jar" value="${dist}/lib/${artifactId}-${version}.jar" />
<property name="maven-javadoc-jar" value="${dist}/lib/${artifactId}-${version}-javadoc.jar" />
<property name="maven-sources-jar" value="${dist}/lib/${artifactId}-${version}-sources.jar" />
<property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<target name="debug-compile" description="compile the source with logging and debug">
<replace dir="${maven}/src" token="boolean LOGGING = false" value="boolean LOGGING = true">
<include name="**/*.java"/>
</replace>
<javac debug="${debug}" srcdir="${maven}/src" destdir="${build}" >
<classpath refid="PubnubApi.classpath"/>
</javac>
<replace dir="${maven}/src" token="boolean LOGGING = true" value="boolean LOGGING = false">
<include name="**/*.java"/>
</replace>
</target>
<target name="compile" description="compile the source ">
<javac debug="${debug}" srcdir="${maven}/src" destdir="${build}" >
<classpath refid="PubnubApi.classpath"/>
</javac>
</target>
<target name="dist" depends="compile" description="generate the distribution">
<jar jarfile="${maven-jar}" basedir="${build}" />
<javadoc sourcepath="${maven}/src" destdir="${dist}/javadoc" >
<classpath refid="PubnubApi.classpath"/>
</javadoc>
<jar jarfile="${maven-javadoc-jar}">
<fileset dir="${dist}/javadoc" />
</jar>
<jar jarfile="${maven-sources-jar}">
<fileset dir="${maven}/src" />
</jar>
</target>
<target name="stage" depends="dist" description="deploy release version to Maven staging repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=${basedir}/pom.xml" />
<arg value="-Dfile=${maven-jar}" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=${basedir}/pom.xml" />
<arg value="-Dfile=${maven-sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=${basedir}/pom.xml" />
<arg value="-Dfile=${maven-javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
<target name="maven_clean" description="clean up">
<delete dir="${build}" />
<delete dir="${dist}" />
<delete dir="${maven}" />
<delete file="pom.xml.asc" />
</target>
<target name="push_to_maven_central" >
<mkdir dir="${build}" />
<mkdir dir="${maven}/src/com/pubnub/api" />
<copy todir="${maven}/src/com/pubnub/api" >
<fileset dir="${sources_pubnub_java}" />
<fileset dir="${sources_pubnub_java1}" />
<fileset dir="${sources_pubnub_logging}" />
<fileset dir="${sources_pubnub_api}" />
<fileset dir="${sources_pubnub_crypto}" />
</copy>
<mkdir dir="${dist}/lib" />
<antcall target="stage"/>
<antcall target="maven_clean"/>
</target>
<target name="push_debug_to_maven_central" >
<mkdir dir="${build}" />
<mkdir dir="${maven}/src/com/pubnub/api" />
<copy todir="${maven}/src/com/pubnub/api" >
<fileset dir="${sources_pubnub_java}" />
<fileset dir="${sources_pubnub_crypto}" />
<fileset dir="${sources_pubnub_java1}" />
<fileset dir="${sources_pubnub_logging}" />
<fileset dir="${sources_pubnub_api}" />
</copy>
<replace dir="${maven}/src" token="boolean LOGGING = false" value="boolean LOGGING = true">
<include name="**/*.java"/>
</replace>
<replace dir="." token="artifactId>pubnub-android" value="artifactId>pubnub-android-debug">
<include name="**/pom.xml"/>
</replace>
<mkdir dir="${dist}/lib" />
<antcall target="stage">
<param name="debug" value="true" />
</antcall>
<antcall target="maven_clean"/>
<replace dir="." token="artifactId>pubnub-android-debug" value="artifactId>pubnub-android">
<include name="**/pom.xml"/>
</replace>
</target>
</project>