Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding = "UTF-8"?>
- <project xmlns:ivy="antlib:org.apache.ivy.ant" name="PhotobucketAPI" default="all" basedir=".">
- <!-- Local properties first -->
- <property file="local.properties"/>
- <!-- User properties next -->
- <property file="${user.home}/ant.properties"/>
- <!-- Load environment variables. Needed for Hudson BUILD_NUMBER-->
- <property environment="env"/>
- <property name="version.prefix" value=""/>
- <property name="version.suffix" value="-${user.name}"/>
- <!-- set global properties for this build -->
- <property name="core.src.dir" value="core/src" />
- <property name="service.src.dir" value="service/src" />
- <property name="lib.dir" value="lib"/>
- <property name="build.dir" value="build"/>
- <property name="dist.dir" value="dist"/>
- <property name="core.test.dir" value="core/test"/>
- <property name="service.test.dir" value="service/test"/>
- <property name="reports.dir" value="reports"/>
- <path id="src.path">
- <pathelement path="core/src"/>
- <pathelement path="service/src"/>
- </path>
- <path id="src.test.path">
- <pathelement path="core/test"/>
- <pathelement path="service/test"/>
- </path>
- <target name="init" description="Init the project">
- <mkdir dir="${build.dir}"/>
- <mkdir dir="${build.dir}/api-android"/>
- <mkdir dir="${build.dir}/api-j2se"/>
- <mkdir dir="${build.dir}/test"/>
- <mkdir dir="${build.dir}/test/core"/>
- <mkdir dir="${build.dir}/test/service"/>
- <mkdir dir="${dist.dir}"/>
- <mkdir dir="${dist.dir}/lib"/>
- <mkdir dir="${reports.dir}" />
- <!-- Default these if not supplied -->
- <property name="env.BUILD_NUMBER" value="DEV-BUILD"/>
- <property name="build.version" value="${version.prefix}${env.BUILD_NUMBER}${version.suffix}"/>
- <echo>Build version: ${build.version}</echo>
- </target>
- <target name="clean" description="clean up" >
- <delete dir="${build.dir}"/>
- <delete dir="${dist.dir}"/>
- <delete dir="${basedir}/bin" />
- <delete dir="${reports.dir}" />
- </target>
- <target name="init.ivy">
- <!-- Configure Ivy -->
- <property name="ivy.settings.dir" value="${user.home}/.ivy2" />
- <available property="ivy.settings.file.exists" file="${ivy.settings.dir}/ivysettings.xml" />
- <fail unless="ivy.settings.file.exists" message="Unable to find ivysettings.xml in ${ivy.settings.dir}"/>
- <property file="${ivy.settings.dir}/ivysettings.properties" />
- <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" />
- </target>
- <target name="resolve" depends="init.ivy">
- <!-- First retrieve what we need to build for Android -->
- <ivy:retrieve conf="android.build" pattern="${lib.dir}/android.build/[artifact]-[revision].[ext]" />
- <!-- Next retrieve what we need to build for J2SE -->
- <ivy:retrieve conf="default" pattern="${lib.dir}/default/[artifact]-[revision].[ext]" />
- <!-- Lastly, retrieve what we need to build and run the unit tests -->
- <ivy:retrieve conf="test" pattern="${lib.dir}/test/[artifact]-[revision].[ext]" />
- </target>
- <target name="init.classpath">
- <path id="javac.bootclasspath.android">
- <fileset dir=".">
- <include name="${lib.dir}/android.build/android-*.jar" />
- </fileset>
- </path>
- <property name="javac.bootclasspath.android.text" refid="javac.bootclasspath.android"/>
- <path id="javac.classpath.android">
- <fileset dir=".">
- <include name="${lib.dir}/android.build/*.jar" />
- <exclude name="${lib.dir}/android.build/android-*.jar"/>
- </fileset>
- </path>
- <property name="javac.classpath.android.text" refid="javac.classpath.android"/>
- <path id="javac.classpath.j2se">
- <fileset dir=".">
- <include name="${lib.dir}/default/*.jar" />
- </fileset>
- </path>
- <property name="javac.classpath.j2se.text" refid="javac.classpath.j2se"/>
- <path id="javac.classpath.test">
- <fileset dir=".">
- <include name="${lib.dir}/test/*.jar" />
- </fileset>
- </path>
- <property name="javac.classpath.test.text" refid="javac.classpath.test"/>
- <path id="junit.classpath">
- <pathelement path="${build.dir}/test" />
- <fileset dir=".">
- <include name="${lib.dir}/test/*.jar" />
- </fileset>
- </path>
- <property name="junit.classpath.text" refid="junit.classpath"/>
- <echo>Android bootclasspath: ${javac.bootclasspath.android.text}</echo>
- <echo>Android classpath: ${javac.classpath.android.text}</echo>
- <echo>J2SE classpath: ${javac.classpath.j2se.text}</echo>
- <echo>Test Compile classpath: ${javac.classpath.test.text}</echo>
- <echo>Test Run classpath: ${junit.classpath.text}</echo>
- </target>
- <target name="compile.api.android" depends="init,init.classpath" description="Compiles the API classes against the Android SDK">
- <javac
- destdir="${build.dir}/api-android"
- source="1.5"
- target="1.5"
- includeAntRuntime="false"
- includeJavaRuntime="false"
- bootclasspathref="javac.bootclasspath.android"
- classpathref="javac.classpath.android"
- debug="on">
- <src refid="src.path" />
- </javac>
- </target>
- <target name="compile.api.j2se" depends="init,init.classpath" description="Compiles the API classes against J2SE + supporting libs">
- <javac
- destdir="${build.dir}/api-j2se"
- source="1.5"
- target="1.5"
- includeAntRuntime="false"
- includeJavaRuntime="false"
- classpathref="javac.classpath.j2se"
- debug="on">
- <src refid="src.path" />
- </javac>
- </target>
- <target name="compile.test" depends="init,init.classpath" description="Compiles unit tests">
- <javac
- destdir="${build.dir}/test"
- source="1.5"
- target="1.5"
- includeAntRuntime="false"
- includeJavaRuntime="false"
- classpathref="javac.classpath.test"
- debug="on">
- <src refid="src.path"/>
- <src refid="src.test.path"/>
- </javac>
- <copy todir="${build.dir}/test">
- <fileset dir="core/test" includes="**/*.properties"/>
- </copy>
- </target>
- <target name="compile" depends="compile.api.android,compile.api.j2se,compile.test" description="Compiles everything" />
- <target name="jar.common">
- <manifest file="${dist.dir}/MANIFEST.MF">
- <attribute name="Implementation-Version" value="${build.version}"/>
- </manifest>
- </target>
- <target name="jar.android" depends="jar.common">
- <jar destfile="${dist.dir}/pbapi-android.jar" manifest="${dist.dir}/MANIFEST.MF">
- <fileset dir="${build.dir}/api-android" includes="**/*"/>
- </jar>
- </target>
- <target name="jar.j2se" depends="jar.common">
- <jar destfile="${dist.dir}/pbapi-j2se.jar" manifest="${dist.dir}/MANIFEST.MF">
- <fileset dir="${build.dir}/api-j2se" includes="**/*"/>
- </jar>
- </target>
- <target name="jar" depends="compile,jar.android,jar.j2se"/>
- <target name="zip" depends="jar">
- <zip destfile="${dist.dir}/pbapi-full.zip">
- <fileset dir="${dist.dir}">
- <include name="pbapi-j2se.jar" />
- <include name="pbapi-android.jar" />
- </fileset>
- <zipfileset dir="${lib.dir}" prefix="lib">
- <include name="**/*.jar" />
- <exclude name="android.build/android-*.jar" />
- </zipfileset>
- </zip>
- </target>
- <!-- This will copy the template and populate with build system defaults if they're defined -->
- <target name="test.prepare" if="test.api.oauthid">
- <echo>Preparing consumer.properties...</echo>
- <copy file="core/test/consumer.properties.template" tofile="${build.dir}/test/consumer.properties" overwrite="false" />
- <propertyfile file="${build.dir}/test/consumer.properties">
- <entry key="oauth.consumer" value="${test.api.oauthid}" operation="=" />
- <entry key="oauth.consumer.key" value="${test.api.oauthkey}" operation="=" />
- <entry key="subdomain" value="${test.api.subdomain}" operation="=" />
- <entry key="username" value="${test.api.username}" operation="=" />
- <entry key="password" value="${test.api.password}" operation="=" />
- <entry key="differentUser" value="${test.api.differentUser}" operation="=" />
- </propertyfile>
- </target>
- <target name="test" depends="compile.test,test.prepare" description="Run unit tests">
- <junit>
- <classpath refid="junit.classpath" />
- <formatter type="xml" />
- <batchtest fork="true" todir="${reports.dir}">
- <fileset dir="${build.dir}/test">
- <include name="com/photobucket/api/core/*Test*.class" />
- <include name="com/photobucket/api/service/*Test*.class" />
- </fileset>
- </batchtest>
- </junit>
- </target>
- <target name="javadoc" depends="compile">
- <javadoc destdir="${dist.dir}/doc" author="true" version="true" use="true" windowtitle="Photobucket Java Client API Documentation">
- <classpath>
- <pathelement path="${build.dir}/api-j2se" />
- </classpath>
- <fileset dir="." defaultexcludes="yes">
- <include name="core/src/**/*.java"/>
- <include name="service/src/**/*.java"/>
- </fileset>
- <doctitle><![CDATA[<h1>Photobucket Java Client API</h1>]]></doctitle>
- <bottom><![CDATA[<i>Copyright © 2011 Photobucket, LLC. All Rights Reserved.</i>]]></bottom>
- </javadoc>
- </target>
- <target name="all" depends="clean,jar,javadoc,zip,test" />
- <target name="publish" depends="init.ivy,resolve,all">
- <fail unless="env.BUILD_NUMBER" message="env.BUILD_NUMBER property not set"/>
- <!-- Perform a resolve to initialize ivy -->
- <delete file="${dist.dir}/ivy.xml"/>
- <ivy:publish artifactspattern="${dist.dir}/[artifact].[ext]"
- resolver="photobucket-projects-writable"
- pubrevision="${build.version}"
- conf="android,default"
- status="release"
- forcedeliver="true" />
- </target>
- </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement