Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
138 lines (104 sloc) 4.31 KB
<!--
+==========================================================================
| Common Code
+==========================================================================
-->
<project name="polydes-common" basedir="." xmlns:if="ant:if" xmlns:unless="ant:unless">
<!-- Set the following properties in build-helper.properties
swjar=path/to/sw.jar
buildpath=path/to/stencylworks/extensions
-->
<include file="tools/ant-helper.xml"/>
<dirname property="common.base" file="${ant.file.polydes-common}"/>
<if>
<not>
<available file="${common.base}/build-helper.properties" />
</not>
<then>
<fail message="No build-helper.properties file found." />
</then>
</if>
<property file="${common.base}/build-helper.properties"/>
<property name="common.src" value="${common.base}/src" />
<property name="common.pkg" value="com/polydes/common" />
<property name="commonjar" value="${buildpath}/com.polydes.common.jar" />
<var name="this.src" value="./src" />
<var name="this.build" value="./build" />
<var name="this.lib" value="./libs" />
<var name="this.pkg" value="${pkg}" />
<set-var-if-unset name="version" value="1.0.0" />
<propertyregex property="extensionID"
input="${pkg}"
regexp="/"
replace="."
global="true" />
<var name="jarname" value="${extensionID}" />
<!--
srcpath and clspath are first set when this script is included.
They can then be set by the caller with <var name=".." value=".." />.
They will be ignored the second time they're evaluated (when <antcall> is used).
-->
<set-var-if-unset name="srcpath" value="${this.src}" />
<set-var-if-unset name="clspath" value="${swjar}:${commonjar}" />
<set-var-if-unset name="usinglibs" value="false" />
<set-var-if-unset name="name" value="My Extension" />
<set-var-if-unset name="description" value="Description" />
<set-var-if-unset name="author" value="Author" />
<set-var-if-unset name="website" value="https://github.com/justin-espedal/polydes" />
<set-var-if-unset name="internalVersion" value="1" />
<set-var-if-unset name="type" value="normal" />
<set-var-if-unset name="repository" value="http://www.polydes.com/repo" />
<path id="compile.libs">
<fileset dir="${this.lib}" includes="*.jar" />
</path>
<!-- Compilation -->
<target name="compile" >
<delete dir="${this.build}" />
<mkdir dir="${this.build}" />
<echo message="Compiling sources -> ${srcpath}" />
<echo message="Using classpath -> ${clspath}" />
<javac source="1.8" target="1.8" srcdir="${srcpath}" destdir="${this.build}" debug="on">
<classpath>
<pathelement path="${clspath}" />
<path refid="compile.libs" if:true="${usinglibs}" />
</classpath>
</javac>
</target>
<!-- Copying resources -->
<target name="copy-resources">
<copy toDir="${this.build}/${this.pkg}/res">
<fileset dir="${this.src}/${this.pkg}/res">
<exclude name="Resources.java" />
</fileset>
</copy>
</target>
<target name="copy-defaults">
<copy toDir="${this.build}/${this.pkg}/defaults">
<fileset dir="${this.src}/${this.pkg}/defaults">
<exclude name="Defaults.java" />
</fileset>
</copy>
</target>
<!-- Jar files -->
<target name="makejar">
<var name="depends" value="com.polydes.common-1.0.1" />
<var name="depends" value="${depends},${dependsOn}" if:set="dependsOn" />
<jar destfile="${buildpath}/${jarname}.jar" basedir="${this.build}">
<manifest>
<attribute name="Extension-ID" value="${extensionID}" />
<attribute name="Extension-Main-Class" value="${main}" />
<attribute name="Extension-Version" value="${version}" />
<attribute name="Extension-Icon" value="${pkg}/res/icon.png" />
<attribute name="Extension-Dependencies" value="${depends}" />
<attribute name="Extension-Type" value="${type}" />
<attribute name="Extension-Name" value="${name}" />
<attribute name="Extension-Description" value="${description}" />
<attribute name="Extension-Author" value="${author}" />
<attribute name="Extension-Website" value="${website}" />
<attribute name="Extension-Repository" value="${repository}" />
<attribute name="Extension-Internal-Version" value="${internalVersion}" />
</manifest>
<zipgroupfileset dir="${this.lib}/" includes="*.jar" if:true="${usinglibs}" />
</jar>
</target>
</project>