summaryrefslogtreecommitdiff
path: root/ant
diff options
context:
space:
mode:
Diffstat (limited to 'ant')
-rw-r--r--ant/build-common.xml38
-rw-r--r--ant/ivy-common.xml57
2 files changed, 65 insertions, 30 deletions
diff --git a/ant/build-common.xml b/ant/build-common.xml
index cb8ac05..23aba6b 100644
--- a/ant/build-common.xml
+++ b/ant/build-common.xml
@@ -1,7 +1,7 @@
<project name="build-common"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
-
+
<property name="src.dir" value="src" />
<property name="build.dir" value="build" />
@@ -13,9 +13,6 @@
<property name="compile.deprecation" value="false" />
<property name="compile.optimize" value="true" />
- <property name="maven.groupid" value="net.jesterpm" />
- <property name="maven.artifactid" value="${ant.project.name}" />
-
<!-- CLASSPATHs -->
<path id="classpath.build">
<fileset dir="${lib.dir}" />
@@ -25,22 +22,16 @@
<path location="${build.dir}/${build.classes}" />
</path>
- <!-- Dependency Targets -->
- <target name="resolve" description="Resolve Dependencies">
- <ivy:retrieve />
- </target>
-
- <target name="dep-report" depends="resolve" description="Generate Dependency Report">
- <ivy:report todir="${build.dir}" />
- </target>
-
<!-- Building/Running Targets -->
- <target name="prepare" description="Create the build directories">
+
+ <!-- Create the build directories -->
+ <target name="prepare">
<mkdir dir="${build.dir}" />
+ <mkdir dir="${lib.dir}" />
<mkdir dir="${build.dir}/${build.classes}" />
</target>
- <target name="build" depends="prepare" description="Compile Project">
+ <target name="build" depends="prepare,resolve" description="Compile Project">
<javac srcdir="${src.dir}"
destdir="${build.dir}/${build.classes}"
debug="${compile.debug}"
@@ -72,25 +63,12 @@
</target>
<target name="jar" depends="build" description="Generate JAR">
- <jar destfile="build/${ant.project.name}.jar" basedir="build">
+ <jar destfile="${build.dir}/jars/${ant.project.name}.jar" basedir="${build.dir}/${build.classes}">
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
</target>
- <!-- Maven Targets -->
- <target name="pom" description="Generate pom.xml">
- <artifact:pom id="mypom" groupId="${maven.groupid}" artifactId="${maven.artifactid}"
- version="1.0-SNAPSHOT" name="${maven.artifactid}" />
- <artifact:writepom pomRefId="mypom" file="${build.dir}/pom.xml" trim="false" />
- </target>
-
- <target name="maven-install" depends="clean,jar,pom"
- description="Install artifact in local maven repo">
-
- <artifact:install file="build/${ant.project.name}.jar">
- <pom refid="mypom" file="${build.dir}/pom.xml"/>
- </artifact:install>
- </target>
+ <import file="${jesterpm.buildtools.root}/ant/ivy-common.xml" />
</project>
diff --git a/ant/ivy-common.xml b/ant/ivy-common.xml
new file mode 100644
index 0000000..8637e3d
--- /dev/null
+++ b/ant/ivy-common.xml
@@ -0,0 +1,57 @@
+<project name="ivy-common"
+ xmlns:ivy="antlib:org.apache.ivy.ant"
+ xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <property name="ivy.jar.version" value="2.3.0"/>
+ <property name="ivy.jar.name" value="ivy-${ivy.jar.version}.jar"/>
+ <property name="ivy.home" value="${user.home}/.ivy2"/>
+ <available property="ivy.installed" file="${ivy.home}/${ivy.jar.name}"/>
+
+ <!-- Install ivy jar files in ~/.ivy2 -->
+ <target name="ivy-install" unless="ivy.installed">
+ <mkdir dir="${ivy.home}"/>
+ <get
+ src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.jar.version}/${ivy.jar.name}"
+ dest="${ivy.home}/${ivy.jar.name}" />
+ </target>
+
+ <target name="ivy-init" depends="ivy-install">
+ <taskdef resource="org/apache/ivy/ant/antlib.xml"
+ uri="antlib:org.apache.ivy.ant"
+ classpath="${ivy.home}/${ivy.jar.name}" />
+ <ivy:resolve/>
+ </target>
+
+ <target name="resolve" depends="ivy-init" description="Download project dependencies">
+ <ivy:retrieve />
+ </target>
+
+ <target name="dep-report" depends="resolve" description="Generate dependency report">
+ <ivy:report todir="${build.dir}" />
+ </target>
+
+ <target name="gen-pom" depends="prepare,ivy-init"
+ description="Make a pom file for the project">
+ <ivy:makepom ivyfile="ivy.xml" pomfile="${build.dir}/poms/${ant.project.name}.pom">
+ <!--
+ Mapping confs to scopes is important, otherwise
+ unmapped confs are included as optional. If you
+ have private confs, the best option seems to
+ be marking them as provided or system. See
+ IVY-1201 for an ehancement request.
+ -->
+ <mapping conf="default" scope="compile"/>
+ </ivy:makepom>
+ </target>
+
+ <target name="publish-local" depends="jar,ivy-init,gen-pom"
+ description="Publish to local maven repo for building other projects">
+
+ <ivy:publish resolver="local-m2-publish" forcedeliver="true"
+ overwrite="true" publishivy="false">
+
+ <artifacts pattern="${build.dir}/[type]s/[artifact].[ext]"/>
+ </ivy:publish>
+ </target>
+
+</project>