Developing ImageJ plug-ins using Xcode 3A short guide for configuring projects in Xcode 3 (older versions) I. Create a new project
II. Modifying build.xmlThe default structure of build.xml performs more steps than initially needed to compile a plugin for ImageJ. Only the following phases are essential:
Four directories will be created in the project directory: build, bin, ressources, src.The links to the dist, jars, and lib directories can be removed. An according build.xml file is available here.Only the ImageJ path in the <property name="imagej" location="/Users/../ImageJ"/> tag needs to be modified. <?xml version="1.0" encoding="UTF-8"?> <project name="tutorial" default="javadoc" basedir=".">
<property name="src" location="src"/> <!-- java source folder --> <property name="bin" location="bin"/> <!-- intermediate build products --> <property name="dist" location="dist"/> <!-- build product location --> <property name="javadoc" location="javadoc"/> <!-- javadoc location --> <property name="resources" location="resources"/> <!-- location of additional resources (images etc.) --> <property name="imagej" location="/Users/../ImageJ"/> <!-- ImageJ folder --> <property name="dest" location="${imagej}/plugins/${ant.project.name}"/> <!-- destination folder --> <property name="compile.debug" value="true"/> <!-- References to external libraries --> <path id="lib.path"> <pathelement path="${imagej}/ij.jar"/> </path> <!-- Initialization target, for any prelimary setup needed to build --> <target name="init" description="Preparation"> <mkdir dir="${src}"/> </target> <!-- Compile .java files inside the $src directory --> <target name="compile" depends="init" description="Compile code"> <mkdir dir="${bin}"/> <javac deprecation="on" srcdir="${src}" destdir="${bin}" source="1.5" target="1.5" includeAntRuntime="no" classpathref="lib.path" debug="${compile.debug}"> </javac> </target> <!-- Build JAR file, include resources --> <target name="jar" depends="compile" description="Build jar"> <mkdir dir="${dist}"/> <jar destfile="${dist}/${ant.project.name}_.jar"> <fileset dir="${bin}"/> <zipfileset dir="${resources}" prefix="resources"/> <zipfileset dir="." includes="plugins.config"/> <!-- Required to configure the "Plugins" menu in ImageJ--> </jar> </target> <!-- Copy JAR file to plugins directory --> <target name="installJAR" depends="jar" description="Copy JAR file to plugins directory"> <copy toDir="${imagej}/plugins"> <fileset dir="${dist}"> <include name="*.jar"/> </fileset> </copy> </target>
<!-- Copy class folder to plugins directory --> <target name="installClass" depends="compile" description="Copy classes plugins/project directory"> <mkdir dir="${dest}"/> <copy toDir="${dest}"> <fileset dir="${dist}"> <exclude name="*.jar"/> </fileset> </copy> </target>
<!-- Generate documentation --> <target name="javadoc" depends="installJAR" description="Create Javadoc"> <mkdir dir="${javadoc}"/> <javadoc destdir="${javadoc}" classpathref="lib.path"> <fileset dir="${src}/"> <include name="*.java"/> </fileset> </javadoc> </target> <!-- Directories deleted when cleaning --> <target name="clean" description="Remove build and dist directories"> <delete dir="${bin}"/> <delete dir="${dist}"/> <delete dir="${javadoc}"/> </target> </project> III. ImageJ naming conventions
IV. Selecting the build path
V. Documentation
VI. Example
|