Skip to content

Commit

Permalink
Update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
yuripourre committed Jan 26, 2017
1 parent 3ca8c4c commit c20a3c7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 107 deletions.
141 changes: 34 additions & 107 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,155 +1,82 @@
<?xml version="1.0"?>
<project name="Abby" default="dist" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<path id="maven-ant-tasks.classpath" path="libs/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath" />

<property name="version" value="1.0" /><!-- Change version in maven/pom.xml-->
<project name="Abby" default="dist" basedir=".">

<property name="version" value="1.0" />
<property name="etyllica-version" value="5.2.1" />
<property name="libcore" value="abby-${version}" />
<property name="maven-version" value="${version}-SNAPSHOT" />

<property name="src.dir" value="src/main/java" />
<property name="test.dir" value="src/test/java" />
<property name="build.dir" value="src/bin" />
<property name="lib.dir" value="libs"/>
<property name="maven.dir" value="maven"/>
<property name="reports.dir" value="tests"/>

<!-- define Maven coordinates -->
<property name="groupId" value="br.com.abby" />
<property name="artifactId" value="abby" />
<!-- define artifacts' name, which follows the convention of Maven -->
<property name="jar" value="${lib.dir}/${artifactId}-${maven-version}.jar" />
<property name="javadoc-jar" value="${lib.dir}/${artifactId}-${maven-version}-javadoc.jar" />
<property name="sources-jar" value="${lib.dir}/${artifactId}-${maven-version}-sources.jar" />
<!-- defined maven snapshots and staging repository id and url -->
<property name="ossrh-snapshots-repository-url"
value="https://oss.sonatype.org/content/repositories/snapshots/" />
<property name="ossrh-staging-repository-url"
value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<property name="ossrh-server-id" value="ossrh" />

<target name="dist" depends="clean, package">
<mkdir dir="${maven.dir}/javadoc" />
<javadoc sourcepath="${src.dir}" destdir="${maven.dir}/javadoc" />
<jar jarfile="${javadoc-jar}">
<fileset dir="${maven.dir}/javadoc" />
</jar>
<jar jarfile="${sources-jar}">
<fileset dir="${src.dir}" />
</jar>
</target>
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar" />
</path>

<target name="deploy" depends="dist" description="deploy snapshot version to Maven snapshot repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${ossrh-snapshots-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=${maven.dir}/pom.xml" />
<arg value="-Dfile=${jar}" />
</artifact:mvn>
</target>

<!-- before this, update project version (both build.xml and pom.xml) from SNAPSHOT to RELEASE -->
<target name="stage" depends="dist" description="deploy release version to Maven staging repository">
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${ossrh-staging-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=${maven.dir}/pom.xml" />
<arg value="-Dfile=${jar}" />
<arg value="-Pgpg" />
</artifact:mvn>

<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${ossrh-staging-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=${maven.dir}/pom.xml" />
<arg value="-Dfile=${sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>

<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${ossrh-staging-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=${maven.dir}/pom.xml" />
<arg value="-Dfile=${maven.dir}/${javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
<target name="dist" depends="clean, package"/>

<target name="clean">
<delete includeemptydirs="true" >
<fileset dir="${build.dir}">
<exclude name="**/assets/*"/>
<exclude name="**/assets/**"/>
<exclude name="**/assets/*"/>
<exclude name="**/assets/**"/>
</fileset>
</delete>
</target>

<target name="prepare">
<antcall target="init"/>
</target>

<target name="init">
<mkdir dir="${build.dir}" />
</target>

<target name="compile">
<javac srcdir="${src.dir}" destdir="${build.dir}" source="1.6" target="1.6" debug="off">
<classpath>
<pathelement path="${classpath}" />
<fileset dir="${lib.dir}">
<include name="etyllica*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="classpath" source="1.6" target="1.6" debug="off">
<classpath refid="classpath" />
<exclude name="**/examples/*"/>
<exclude name="**/examples/**"/>
</javac>
</target>

<target name="compile-tests">
<javac srcdir="${test.dir}" destdir="${build.dir}" includeantruntime="false" source="1.6" target="1.6" debug="off">
<classpath>
<fileset dir="${reports.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${reports.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
</target>

<target name="package" depends="init, compile, prepare">
<target name="package" depends="init, compile">
<jar destfile="${lib.dir}/${libcore}.jar">
<fileset dir="${build.dir}">
<include name="**/br/com/abby/*"/>
<include name="**/br/com/abby/**"/>
<include name="**/com/badlogic/gdx/*"/>
<include name="**/com/badlogic/gdx/**"/>
<include name="**/org/*"/>
<include name="**/org/**"/>
<include name="**/com/badlogic/gdx/*"/>
<include name="**/com/badlogic/gdx/**"/>
<include name="**/org/*"/>
<include name="**/org/**"/>
</fileset>
</jar>
</target>

<target name="test" depends="init, compile, compile-tests">
<junit printsummary="yes" haltonfailure="yes" showoutput="true">
<classpath>
<pathelement location="${build.dir}"/>
<fileset dir="${reports.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${build.dir}"/>
<fileset dir="${reports.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
<batchtest>
<fileset dir="${test.dir}">
<include name="**/*Test*.java"/>
<exclude name="**/*CoreTest*.java"/>
<exclude name="**/*AWT*.java"/>
</fileset>
<fileset dir="${test.dir}">
<include name="**/*Test*.java"/>
<exclude name="**/*CoreTest*.java"/>
<exclude name="**/*AWT*.java"/>
</fileset>
</batchtest>
<formatter type="brief" usefile="false"/>
</junit>
Expand Down
Binary file modified libs/abby-1.0.jar
Binary file not shown.
Binary file added libs/etyllica-5.3.1.jar
Binary file not shown.

0 comments on commit c20a3c7

Please sign in to comment.