Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
385 lines (313 sloc) 15.8 KB
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="Alchemy" default="default" basedir=".">
<description>Builds, tests, and runs the project Alchemy.</description>
<import file="nbproject/build-impl.xml"/>
<import file="nbproject/profiler-build-impl.xml"/>
<!-- Import the resource bundle where the version info is stored -->
<property file="${basedir}/src/org/alchemy/core/AlcResourceBundle.properties"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="Alchemy-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
<target name="-pre-jar">
<!-- Ant config lets us loop -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/lib/ant/ant-contrib-0.6.jar"/>
</classpath>
</taskdef>
<!-- Copy the required libraries into the build file -->
<unjar src="${file.reference.commons-logging.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.itext.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.jpf.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.foxtrot.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.PDFRenderer.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.mime-util.jar}" dest="${build.classes.dir}"/>
<unjar src="${file.reference.jpen-2.jar}" dest="${build.classes.dir}"/>
<!-- Copy the module folder over to be built.-->
<copy todir="${build.dir}/modules">
<fileset dir="${basedir}/modules">
<!-- Leave out the old zip and class files -->
<exclude name="**/*.class"/>
<exclude name="**/*.zip"/>
</fileset>
</copy>
<!-- Copy the module class files over starting with core -->
<copy file="${build.classes.dir}/org/alchemy/core/AlcCore.class" todir="${build.dir}/modules/core/org/alchemy"/>
<!-- CREATES -->
<for list="shapes,typeShapes,inverseShapes,micShapes,medianShapes,speedShapes,xShapes,traceShapes,detachShapes,scrawlShapes,pullShapes,pressureShapes" param="create">
<sequential>
<copy todir="${build.dir}/modules/@{create}/org/alchemy/create">
<!-- Include all files that begin with the module name -->
<fileset dir="${build.classes.dir}/org/alchemy/create/" includes="@{create}*" casesensitive="no" />
</copy>
</sequential>
</for>
<!-- AFFECTS -->
<for list="mirror,blindness,random,micExpand,repeat,displace,colourSwitcher,shapeSwap" param="affect">
<sequential>
<copy todir="${build.dir}/modules/@{affect}/org/alchemy/affect">
<!-- Include all files that begin with the module name -->
<fileset dir="${build.classes.dir}/org/alchemy/affect/" includes="@{affect}*" casesensitive="no" />
</copy>
</sequential>
</for>
<!-- Delete the module class files so they are included as plugins and not in the dist -->
<delete includeemptydirs="true">
<fileset dir="${build.classes.dir}/org/alchemy/affect" includes="**/*"/>
<fileset dir="${build.classes.dir}/org/alchemy/create" includes="**/*"/>
</delete>
</target>
<target name="-post-jar">
<!-- Classpath for the custom tasks -->
<path id="classpath">
<fileset dir="lib/jpf" includes="*.jar" />
</path>
<!-- Define custom JPF specific Ant tasks -->
<typedef resource="org/java/plugin/tools/ant/jpf-tasks.properties">
<classpath refid="classpath" />
</typedef>
<!-- Call "jpf-zip" task to process plug-ins packaging every plug-in
from the build dir as single ZIP file -->
<jpf-zip
basedir="${build.dir}/modules"
includes="*/*.xml"
destdir="${build.dir}/modules"/>
<!-- The Alchemy folder in the dist directory -->
<property name="alchemy.dir" value="${dist.dir}/Alchemy"/>
<!-- Copy all of the modules to the dist/Alchemy/modules dir -->
<copy todir="${alchemy.dir}/modules">
<fileset dir="${build.dir}/modules">
<include name="**/*.zip"/>
<!--<exclude name="**/*core*"/>-->
</fileset>
</copy>
<!-- Delete the old modules then copy the new ones to the base directory -->
<delete>
<fileset dir="${basedir}/modules" includes="*.zip"/>
</delete>
<copy todir="${basedir}/modules">
<fileset dir="${build.dir}/modules">
<include name="*.zip"/>
</fileset>
</copy>
<!-- Delete the lib directory
Required libs are added manually based on the platform -->
<delete dir="${dist.dir}/lib"/>
<!-- Delete the Netbeans README.TXT file -->
<delete file="${dist.dir}/README.TXT"/>
<!-- Copy the manual into the dist directory -->
<copy file="${basedir}/res/Alchemy.pdf" todir="${alchemy.dir}"/>
<copy file="${basedir}/res/COPYING" todir="${alchemy.dir}"/>
<copy file="${basedir}/res/ReadMe.txt" todir="${alchemy.dir}"/>
<!-- Copy the shapes folder into the dist directory -->
<copy todir="${alchemy.dir}/shapes">
<fileset dir="${basedir}/shapes" />
</copy>
<!-- Detect the OS -->
<condition property="mac">
<os family="mac"/>
</condition>
<condition property="unix">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<condition property="windows">
<os family="windows"/>
</condition>
<!-- Create platform specific executables -->
<antcall target="mac"/>
<antcall target="unix"/>
<antcall target="windows"/>
</target>
<!--
======================
MAC
======================
-->
<target name="mac" if="mac">
<!-- Create the mac .app executable bundle -->
<taskdef name="jarbundler" classname="net.sourceforge.jarbundler.JarBundler" >
<classpath>
<pathelement location="${basedir}/lib/ant/jarbundler-2.0.0.jar"/>
</classpath>
</taskdef>
<jarbundler
dir="${alchemy.dir}"
name="${application.title}"
mainclass="${main.class}"
jar="${dist.jar}"
icon="${basedir}/res/Alchemy.icns"
jvmversion="1.5*"
version="${version.numeric}"
infostring="${version.string}, ${copyright}"
arguments="-Xms256m -Xmx512m">
<!-- Adjust the look, feel and behavior -->
<javaproperty name="apple.laf.useScreenMenuBar" value="true"/>
</jarbundler>
<property name="mac.bundle" value="${alchemy.dir}/Alchemy.app/Contents/Resources/Java" />
<!-- Copy the Quaqua libraries for more mac looking interface support -->
<copy file="${file.reference.quaqua.jar}" todir="${mac.bundle}/lib"/>
<copy file="${basedir}/lib/quaqua/libquaqua.jnilib" todir="${mac.bundle}"/>
<copy file="${basedir}/lib/quaqua/libquaqua64.jnilib" todir="${mac.bundle}"/>
<!-- Alchemy Native -->
<copy file="${basedir}/lib/libAlcNative.jnilib" todir="${mac.bundle}"/>
<!-- JPen -->
<copy file="${basedir}/lib/jpen/libjpen-2.jnilib" todir="${mac.bundle}"/>
<!-- Delete the Alchemy Jar file -->
<delete file="${dist.dir}/Alchemy.jar"/>
<!-- Create a Mac .dmg file for distribution.
Create a hidden folder and copy the background image,
then copy the DS_Store file which holds the preferences of how it looks,
finally create the .dmg file using the command line hdiutil
<copy file="${basedir}/res/dmg/Alchemy.png" todir="${alchemy.dir}/.background"/>
<copy file="${basedir}/res/dmg/DS_Store" todir="${alchemy.dir}"/>
<move file="${alchemy.dir}/DS_Store" tofile="${alchemy.dir}/.DS_Store"/>
<exec executable="hdiutil">
<arg line="create -srcfolder ${alchemy.dir} ${dist.dir}/Alchemy-${version.number}.dmg"/>
</exec> -->
</target>
<!--
======================
LINUX
======================
-->
<target name="unix" if="unix">
<!-- LINUX Shell Script to Launch Alchemy -->
<copy file="${basedir}/res/Alchemy" todir="${alchemy.dir}"/>
<!-- Make the shell script executable -->
<chmod file="${alchemy.dir}/Alchemy" perm="+x"/>
<!-- JPen -->
<copy file="${basedir}/lib/jpen/libjpen-2.so" todir="${alchemy.dir}/lib"/>
<copy file="${basedir}/lib/jpen/libjpen-2-ia64.so" todir="${alchemy.dir}/lib"/>
<copy file="${basedir}/lib/jpen/libjpen-2-x86_64.so" todir="${alchemy.dir}/lib"/>
<!-- Move the Jar file -->
<move file="${dist.dir}/Alchemy.jar" tofile="${alchemy.dir}/Alchemy.jar"/>
<!-- Create a .tar.gz for distribution -->
<tar destfile="${dist.dir}/Alchemy-${version.number}.tar" basedir="${dist.dir}"/>
<gzip destfile="${dist.dir}/Alchemy-${version.number}.tar.gz" src="${dist.dir}/Alchemy-${version.number}.tar"/>
<delete file="${dist.dir}/Alchemy-${version.number}.tar" />
</target>
<!--
======================
WINDOWS
======================
-->
<target name="windows" if="windows">
<!--
Create the Windows executable bundle
Launch4j needs to be installed into the Program Files folder
http://launch4j.sourceforge.net/
-->
<property name="launch4j.dir" location="C:/Program Files/Launch4j" />
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar
:${launch4j.dir}/lib/xstream.jar" />
<launch4j>
<config
dontWrapJar="false"
headerType="console"
jarPath="${dist.jar}"
outfile="${alchemy.dir}/Alchemy.exe"
errTitle="Java Install Required"
priority="normal"
downloadUrl="http://java.com/download"
customProcName="true"
stayAlive="false"
icon="${basedir}/res/Alchemy.ico">
<jre
minVersion="1.5.0"
dontUsePrivateJres="false"
initialHeapSize="256"
maxHeapSize="512">
<opt>-Djava.library.path=lib</opt>
</jre>
<versionInfo
fileVersion="${version.numeric}"
txtFileVersion="${version.string}"
productVersion="${version.numeric}"
fileDescription="${application.desc}"
copyright="${copyright}"
txtProductVersion="${version.string}"
productName="${application.title}"
internalName="${application.title}"
originalFilename="Alchemy.exe"
/>
</config>
</launch4j>
<!-- JPen -->
<copy file="${basedir}/lib/jpen/jpen-2.dll" todir="${alchemy.dir}/lib"/>
<!-- Delete the Alchemy Jar file -->
<delete file="${dist.dir}/Alchemy.jar"/>
<!-- Create a .zip for distribution -->
<zip destfile="${dist.dir}/Alchemy-${version.number}.zip"
basedir="${dist.dir}"
/>
</target>
<!-- JAVA DOCS -->
<target name="-javadoc-build" depends="init">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
<classpath>
<path path="${javac.classpath}"/>
</classpath>
<sourcepath>
<pathelement location="${basedir}/src/org/alchemy/core"/>
</sourcepath>
<packageset dir="${basedir}/src/org/alchemy/core" includes="*/**"/>
<fileset dir="${basedir}/src/org/alchemy/core" includes="*.java" excludes="AlcCore.java"/>
</javadoc>
</target>
</project>