Praise be to Ivy, which lets me do what I need without tremendous amounts of

hair-pulling and ball-ache. We now have Maven call out to an Ivy-based Ant task
to do the Proguard build (with Ivy maintaining a parallel copy of the
dependencies, unfortunately). It's a twisty maze of passages, but it gets the
Proguard build done during the right Maven phase so that all of its magical
building, version number changing, SVN commits, etc. can happen as usual during
the publishing process.
This commit is contained in:
Michael Bayne
2010-09-21 05:26:00 +00:00
parent f6a03dd99f
commit 724ee652f1
3 changed files with 67 additions and 104 deletions
+32 -74
View File
@@ -1,7 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="getdown" default="compile" basedir="."> <project xmlns:ivy="antlib:org.apache.ivy.ant" name="getdown" basedir=".">
<property name="app.name" value="getdown"/> <property name="app.name" value="getdown"/>
<property name="revision" value="1.0"/>
<!-- downloads ivy if necessary and sets everything up --> <!-- downloads ivy if necessary and sets everything up -->
<property name="ivy.vers" value="2.1.0-rc2" /> <property name="ivy.vers" value="2.1.0-rc2" />
@@ -19,84 +18,43 @@
<ivy:cachepath pathid="compile.classpath" conf="compile" log="download-only"/> <ivy:cachepath pathid="compile.classpath" conf="compile" log="download-only"/>
</target> </target>
<target name="check-ivy" depends="-init-ivy" description="Computes and prints Ivy classpath.">
<pathconvert pathsep="${line.separator} " property="compile.str" refid="compile.classpath"/>
<echo>Compile classpath:</echo>
<echo> ${compile.str}</echo>
</target>
<target name="proguard" depends="-init-ivy"> <target name="proguard" depends="-init-ivy">
<!-- we need ant-contrib for if --> <!-- Ivy is awesome and will fill the location of all of our dependencies into properties -->
<!-- <property name="cache.dir" value="${user.home}/.ivy2/cache"/>
<taskdef resource="net/sf/antcontrib/antlib.xml"> <ivy:artifactproperty
<classpath> name="[artifact]"
<pathelement location="${deploy.dir}/lib/ant-contrib.jar"/> value="${cache.dir}/[organization]/[module]/[type]s/[artifact]-[revision].[ext]"/>
</classpath>
</taskdef>
-->
<!-- figure out where the Java rt.jar file lives -->
<!--
<if><and><os family="mac"/><os family="unix"/></and><then>
<property name="rtClasses" value="${java.home}/../Classes/classes.jar"/>
</then><else>
<property name="rtClasses" value="${java.home}/lib/rt.jar"/>
</else></if>
-->
<!-- fucking Proguard, fucking Mac OS X -->
<mkdir dir="target"/> <mkdir dir="target"/>
<copy file="${java.home}/../Classes/classes.jar" tofile="target/runtime.jar"
failonerror="false"/>
<copy file="${java.home}/lib/rt.jar" tofile="target/runtime.jar" failonerror="false"/>
<taskdef resource="proguard/ant/task.properties" classpathref="compile.classpath"/> <taskdef resource="proguard/ant/task.properties" classpath="${proguard}"/>
<proguard> <proguard>
-injars dist/getdown.jar(!**/tools/**) <injar path="target/getdown-${maven.version}.jar" filter="!**/tools/DigesterTask*"/>
-injars dist/getdown.jar(**/tools/*Patcher*,**/tools/Differ*) <injar path="lib/jRegistryKey.jar" filter="!META-INF/**"/>
-injars dist/lib/jRegistryKey.jar(!META-INF/*) <injar path="${samskivert}" filter="!META-INF/**,!**/Log4JLogger*,
-injars dist/lib/samskivert.jar( !**/*.java,com/samskivert/Log.class,**/samskivert/io/**,**/samskivert/swing/**,
com/samskivert/Log.class,**/io/**,**/swing/**,**/net/**,**/text/**,**/util/**) **/samskivert/text/**,**/samskivert/util/**"/>
-injars dist/lib/commons-codec.jar(!META-INF/*) <injar path="${commons-codec}" filter="!META-INF/**"/>
<outjar path="target/getdown-pro-${maven.version}.jar"/>
-dontskipnonpubliclibraryclasses <libraryjar name="target/runtime.jar"/>
<keep name="ca.beq.util.win32.registry.**"/>
-outjars target/getdown-pro.jar <keep name="com.threerings.getdown.launcher.Getdown">
<method access="static" name="main"/>
-keep public class ca.beq.util.win32.registry.** { </keep>
*; <keep name="com.threerings.getdown.launcher.GetdownApp">
} <method access="static" name="main"/>
</keep>
-keep public class com.threerings.getdown.launcher.Getdown { <keep name="com.threerings.getdown.launcher.GetdownApplet"/>
public static void main (java.lang.String[]); <keep name="*" extends="javax.swing.JApplet">
} <method name="*"/>
</keep>
-keep public class com.threerings.getdown.launcher.GetdownApp { <keep name="com.threerings.getdown.launcher.GetdownAppletConfig"/>
public static void main (java.lang.String[]);
}
-keep public class com.threerings.getdown.launcher.GetdownApplet {
*;
}
-keep class * extends javax.swing.JApplet {
&lt;methods&gt;;
}
-keep public class com.threerings.getdown.launcher.GetdownAppletConfig {
*;
}
</proguard> </proguard>
<!-- <delete file="target/runtime.jar"/>
<taskdef name="weave" classname="com.rc.retroweaver.ant.RetroWeaverTask"
classpath="${deploy.dir}/lib/retroweaver-all-1.2.2.jar"/>
<weave inputjar="${basedir}/${deploy.dir}/${app.name}-pro.jar"
outputjar="${basedir}/${deploy.dir}/${app.name}-retro-pro.jar"/>
-->
<!-- now combine the retroweaved jar file with the retroweaver runtime -->
<!--
<unjar src="${deploy.dir}/lib/retroweaver-rt-1.2.2.jar"
dest="${deploy.dir}/rptmp"/>
<jar destfile="${deploy.dir}/${app.name}-retro-pro.jar"
manifest="lib/manifest.mf" basedir="${deploy.dir}/rptmp" update="true"/>
<delete dir="${deploy.dir}/rptmp"/>
-->
</target> </target>
</project> </project>
+1 -8
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:mvn="http://ant.apache.org/ivy/maven"> <ivy-module version="2.0" xmlns:mvn="http://ant.apache.org/ivy/maven">
<info organisation="com.threerings" module="getdown" revision="${revision}"> <info organisation="com.threerings" module="getdown" revision="1.0">
<description homepage="http://code.google.com/p/getdown"/> <description homepage="http://code.google.com/p/getdown"/>
</info> </info>
<configurations> <configurations>
@@ -14,17 +14,10 @@
<conf name="compile" visibility="private" extends="runtime,provided,optional"/> <conf name="compile" visibility="private" extends="runtime,provided,optional"/>
<conf name="test" visibility="private" extends="compile"/> <conf name="test" visibility="private" extends="compile"/>
</configurations> </configurations>
<publications>
<artifact type="jar"/>
<artifact type="source" ext="jar" mvn:classifier="sources"/>
<artifact type="javadoc" ext="jar" mvn:classifier="javadoc"/>
</publications>
<dependencies> <dependencies>
<dependency org="net.sf.proguard" name="proguard" rev="4.4" conf="compile->master(*)"/> <dependency org="net.sf.proguard" name="proguard" rev="4.4" conf="compile->master(*)"/>
<dependency org="com.samskivert" name="samskivert" rev="1.0" conf="compile->master(*)"/> <dependency org="com.samskivert" name="samskivert" rev="1.0" conf="compile->master(*)"/>
<dependency org="commons-codec" name="commons-codec" rev="1.4" conf="compile->master(*)"/> <dependency org="commons-codec" name="commons-codec" rev="1.4" conf="compile->master(*)"/>
<dependency org="log4j" name="log4j" rev="1.2.15" conf="compile->master(*)"/>
<dependency org="net.sourceforge.retroweaver" name="retroweaver" rev="2.0.7" conf="compile->master(*)"/>
<dependency org="org.apache.ant" name="ant" rev="1.7.1" conf="compile->master(*)"/> <dependency org="org.apache.ant" name="ant" rev="1.7.1" conf="compile->master(*)"/>
</dependencies> </dependencies>
</ivy-module> </ivy-module>
+34 -22
View File
@@ -41,21 +41,6 @@
</scm> </scm>
<dependencies> <dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<scope>compile</scope>
<optional>true</optional>
<exclusions>
<exclusion><groupId>javax.mail</groupId><artifactId>mail</artifactId></exclusion>
<exclusion><groupId>javax.jms</groupId><artifactId>jms</artifactId></exclusion>
<exclusion><groupId>com.sun.jdmk</groupId><artifactId>jmxtools</artifactId></exclusion>
<exclusion><groupId>com.sun.jmx</groupId><artifactId>jmxri</artifactId></exclusion>
<exclusion><groupId>oro</groupId><artifactId>oro</artifactId></exclusion>
<exclusion><groupId>junit</groupId><artifactId>junit</artifactId></exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>net.sf.proguard</groupId> <groupId>net.sf.proguard</groupId>
<artifactId>proguard</artifactId> <artifactId>proguard</artifactId>
@@ -77,13 +62,6 @@
<scope>compile</scope> <scope>compile</scope>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>net.sourceforge.retroweaver</groupId>
<artifactId>retroweaver</artifactId>
<version>2.0.7</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency> <dependency>
<groupId>org.apache.ant</groupId> <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId> <artifactId>ant</artifactId>
@@ -146,6 +124,40 @@
</links> </links>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>RELEASE</version>
<executions>
<execution>
<id>package</id>
<phase>package</phase>
<configuration>
<target>
<property name="maven.version" value="${project.version}"/>
<ant antfile="${basedir}/build-ivy.xml">
<target name="proguard"/>
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>RELEASE</version>
<configuration>
<archive>
<manifest>
<mainClass>com.threerings.getdown.launcher.Getdown</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>