AppleCommander/ant-build/build.xml

269 lines
9.4 KiB
XML
Raw Permalink Normal View History

2004-06-18 05:13:45 +00:00
<project name="AppleCommander" default="all" basedir="..">
2003-03-16 05:27:04 +00:00
<description>
This script builds the distribution components.
2003-03-16 05:27:04 +00:00
</description>
<!-- Fix ant warning (explained: https://stackoverflow.com/questions/5103384) -->
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
2003-03-16 05:27:04 +00:00
<property name="work" value="work"/>
<property name="classes" value="${work}/classes"/>
2004-06-18 05:13:45 +00:00
<property name="dist" value="${work}/dist"/>
2003-03-16 05:27:04 +00:00
<property name="source" value="src"/>
2004-06-18 05:13:45 +00:00
<property name="testsrc" value="test"/>
2003-03-16 05:27:04 +00:00
<property name="build" value="build"/>
<property name="doc" value="documentation"/>
<property name="web" value="web"/>
2004-06-18 05:13:45 +00:00
<property name="javadoc" value="${work}/javadoc"/>
<property name="builddir" value="${basedir}/build" />
<property name="mac.dir" value="${basedir}/mac"/>
<property file="${builddir}/ACBuild.properties"/>
<property file="${builddir}/ACBuild-default.properties"/>
<!-- If you want to add a platform, create a conditional property for it here -->
<condition property="isWin" value="true">
<os family="windows" />
</condition>
<condition property="isMac" value="true">
<and>
<os family="mac" />
<os family="unix" />
</and>
</condition>
<condition property="isUnix" value="true">
<!-- macOS also provides unix, so we must explicitly exclude it here -->
<and>
<os family="unix" />
<not>
<os family="mac" />
</not>
</and>
</condition>
2008-06-07 12:51:19 +00:00
<condition property="signing-needed">
<available file="${keyconf}" property="keyconf-exists" />
</condition>
mac: Use universalJavaApplicationStub Here's a (very rough) implementation of a macBundle task using the universalJavaApplicationStub and jarbundler. Jarbundler's support files (ant build system and docs) are suffering bitrot, and I don't grok maven yet, so I'm really flying blind with it, so basically I'm committing it in a "baseline" working (if ugly) state. So ... _why_ use this? The old way of bundling Java apps doesn't work anymore. It tells you to get Apple's (compromised/unsafe) Java 6 and when you do it throws an error because your code compiled on Oracle JDK 8/9 won't run on it anymore. You're supposed to duplicate the JRE in each Java program you bundle as you would a private/custom framework. Yes, really. This solves the dependency issues at the cost of heavy resource waste. Except every new JDK generation changes HOW you do that, and the current method is totally proprietary to Oracle's JDK. For cross-platform development, it is NOT fun. So there's uJAS, which is literally a complex shell script to magically do the equivalent of typing java -jar <your program> from the command line—which does work BTW if all your dependencies are properly in your default classpath, etc. There used to be a couple of application bundler options, but the one that still works (only with uJAS if you have the most recent JDKs), is jarbundler. TODO: Clean this up, restore original functionality (zipball), include the commandline jar, etc. committing it in this state is that jarbundler's repo is a bit of a mess. The current version (and the version we need) is 3.3.0, the "latest" from 2015. The docs, examples, and the ant build system are all literally bitrotting from version 2.x, and do not work without some fixes. So in other words, I'm committing this in a state that I got to work so that if I screw it up, since I'm flying blind, I'll have a messy but working fallback. Okay, so _why_ use any of this at all? If you create an ACBuild.properties file and run ant, you can get AppleCommander.app to build, but it won't run. It tells you that you need to download Apple's legacy Java 6 which is neither safe nor supported anymore. If you install this, it will still give you an error because the generated code can't run under Java 6. What you're supposed to do now is bundle your JRE with every Java application bundle, which means multiple copies of libs on disk and in memory. Yes, really. Except Oracle keeps changing how you do this with each new JDK generation, and the current way is pretty much totally proprietary so that you're locked in to Oracle's JDK and couldn't use OpenJDK or something if that were an option. That's what universalJavaApplicationStub resolves—it builds an app bundle that uses whatever JDK/JRE you have installed from 6 onwards. And it in turn needs jarbundler or something like it. Except all of the "something like it" solutions are dead or deprecated save the latest release of jarbundler which was modified to support uJAS and then promptly left more or less untouched since. But it "works".
2017-10-30 13:14:13 +00:00
<taskdef name="jarbundler"
classname="com.ultramixer.jarbundler.JarBundler"
classpath="mac/jarbundler-core-3.3.0.jar" />
<target name="version" description="Get version from source.">
<property name="main.path" value="src/com/webcodepro/applecommander/ui"/>
<loadfile srcfile="${main.path}/AppleCommander.java" property="acVersion">
<filterchain>
<linecontainsregexp>
<regexp pattern='^.*String VERSION = ".*";.*$'/>
</linecontainsregexp>
<tokenfilter>
<replaceregex pattern='^.*String VERSION = "(.*)";.*$' replace='\1'/>
</tokenfilter>
<striplinebreaks/>
</filterchain>
</loadfile>
<echo>Building version ${acVersion}...</echo>
</target>
<target name="init-win" if="isWin">
<property name="antjar" value="${antJarPathWin}" />
<property name="swtjar" value="${swtJarPathWin}" />
<property name="juintjar" value="${junitPathWin}" />
</target>
<target name="init-mac" if="isMac">
<property name="antjar" value="${antJarPathMac}" />
<property name="swtjar" value="${swtJarPathMac}" />
<property name="juintjar" value="${junitPathMac}" />
<condition property="noMacGui" value="true">
<isset property="noGui" />
</condition>
</target>
<target name="init-unix" if="isUnix">
<property name="antjar" value="${antJarPathUnix}" />
<property name="swtjar" value="${swtJarPathUnix}" />
<property name="juintjar" value="${junitPathUnix}" />
</target>
<target name="init" depends="version,init-win,init-mac,init-unix"
description="Ensure work directory is present">
2003-03-16 05:27:04 +00:00
<mkdir dir="${work}"/>
<mkdir dir="${classes}"/>
2004-06-18 05:13:45 +00:00
<mkdir dir="${dist}"/>
<mkdir dir="${javadoc}"/>
<property name="guijar" value="${dist}/AppleCommander-${acVersion}.jar"/>
<property name="cmdjar" value="${dist}/AppleCommander-${acVersion}-ac.jar"/>
<property name="maczip" value="${dist}/AppleCommander-${acVersion}-mac.zip"/>
<property name="srczip" value="${dist}/AppleCommander-${acVersion}-src.zip"/>
<property name="webzip" value="${dist}/AppleCommander-${acVersion}-web.zip"/>
2003-03-16 05:27:04 +00:00
</target>
<target name="clean" depends="init" description="Wipes out work contents">
<delete dir="${classes}"/>
2004-06-18 05:13:45 +00:00
<delete dir="${dist}"/>
<delete dir="${javadoc}"/>
2003-03-16 05:27:04 +00:00
</target>
<target name="all" depends="init,jars,macBundle,sourceZip,javadoc,websiteZip" description="Everything">
<!-- Nothing else to do - depends handles it all. -->
</target>
<target name="jars" depends="init,executableGuiJar,executableCmdJar,signJars" description="Build executable jars">
2008-06-07 12:51:19 +00:00
<!-- Nothing else to do - depends handles it all. -->
</target>
<target name="signJars" depends="init" if="signing-needed" description="Signs the jars">
<!-- In ACBuild.properties => keyconf=${user.home}/.secret alias=name -->
<!-- See man keytool, http://java.sun.com/j2se/1.5.0/docs/tooldocs/ -->
<loadfile srcfile="${keyconf}" property="password"/>
<signjar alias="${alias}" storepass="${password}">
<fileset dir="${basedir}">
<include name="${cmdjar}"/>
<include name="${guijar}"/>
</fileset>
</signjar>
2004-06-18 05:13:45 +00:00
</target>
<target name="executableGuiJar" depends="init" unless="noGui"
description="Build GUI executable JAR">
<javac srcdir="${source}" destdir="${classes}" classpath="${antjar}:${swtjar}">
2003-03-16 05:27:04 +00:00
<include name="**/*.java"/>
<exclude name="**/*Test.java"/>
<compilerarg value="-Xlint:unchecked"/>
2003-03-16 05:27:04 +00:00
</javac>
2004-06-18 05:13:45 +00:00
<jar jarfile="${guijar}" manifest="build/manifest.mf">
2003-03-16 05:27:04 +00:00
<fileset dir="${classes}"/>
<fileset dir="${source}">
<include name="**/*.dump"/>
<include name="**/*.properties"/>
<include name="**/*.gif"/>
</fileset>
<fileset dir=".">
<include name="LICENSE"/>
<include name="TODO"/>
<include name="VERSIONS"/>
</fileset>
</jar>
</target>
<target name="executableCmdJar" depends="init"
description="Build command-line only executable JAR">
<!-- SWT needs to be in classpath if executableGuiCmdJar didn't run -->
<javac srcdir="${source}" destdir="${classes}" classpath="${antjar}:${swtjar}">
2004-06-18 05:13:45 +00:00
<include name="**/*.java"/>
<exclude name="**/*Test.java"/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-XDignore.symbol.file"/>
2004-06-18 05:13:45 +00:00
</javac>
2008-05-29 12:45:41 +00:00
<jar jarfile="${cmdjar}" manifest="build/ac.mf">
2004-06-18 05:13:45 +00:00
<fileset dir="${classes}">
<exclude name="com/webcodepro/applecommander/ui/swt/**"/>
<exclude name="com/webcodepro/applecommander/ui/images/**"/>
</fileset>
<fileset dir="${source}">
<include name="**/*.dump"/>
<include name="**/*.properties"/>
</fileset>
<fileset dir=".">
<include name="LICENSE"/>
<include name="TODO"/>
<include name="VERSIONS"/>
</fileset>
</jar>
</target>
<target name="macBundle" depends="init,jars" if="isMac" unless="noMacGui"
description="Build Mac application bundle.">
<property name="mac.app" value="${dist}/AppleCommander.app"/>
mac: Use universalJavaApplicationStub Here's a (very rough) implementation of a macBundle task using the universalJavaApplicationStub and jarbundler. Jarbundler's support files (ant build system and docs) are suffering bitrot, and I don't grok maven yet, so I'm really flying blind with it, so basically I'm committing it in a "baseline" working (if ugly) state. So ... _why_ use this? The old way of bundling Java apps doesn't work anymore. It tells you to get Apple's (compromised/unsafe) Java 6 and when you do it throws an error because your code compiled on Oracle JDK 8/9 won't run on it anymore. You're supposed to duplicate the JRE in each Java program you bundle as you would a private/custom framework. Yes, really. This solves the dependency issues at the cost of heavy resource waste. Except every new JDK generation changes HOW you do that, and the current method is totally proprietary to Oracle's JDK. For cross-platform development, it is NOT fun. So there's uJAS, which is literally a complex shell script to magically do the equivalent of typing java -jar <your program> from the command line—which does work BTW if all your dependencies are properly in your default classpath, etc. There used to be a couple of application bundler options, but the one that still works (only with uJAS if you have the most recent JDKs), is jarbundler. TODO: Clean this up, restore original functionality (zipball), include the commandline jar, etc. committing it in this state is that jarbundler's repo is a bit of a mess. The current version (and the version we need) is 3.3.0, the "latest" from 2015. The docs, examples, and the ant build system are all literally bitrotting from version 2.x, and do not work without some fixes. So in other words, I'm committing this in a state that I got to work so that if I screw it up, since I'm flying blind, I'll have a messy but working fallback. Okay, so _why_ use any of this at all? If you create an ACBuild.properties file and run ant, you can get AppleCommander.app to build, but it won't run. It tells you that you need to download Apple's legacy Java 6 which is neither safe nor supported anymore. If you install this, it will still give you an error because the generated code can't run under Java 6. What you're supposed to do now is bundle your JRE with every Java application bundle, which means multiple copies of libs on disk and in memory. Yes, really. Except Oracle keeps changing how you do this with each new JDK generation, and the current way is pretty much totally proprietary so that you're locked in to Oracle's JDK and couldn't use OpenJDK or something if that were an option. That's what universalJavaApplicationStub resolves—it builds an app bundle that uses whatever JDK/JRE you have installed from 6 onwards. And it in turn needs jarbundler or something like it. Except all of the "something like it" solutions are dead or deprecated save the latest release of jarbundler which was modified to support uJAS and then promptly left more or less untouched since. But it "works".
2017-10-30 13:14:13 +00:00
<!--
NB: This seems like the only obvious way to turn ${swtjar}
into something we can install using jarbundler to both
copy and add to classpath. If you have a better way… :)
mac: Use universalJavaApplicationStub Here's a (very rough) implementation of a macBundle task using the universalJavaApplicationStub and jarbundler. Jarbundler's support files (ant build system and docs) are suffering bitrot, and I don't grok maven yet, so I'm really flying blind with it, so basically I'm committing it in a "baseline" working (if ugly) state. So ... _why_ use this? The old way of bundling Java apps doesn't work anymore. It tells you to get Apple's (compromised/unsafe) Java 6 and when you do it throws an error because your code compiled on Oracle JDK 8/9 won't run on it anymore. You're supposed to duplicate the JRE in each Java program you bundle as you would a private/custom framework. Yes, really. This solves the dependency issues at the cost of heavy resource waste. Except every new JDK generation changes HOW you do that, and the current method is totally proprietary to Oracle's JDK. For cross-platform development, it is NOT fun. So there's uJAS, which is literally a complex shell script to magically do the equivalent of typing java -jar <your program> from the command line—which does work BTW if all your dependencies are properly in your default classpath, etc. There used to be a couple of application bundler options, but the one that still works (only with uJAS if you have the most recent JDKs), is jarbundler. TODO: Clean this up, restore original functionality (zipball), include the commandline jar, etc. committing it in this state is that jarbundler's repo is a bit of a mess. The current version (and the version we need) is 3.3.0, the "latest" from 2015. The docs, examples, and the ant build system are all literally bitrotting from version 2.x, and do not work without some fixes. So in other words, I'm committing this in a state that I got to work so that if I screw it up, since I'm flying blind, I'll have a messy but working fallback. Okay, so _why_ use any of this at all? If you create an ACBuild.properties file and run ant, you can get AppleCommander.app to build, but it won't run. It tells you that you need to download Apple's legacy Java 6 which is neither safe nor supported anymore. If you install this, it will still give you an error because the generated code can't run under Java 6. What you're supposed to do now is bundle your JRE with every Java application bundle, which means multiple copies of libs on disk and in memory. Yes, really. Except Oracle keeps changing how you do this with each new JDK generation, and the current way is pretty much totally proprietary so that you're locked in to Oracle's JDK and couldn't use OpenJDK or something if that were an option. That's what universalJavaApplicationStub resolves—it builds an app bundle that uses whatever JDK/JRE you have installed from 6 onwards. And it in turn needs jarbundler or something like it. Except all of the "something like it" solutions are dead or deprecated save the latest release of jarbundler which was modified to support uJAS and then promptly left more or less untouched since. But it "works".
2017-10-30 13:14:13 +00:00
-->
<copy file="${swtjar}" tofile="${work}/swt/swt.jar" />
<jarbundler dir="${dist}"
name="AppleCommander" version="${acVersion}"
verbose="true" showPlist="true"
mac: Use universalJavaApplicationStub Here's a (very rough) implementation of a macBundle task using the universalJavaApplicationStub and jarbundler. Jarbundler's support files (ant build system and docs) are suffering bitrot, and I don't grok maven yet, so I'm really flying blind with it, so basically I'm committing it in a "baseline" working (if ugly) state. So ... _why_ use this? The old way of bundling Java apps doesn't work anymore. It tells you to get Apple's (compromised/unsafe) Java 6 and when you do it throws an error because your code compiled on Oracle JDK 8/9 won't run on it anymore. You're supposed to duplicate the JRE in each Java program you bundle as you would a private/custom framework. Yes, really. This solves the dependency issues at the cost of heavy resource waste. Except every new JDK generation changes HOW you do that, and the current method is totally proprietary to Oracle's JDK. For cross-platform development, it is NOT fun. So there's uJAS, which is literally a complex shell script to magically do the equivalent of typing java -jar <your program> from the command line—which does work BTW if all your dependencies are properly in your default classpath, etc. There used to be a couple of application bundler options, but the one that still works (only with uJAS if you have the most recent JDKs), is jarbundler. TODO: Clean this up, restore original functionality (zipball), include the commandline jar, etc. committing it in this state is that jarbundler's repo is a bit of a mess. The current version (and the version we need) is 3.3.0, the "latest" from 2015. The docs, examples, and the ant build system are all literally bitrotting from version 2.x, and do not work without some fixes. So in other words, I'm committing this in a state that I got to work so that if I screw it up, since I'm flying blind, I'll have a messy but working fallback. Okay, so _why_ use any of this at all? If you create an ACBuild.properties file and run ant, you can get AppleCommander.app to build, but it won't run. It tells you that you need to download Apple's legacy Java 6 which is neither safe nor supported anymore. If you install this, it will still give you an error because the generated code can't run under Java 6. What you're supposed to do now is bundle your JRE with every Java application bundle, which means multiple copies of libs on disk and in memory. Yes, really. Except Oracle keeps changing how you do this with each new JDK generation, and the current way is pretty much totally proprietary so that you're locked in to Oracle's JDK and couldn't use OpenJDK or something if that were an option. That's what universalJavaApplicationStub resolves—it builds an app bundle that uses whatever JDK/JRE you have installed from 6 onwards. And it in turn needs jarbundler or something like it. Except all of the "something like it" solutions are dead or deprecated save the latest release of jarbundler which was modified to support uJAS and then promptly left more or less untouched since. But it "works".
2017-10-30 13:14:13 +00:00
mainclass="com.webcodepro.applecommander.ui.AppleCommander"
bundleid="com.webcodepro.applecommander"
stubfile="${mac.dir}/universalJavaApplicationStub"
icon="${mac.dir}/AppleCommander.icns"
arguments="-swt" startonmainthread="true"
jvmversion="1.6+" useJavaXKey="true" developmentregion="English"
copyright="Copyright 2002-2008 Rob Greene and John B. Matthews.">
<jarfilelist dir="${dist}" files="AppleCommander-${acVersion}.jar" />
<jarfilelist dir="${work}/swt" files="swt.jar" />
</jarbundler>
<zip destfile="${maczip}">
<zipfileset dir="${dist}/AppleCommander.app" prefix="AppleCommander-${acVersion}-mac/AppleCommander.app" />
<zipfileset dir="${dist}" prefix="AppleCommander-${acVersion}-mac/jars">
<include name="AppleCommander-${acVersion}*.jar" />
</zipfileset>
</zip>
</target>
2003-03-16 05:27:04 +00:00
<target name="sourceZip" depends="init" description="Build source ZIP archive">
2004-06-18 05:13:45 +00:00
<zip zipfile="${srczip}">
2003-03-16 05:27:04 +00:00
<zipfileset dir=".">
<include name="ECLIPSE-CONFIG"/>
<include name="HEADER"/>
<include name="LICENSE"/>
<include name="NATIVE-COMPILE"/>
<include name="TODO"/>
<include name="VERSIONS"/>
</zipfileset>
<zipfileset dir="${source}" prefix="${source}">
<include name="**/*.java"/>
<include name="**/*.dump"/>
<include name="**/*.properties"/>
<include name="**/*.gif"/>
</zipfileset>
2004-06-18 05:13:45 +00:00
<zipfileset dir="${testsrc}" prefix="${testsrc}">
<include name="**/*.java"/>
<include name="**/*.dump"/>
<include name="**/*.properties"/>
<include name="**/*.gif"/>
</zipfileset>
2003-03-16 05:27:04 +00:00
<zipfileset dir="${build}" prefix="${build}"/>
<zipfileset dir="${doc}" prefix="${doc}">
<include name="**/*.txt"/>
</zipfileset>
<zipfileset dir="${web}" prefix="${web}">
<include name="**/*.html"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
</zipfileset>
</zip>
</target>
2004-06-18 05:13:45 +00:00
<target name="javadoc" depends="init" description="Build javadoc">
<javadoc destdir="${javadoc}" author="true" windowtitle="AppleCommander ${acVersion} JavaDoc"
classpath="${swtjar};${junitjar}">
<fileset dir="${source}">
<exclude name="**/*gif"/>
<exclude name="**/*dump"/>
<exclude name="**/*properties"/>
</fileset>
<fileset dir="${testsrc}">
<exclude name="**/*properties"/>
</fileset>
2004-06-18 05:13:45 +00:00
</javadoc>
</target>
<target name="websiteZip" depends="javadoc" description="Build website ZIP archive">
<zip zipfile="${webzip}">
<zipfileset dir="${web}">
2004-06-18 05:13:45 +00:00
<include name="**/*.html"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
</zipfileset>
<zipfileset dir="${javadoc}" prefix="javadoc"/>
2004-06-18 05:13:45 +00:00
</zip>
</target>
</project>