Skip to content

Commit

Permalink
Buildfile work.
Browse files Browse the repository at this point in the history
  • Loading branch information
Toberumono committed Oct 17, 2015
1 parent b1bd736 commit 0eef363
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<!--Change this value to true if the project uses external libraries.-->
<!--This cannot be changed from the command line.-->
<property name="use.libs" value="true" />
<!--Change this value to true if the project uses native libraries.-->
<property name="use.nativelibs" value="false" />

<!--Change this value to true if the project is assuming Homebrew was used to install its libraries.-->
<property unless:set="use.hombrew" name="use.homebrew" value="false" />
Expand All @@ -21,6 +23,7 @@
<property unless:set="bin" name="bin" location="bin" />
<property unless:set="doc" name="doc" value="doc" />
<property unless:set="libs" name="libs" value="../" />
<property unless:set="nativelibs" name="nativelibs" value="native libraries" />
<!--The path into which the .jar should be placed-->
<property unless:set="prefix" name="prefix" value="../" />
<!--Whether to force a complete rebuild every run-->
Expand All @@ -44,14 +47,20 @@
</patternset>

<patternset id="Build Excludes">
<exclude name="**/*.css" />
<!--Add the names of files to exclude from the src directory here.-->
<exclude name="testCases/**" />
</patternset>

<patternset id="Debug">
<!--Add the names of debug classes that should be excluded from the packaged jar here.-->
<exclude name="**/testCases/**" />
</patternset>

<target name="javadoc">
<javadoc access="protected" author="true" destdir="${doc}" packagenames="*" source="1.8" splitindex="true" use="true" version="true">
<fileset dir="${src}">
<patternset refid="Build Excludes" />
<patternset refid="Debug" />
</fileset>
<classpath if:true="${use.libs}" refid="build.classpath" />
</javadoc>
Expand All @@ -63,6 +72,10 @@
<patternset refid="Build Excludes" />
<classpath if:true="${use.libs}" refid="build.classpath" />
</javac>
<!--Copy css files to their appropriate locations in the bin directory (for JavaFx)-->
<copy todir="${bin}">
<fileset dir="${src}" includes="**/*.css" />
</copy>
</target>

<target if="${use.homebrew}" name="find.brew">
Expand All @@ -72,47 +85,44 @@
<arg value="-c" />
<arg value="which brew" />
</exec>
<exec unless:set="brew.prefix" executable="${brew.path}" outputproperty="brew.prefix">
<exec unless:set="brew.prefix" searchpath="true" executable="${brew.path}" outputproperty="brew.prefix">
<arg value="--prefix" />
</exec>
<property name="build.libs" location="${brew.prefix}/lib/" />
</target>

<target if="${use.libs}" name="construct.classpath" depends="find.brew">
<echo if:true="${use.homebrew}" level="info" message="Using libraries from homebrew." />
<echo unless:true="${use.homebrew}" level="info" message="Using libraries from ${libs}" />
<property unless:set="build.libs" name="build.libs" location="${libs}" />
<path id="build.classpath">
<fileset id="library" dir="${build.libs}">
<patternset refid="libraries" />
</fileset>
</path>
<pathconvert property="manifest.classpath" pathsep=" ">
<path refid="build.classpath" />
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*.jar" to="${build.libs}/*.jar" />
</chainedmapper>
</mapper>
<path id="build.classpath">
<multirootfileset id="library">
<basedir if:set="brew.prefix" file="${brew.prefix}/lib/" />
<basedir file="${libs}" />
<patternset refid="libraries" />
</multirootfileset>
</path>
<identitymapper />
</pathconvert>
</target>

<target name="create_jar" depends="construct.classpath,clean,javadoc,build">
<jar destfile="${jar}" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="toberumono.wrf.Runner" />
<attribute if:true="${use.libs}" name="Class-Path" value="${manifest.classpath}" />
<attribute unless:true="${use.libs}" name="Class-Path" value="." />
</manifest>
<fileset dir="${bin}" />
<fileset dir="${bin}">
<patternset refid="Build Excludes" />
<patternset refid="Debug" />
</fileset>
<fileset if:true="${package.doc}" dir="." includes="${doc}/**" />
<fileset if:true="${package.nativelibs}" dir="." includes="${nativelibs}/**" />
<fileset if:true="${package.src}" dir="${src}" />
<restrict if:true="${package.libs}">
<name regex=".*\.(class|java)" />
<archives>
<zips>
<fileset refid="library" />
<multirootfileset refid="library" />
</zips>
</archives>
</restrict>
Expand Down

0 comments on commit 0eef363

Please sign in to comment.