|
1 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
2 | | -<project basedir="." default="build-all" name="PubnubApi"> |
| 2 | +<project basedir="." default="build-all" name="PubnubApi" xmlns:artifact="antlib:org.apache.maven.artifact.ant"> |
3 | 3 | <property environment="env"/> |
4 | 4 | <loadfile property="VERSION" srcFile="../VERSION"><filterchain><striplinebreaks/></filterchain></loadfile> |
5 | 5 | <property name="pubnub_lib_jar" value="Pubnub-Android-${VERSION}.jar"/> |
|
10 | 10 | <property name="src_logging_path" value="./srcLogging"/> |
11 | 11 | <property name="src_android_path" value="./src"/> |
12 | 12 | <property name="android_jar_path" value="jars"/> |
| 13 | + |
| 14 | + <property name="srcPubnubApi.link" value="../java/srcPubnubApi"/> |
| 15 | + <property name="sources_pubnub_api" value="${srcPubnubApi.link}/com/pubnub/api"/> |
| 16 | + <property name="sources_pubnub_logging" value="srcLogging/com/pubnub/api"/> |
| 17 | + <property name="sources_pubnub_java1" value="../java/src1/com/pubnub/api"/> |
| 18 | + <property name="sources_pubnub_java" value="src/com/pubnub/api"/> |
| 19 | + |
| 20 | + <path id="PubnubApi.classpath"> |
| 21 | + <pathelement location="bin"/> |
| 22 | + <pathelement location="../java/libs/bcprov-jdk15on-1.47.jar"/> |
| 23 | + <pathelement location="libs/android-8.jar"/> |
| 24 | + </path> |
| 25 | + |
| 26 | + |
| 27 | + |
13 | 28 | <property name="target" value="1.5"/> |
14 | 29 | <property name="source" value="1.5"/> |
15 | 30 | <path id="classpath"> |
|
89 | 104 | <include name="**/*.java"/> |
90 | 105 | </replace> |
91 | 106 | </target> |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + <property name="src" location="src" /> |
| 111 | + <property name="maven" location="maven" /> |
| 112 | + <property name="build" location="build" /> |
| 113 | + <property name="dist" location="dist" /> |
| 114 | + |
| 115 | + <xmlproperty file="pom.xml" keepRoot="false" semanticAttributes="true"/> |
| 116 | + |
| 117 | + <property name="maven-jar" value="${dist}/lib/${artifactId}-${version}.jar" /> |
| 118 | + <property name="maven-javadoc-jar" value="${dist}/lib/${artifactId}-${version}-javadoc.jar" /> |
| 119 | + <property name="maven-sources-jar" value="${dist}/lib/${artifactId}-${version}-sources.jar" /> |
| 120 | + |
| 121 | + <property name="maven-staging-repository-id" value="sonatype-nexus-staging" /> |
| 122 | + <property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" /> |
| 123 | + |
| 124 | + <target name="debug-compile" description="compile the source with logging and debug"> |
| 125 | + <replace dir="${maven}/src" token="boolean LOGGING = false" value="boolean LOGGING = true"> |
| 126 | + <include name="**/*.java"/> |
| 127 | + </replace> |
| 128 | + <javac debug="${debug}" srcdir="${maven}/src" destdir="${build}" > |
| 129 | + <classpath refid="PubnubApi.classpath"/> |
| 130 | + </javac> |
| 131 | + <replace dir="${maven}/src" token="boolean LOGGING = true" value="boolean LOGGING = false"> |
| 132 | + <include name="**/*.java"/> |
| 133 | + </replace> |
| 134 | + </target> |
| 135 | + <target name="compile" description="compile the source "> |
| 136 | + <javac debug="${debug}" srcdir="${maven}/src" destdir="${build}" > |
| 137 | + <classpath refid="PubnubApi.classpath"/> |
| 138 | + </javac> |
| 139 | + </target> |
| 140 | + |
| 141 | + |
| 142 | + <target name="dist" depends="compile" description="generate the distribution"> |
| 143 | + |
| 144 | + <jar jarfile="${maven-jar}" basedir="${build}" /> |
| 145 | + |
| 146 | + <javadoc sourcepath="${maven}/src" destdir="${dist}/javadoc" > |
| 147 | + <classpath refid="PubnubApi.classpath"/> |
| 148 | + </javadoc> |
| 149 | + <jar jarfile="${maven-javadoc-jar}"> |
| 150 | + <fileset dir="${dist}/javadoc" /> |
| 151 | + </jar> |
| 152 | + |
| 153 | + <jar jarfile="${maven-sources-jar}"> |
| 154 | + <fileset dir="${maven}/src" /> |
| 155 | + </jar> |
| 156 | + </target> |
| 157 | + |
| 158 | + |
| 159 | + <target name="stage" depends="dist" description="deploy release version to Maven staging repository"> |
| 160 | + <artifact:mvn> |
| 161 | + <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" /> |
| 162 | + <arg value="-Durl=${maven-staging-repository-url}" /> |
| 163 | + <arg value="-DrepositoryId=${maven-staging-repository-id}" /> |
| 164 | + <arg value="-DpomFile=pom.xml" /> |
| 165 | + <arg value="-Dfile=${maven-jar}" /> |
| 166 | + <arg value="-Pgpg" /> |
| 167 | + </artifact:mvn> |
| 168 | + |
| 169 | + <artifact:mvn> |
| 170 | + <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" /> |
| 171 | + <arg value="-Durl=${maven-staging-repository-url}" /> |
| 172 | + <arg value="-DrepositoryId=${maven-staging-repository-id}" /> |
| 173 | + <arg value="-DpomFile=pom.xml" /> |
| 174 | + <arg value="-Dfile=${maven-sources-jar}" /> |
| 175 | + <arg value="-Dclassifier=sources" /> |
| 176 | + <arg value="-Pgpg" /> |
| 177 | + </artifact:mvn> |
| 178 | + |
| 179 | + <artifact:mvn> |
| 180 | + <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" /> |
| 181 | + <arg value="-Durl=${maven-staging-repository-url}" /> |
| 182 | + <arg value="-DrepositoryId=${maven-staging-repository-id}" /> |
| 183 | + <arg value="-DpomFile=pom.xml" /> |
| 184 | + <arg value="-Dfile=${maven-javadoc-jar}" /> |
| 185 | + <arg value="-Dclassifier=javadoc" /> |
| 186 | + <arg value="-Pgpg" /> |
| 187 | + </artifact:mvn> |
| 188 | + </target> |
| 189 | + |
| 190 | + <target name="maven_clean" description="clean up"> |
| 191 | + <delete dir="${build}" /> |
| 192 | + <delete dir="${dist}" /> |
| 193 | + <delete dir="${maven}" /> |
| 194 | + <delete file="pom.xml.asc" /> |
| 195 | + </target> |
| 196 | + |
| 197 | + <target name="push_to_maven_central" > |
| 198 | + <mkdir dir="${build}" /> |
| 199 | + <mkdir dir="${maven}/src/com/pubnub/api" /> |
| 200 | + <copy todir="${maven}/src/com/pubnub/api" > |
| 201 | + <fileset dir="${sources_pubnub_java}" /> |
| 202 | + <fileset dir="${sources_pubnub_java1}" /> |
| 203 | + <fileset dir="${sources_pubnub_logging}" /> |
| 204 | + <fileset dir="${sources_pubnub_api}" /> |
| 205 | + </copy> |
| 206 | + <mkdir dir="${dist}/lib" /> |
| 207 | + <antcall target="stage"/> |
| 208 | + <antcall target="maven_clean"/> |
| 209 | + </target> |
| 210 | + |
| 211 | + <target name="push_debug_to_maven_central" > |
| 212 | + <mkdir dir="${build}" /> |
| 213 | + <mkdir dir="${maven}/src/com/pubnub/api" /> |
| 214 | + <copy todir="${maven}/src/com/pubnub/api" > |
| 215 | + <fileset dir="${sources_pubnub_java}" /> |
| 216 | + <fileset dir="${sources_pubnub_java1}" /> |
| 217 | + <fileset dir="${sources_pubnub_logging}" /> |
| 218 | + <fileset dir="${sources_pubnub_api}" /> |
| 219 | + </copy> |
| 220 | + <replace dir="${maven}/src" token="boolean LOGGING = false" value="boolean LOGGING = true"> |
| 221 | + <include name="**/*.java"/> |
| 222 | + </replace> |
| 223 | + <replace dir="." token="artifactId>pubnub-android" value="artifactId>pubnub-android-debug"> |
| 224 | + <include name="**/pom.xml"/> |
| 225 | + </replace> |
| 226 | + <mkdir dir="${dist}/lib" /> |
| 227 | + <antcall target="stage"> |
| 228 | + <param name="debug" value="true" /> |
| 229 | + </antcall> |
| 230 | + <antcall target="maven_clean"/> |
| 231 | + <replace dir="." token="artifactId>pubnub-android-debug" value="artifactId>pubnub-android"> |
| 232 | + <include name="**/pom.xml"/> |
| 233 | + </replace> |
| 234 | + </target> |
92 | 235 | </project> |
0 commit comments