Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
<?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/"/>
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">
<fileset dir="${build.classes.dir}"/>
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}"/>
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/">
<pathelement location="${basedir}/lib/ant/ant-contrib-0.6.jar"/>
<!-- 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"/>
<!-- 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">
<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" />
<!-- AFFECTS -->
<for list="mirror,blindness,random,micExpand,repeat,displace,colourSwitcher,shapeSwap" param="affect">
<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" />
<!-- 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="**/*"/>
<target name="-post-jar">
<!-- Classpath for the custom tasks -->
<path id="classpath">
<fileset dir="lib/jpf" includes="*.jar" />
<!-- Define custom JPF specific Ant tasks -->
<typedef resource="org/java/plugin/tools/ant/">
<classpath refid="classpath" />
<!-- Call "jpf-zip" task to process plug-ins packaging every plug-in
from the build dir as single ZIP file -->
<!-- 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*"/>-->
<!-- Delete the old modules then copy the new ones to the base directory -->
<fileset dir="${basedir}/modules" includes="*.zip"/>
<copy todir="${basedir}/modules">
<fileset dir="${build.dir}/modules">
<include name="*.zip"/>
<!-- 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" />
<!-- Detect the OS -->
<condition property="mac">
<os family="mac"/>
<condition property="unix">
<os family="unix"/>
<os family="mac"/>
<condition property="windows">
<os family="windows"/>
<!-- Create platform specific executables -->
<antcall target="mac"/>
<antcall target="unix"/>
<antcall target="windows"/>
<target name="mac" if="mac">
<!-- Create the mac .app executable bundle -->
<taskdef name="jarbundler" classname="net.sourceforge.jarbundler.JarBundler" >
<pathelement location="${basedir}/lib/ant/jarbundler-2.0.0.jar"/>
infostring="${version.string}, ${copyright}"
arguments="-Xms256m -Xmx512m">
<!-- Adjust the look, feel and behavior -->
<javaproperty name="apple.laf.useScreenMenuBar" value="true"/>
<property name="mac.bundle" value="${alchemy.dir}/" />
<!-- 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 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/" todir="${alchemy.dir}/lib"/>
<copy file="${basedir}/lib/jpen/" todir="${alchemy.dir}/lib"/>
<copy file="${basedir}/lib/jpen/" 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 name="windows" if="windows">
Create the Windows executable bundle
Launch4j needs to be installed into the Program Files folder
<property name="launch4j.dir" location="C:/Program Files/Launch4j" />
<taskdef name="launch4j"
:${launch4j.dir}/lib/xstream.jar" />
errTitle="Java Install Required"
<!-- 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"
<!-- 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="${}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
<path path="${javac.classpath}"/>
<pathelement location="${basedir}/src/org/alchemy/core"/>
<packageset dir="${basedir}/src/org/alchemy/core" includes="*/**"/>
<fileset dir="${basedir}/src/org/alchemy/core" includes="*.java" excludes=""/>