Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

376 lines (340 sloc) 14.673 kb
<project name="ReplicatorG" basedir="." default="help">
<!-- Project name -->
<property name="project" value="replicatorg" />
<!-- Set the platform property based on the current environment -->
<condition property="platform" value="macosx">
<os family="mac" />
</condition>
<condition property="platform" value="windows">
<os family="windows" />
</condition>
<condition property="platform" value="linux">
<os family="unix" />
</condition>
<!-- Load the per-platform properties -->
<property file="ant.includes/${os.name}-${os.arch}.properties" />
<echo>${os.name}-${os.arch}</echo>
<property name="src.dir" value="src" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="jar.dir" value="${build.dir}/jar" />
<property name="resources.dir" value="resources" />
<property name="shared.dir" value="${build.dir}/shared" />
<property name="lib.dir" value="${shared.dir}/lib" />
<property name="ant.build.javac.target" value="1.5" />
<property name="test.src.dir" value="test/src" />
<property name="release.name" value="${project}-${replicatorg.version}" />
<property name="protocols.dir" value="${src.dir}/fabman/messages" />
<path id="classpath">
<!-- include jarbundler -->
<fileset dir="build/macosx" includes="*.jar" />
<fileset dir="${lib.dir}" includes="*.jar" />
<pathelement path="/System/Library/Java" />
</path>
<path id="test.cp">
<path refid="classpath" />
<pathelement path="test/lib/testng.jar" />
<pathelement path="${classes.dir}" />
</path>
<target name="protoc">
<exec executable="protoc" failonerror="true">
<arg value="--java_out=${src.dir}" />
<arg value="--proto_path=${protocols.dir}" />
<arg value="${protocols.dir}/connection.proto" />
<arg value="${protocols.dir}/coordinator.proto" />
</exec>
</target>
<target name="clean">
<delete dir="${classes.dir}" />
<delete dir="${jar.dir}" />
<delete dir="dist" />
</target>
<target name="compile">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" debug="true" debuglevel="lines,vars,source" source="1.5" includeAntRuntime="false">
<!-- Uncomment to aid in Java debugging
<compilerarg value="-Xlint:deprecation" />
<compilerarg value="-Xlint:unchecked" />
-->
</javac>
</target>
<target name="compile-tests">
<mkdir dir="${classes.dir}" />
<javac srcdir="${test.src.dir}" destdir="${classes.dir}" classpathref="test.cp" debug="true" debuglevel="lines,vars,source" source="1.5">
<!-- Uncomment to aid in Java debugging
<compilerarg value="-Xlint:deprecation" />
<compilerarg value="-Xlint:unchecked" />
-->
</javac>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}" />
<copy todir="${classes.dir}">
<fileset dir="${resources.dir}" />
</copy>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="replicatorg.app.Base">
<!-- jvm="/usr/lib/jvm/java-1.5.0-sun/bin/java" -->
<jvmarg value="-ea" />
<jvmarg value="-Xmx2g" />
<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
<jvmarg value="${native.java.flags}" />
<classpath>
<path refid="classpath" />
<pathelement location="${jar.dir}/${ant.project.name}.jar" />
</classpath>
<sysproperty key="java.library.path" path="${native.lib.dir}" />
<sysproperty key="replicatorg.app-resources" path="${lib.dir}" />
<sysproperty key="replicatorg.toolpath" path="${native.tools.dir}" />
<arg line="${run.arguments}" />
</java>
</target>
<target name="run-clean" depends="jar">
<delete dir="${user.home}/.replicatorg/temp" />
<java fork="true" classname="replicatorg.app.Base">
<!-- jvm="/usr/lib/jvm/java-1.5.0-sun/bin/java" -->
<jvmarg value="-ea" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
<jvmarg value="${native.java.flags}" />
<arg value="--alternate-prefs" />
<arg value="temp" />
<arg value="--clean-prefs" />
<classpath>
<path refid="classpath" />
<pathelement location="${jar.dir}/${ant.project.name}.jar" />
</classpath>
<sysproperty key="java.library.path" path="${native.lib.dir}" />
<sysproperty key="replicatorg.app-resources" path="${lib.dir}" />
<sysproperty key="replicatorg.toolpath" path="${native.tools.dir}" />
</java>
</target>
<target name="run-non-clean" depends="jar">
<java fork="true" classname="replicatorg.app.Base">
<!-- jvm="/usr/lib/jvm/java-1.5.0-sun/bin/java" -->
<jvmarg value="-ea" />
<jvmarg value="-Xmx512m" />
<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
<jvmarg value="${native.java.flags}" />
<arg value="--alternate-prefs" />
<arg value="temp" />
<classpath>
<path refid="classpath" />
<pathelement location="${jar.dir}/${ant.project.name}.jar" />
</classpath>
<sysproperty key="java.library.path" path="${native.lib.dir}" />
<sysproperty key="replicatorg.app-resources" path="${lib.dir}" />
<sysproperty key="replicatorg.toolpath" path="${native.tools.dir}" />
</java>
</target>
<!--
<taskdef name="testng" classpath="test/lib/testng.jar" classname="org.testng.TestNGAntTask" />
<target name="test" depends="jar,compile-tests">
<testng classpathref="test.cp" suiteName="" testName="">
<sysproperty key="java.library.path" path="${native.lib.dir}"/>
<sysproperty key="replicatorg.app-resources" path="${lib.dir}"/>
<sysproperty key="replicatorg.toolpath" path="${native.tools.dir}"/>
<env key="TEST_DESCRIPTORS" value="test/resources/descriptors"/>
<classfileset dir="${classes.dir}" includes="testing/**/*.class" />
</testng>
</target>
-->
<target name="debug" depends="compile">
<java fork="true" classname="replicatorg.app.Base">
<jvmarg value="-ea" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" />
<classpath>
<path refid="classpath" />
<pathelement location="${classes.dir}" />
</classpath>
<sysproperty key="java.library.path" path="${native.lib.dir}" />
<sysproperty key="replicatorg.app-resources" path="${lib.dir}" />
</java>
</target>
<target name="dist-macosx" depends="jar" description="Builds OS X ReplicatorG distribution">
<property name="target.dir" value="dist/macosx/${release.name}" />
<property name="dist.dir" value="build/macosx/dist" />
<property name="reso.dir" value="dist/macosx/${release.name}/ReplicatorG.app/Contents/Resources" />
<taskdef name="jarbundler" classname="net.sourceforge.jarbundler.JarBundler" />
<antcall target="dist-common-plain" />
<jarbundler dir="${target.dir}" name="ReplicatorG" bundleid="org.replicatorg.app" mainclass="replicatorg.app.Base" icon="${dist.dir}/replicatorg.icns" extraclasspath="/System/Library/Java" vmoptions="-d32 -ea -Xmx2G" infostring="ReplicatorG ${replicatorg.version}, © 2009-${current.year} MakerBot Industries" version="${replicatorg.version}" jvmversion="1.5+" stubfile="${dist.dir}/ReplicatorG">
<jarfileset dir="${jar.dir}" includes="ReplicatorG.jar" />
<jarfileset dir="${lib.dir}" includes="*.jar" />
<jarfileset dir="${dist.dir}" includes="*.jnilib" />
<documenttype name="CNC GCode document" extensions="gcode" iconFile="${dist.dir}/replicatorg.icns" role="Editor" />
<documenttype name="CNC GCode document" extensions="g" iconFile="${dist.dir}/replicatorg.icns" role="Editor" />
<documenttype name="STL 3D model" extensions="stl" iconFile="${dist.dir}/replicatorg.icns" role="Editor" />
<resourcefileset dir="${lib.dir}" includes="*.gif" />
<javaproperty name="replicatorg.app-resources" value="$APP_PACKAGE/Contents/Resources" />
<javaproperty name="apple.laf.useScreenMenuBar" value="true" />
</jarbundler>
<copy todir="${reso.dir}">
<fileset dir="${dist.dir}" includes="drivers/*.dmg" />
</copy>
<copy todir="${reso.dir}/tools">
<filelist dir="${dist.dir}/tools" files="avrdude,avrdude.conf" />
</copy>
<copy todir="${reso.dir}">
<filelist dir="." files="license.txt,readme.txt,todo.txt,contributors.txt" />
</copy>
<copy todir="${reso.dir}/skein_engines">
<fileset dir="skein_engines" excludes="*.pyc" />
</copy>
<copy todir="${reso.dir}/machines">
<fileset dir="machines" />
</copy>
<copy todir="${reso.dir}/examples">
<fileset dir="examples" />
</copy>
<copy todir="${reso.dir}/scripts">
<fileset dir="scripts" />
</copy>
<copy todir="${reso.dir}/docs">
<fileset dir="docs/" excludes="HOWTO-add-new-skeinforge.txt,overview.odg" />
</copy>
<!-- delete the copies in the base dir, to make installer build easier -->
<delete dir="${target.dir}/docs" />
<delete dir="${target.dir}/examples" />
<delete dir="${target.dir}/machines" />
<delete dir="${target.dir}/scripts" />
<delete dir="${target.dir}/skein_engines" />
<delete file="${target.dir}/todo.txt" />
<delete file="${target.dir}/contributors.txt" />
<delete file="${target.dir}/readme.txt" />
<delete file="${target.dir}/license.txt" />
<chmod file="${reso.dir}/tools/avrdude" perm="ugo+rx" />
<!-- This process is now done manually and the resulting file is checked in to allow for the package to be build on other OS'es.
<exec dir="." os="Mac OS X" executable="/usr/bin/lipo">
<arg value="-remove"/>
<arg value="x86_64"/>
<arg value="${target.dir}/ReplicatorG.app/Contents/MacOS/ReplicatorG"/>
<arg value="-output"/>
<arg value="${target.dir}/ReplicatorG.app/Contents/MacOS/ReplicatorG"/>
</exec> -->
<condition property="macosx">
<os family="mac" />
</condition>
<antcall target="dist-macosx-zip" />
<antcall target="dist-macosx-dmg" />
</target>
<target name="dist-macosx-zip" unless="macosx">
<zip destfile="dist/${release.name}-mac.zip" update="false">
<zipfileset dir="dist/macosx/${release.name}" prefix="${release.name}">
<exclude name="tools/avrdude" />
<exclude name="ReplicatorG.app/Contents/MacOS/ReplicatorG" />
</zipfileset>
<zipfileset dir="dist/macosx/${release.name}" prefix="${release.name}" filemode="755">
<include name="tools/avrdude" />
<include name="ReplicatorG.app/Contents/MacOS/ReplicatorG" />
</zipfileset>
</zip>
</target>
<target name="dist-macosx-dmg" if="macosx">
<exec dir="." os="Mac OS X" executable="/bin/sh">
<arg value="-c" />
<arg value="${dist.dir}/mkdmg.sh ./dist ../${target.dir} image ${release.name}-mac" />
</exec>
</target>
<target name="dist-common-plain" depends="jar" description="Copies plaintext files common to all ReplicatorG distributions.">
<echo message="Preparing replicatorG. Version: ${replicatorg.version}" />
<mkdir dir="${target.dir}" />
<copy todir="${target.dir}">
<filelist dir="." files="license.txt,readme.txt,todo.txt,contributors.txt" />
</copy>
<copy todir="${target.dir}/skein_engines">
<fileset dir="skein_engines" excludes="*.pyc" />
</copy>
<copy todir="${target.dir}/machines">
<fileset dir="machines" />
</copy>
<copy todir="${target.dir}/examples">
<fileset dir="examples" />
</copy>
<copy todir="${target.dir}/scripts">
<fileset dir="scripts" />
</copy>
<copy todir="${target.dir}/docs">
<fileset dir="docs/" excludes="HOWTO-add-new-skeinforge.txt,overview.odg" />
</copy>
</target>
<target name="cache-local-docs" description="Downloads the ReplicatorG documentation on replicat.org (and other websites?)">
<exec executable="wget">
<arg value="-r" />
<arg value="-k" />
<arg value="--directory-prefix=./docs" />
<arg value="--timestamping" />
<arg value="replicat.org" />
</exec>
</target>
<target name="dist-common" description="Builds files common to all ReplicatorG distributions, excepting jarbundler-based distros.">
<antcall target="dist-common-plain" />
<copy todir="${target.dir}">
<fileset dir="${build.dir}/shared" includes="lib/*.jar" />
</copy>
<copy todir="${target.dir}/lib">
<fileset dir="${lib.dir}" includes="*.gif" />
<filelist dir="${lib.dir}" files="keywords.txt" />
<fileset dir="${jar.dir}" includes="*.jar" />
</copy>
</target>
<target name="dist-linux" depends="jar" description="Builds Linux ReplicatorG distribution">
<property name="target.dir" value="dist/linux/${release.name}" />
<property name="dist.dir" value="build/linux/dist" />
<!-- standard files -->
<antcall target="dist-common" />
<!-- platform-specific files -->
<copy todir="${target.dir}">
<filelist dir="${dist.dir}" files="replicatorg" />
</copy>
<copy todir="${target.dir}/tools">
<filelist dir="${dist.dir}/tools" files="avrdude,avrdude.conf" />
</copy>
<copy todir="${target.dir}/lib-i686">
<fileset dir="${dist.dir}/lib-i686" includes="*.so" />
</copy>
<copy todir="${target.dir}/lib-x86_64">
<fileset dir="${dist.dir}/lib-x86_64" includes="*.so" />
</copy>
<!-- permissions -->
<chmod file="${target.dir}/replicatorg" perm="ugo+rx" />
<chmod file="${target.dir}/tools/avrdude" perm="ugo+rx" />
<tar destfile="dist/${release.name}-linux.tgz" compression="gzip" longfile="gnu">
<tarfileset dir="dist/linux/${release.name}" prefix="${release.name}" />
<tarfileset dir="dist/linux/${release.name}" prefix="${release.name}" filemode="755">
<include name="replicatorg" />
<include name="tools/avrdude" />
</tarfileset>
</tar>
</target>
<target name="dist-windows" depends="jar" description="Builds Windows ReplicatorG distribution">
<property name="target.dir" value="dist/windows/${release.name}" />
<property name="dist.dir" value="build/windows/dist" />
<!-- standard files -->
<antcall target="dist-common" />
<!-- platform-specific files -->
<copy todir="${target.dir}">
<fileset dir="${dist.dir}" includes="*.dll" />
<filelist dir="${dist.dir}" files="ReplicatorG.exe,ReplicatorG-large-models.exe" />
<fileset dir="${dist.dir}" includes="drivers/**/*" />
<fileset dir="${dist.dir}" includes="java/**/*" />
</copy>
<copy todir="${target.dir}/tools">
<fileset dir="${dist.dir}/tools" />
</copy>
<zip destfile="dist/${project}-${replicatorg.version}-windows.zip" basedir="${target.dir}/..">
</zip>
</target>
<target name="dist" depends="dist-linux,dist-macosx,dist-windows" description="Builds all ReplicatorG distributions">
</target>
<!-- Help -->
<target name="help" description="Targets for this project">
<echo message="Targets for this project" />
<exec executable="ant">
<arg value="-p" />
</exec>
<antcall target="test" />
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.