2013-01-04 03:01:05 +01:00
|
|
|
<project name="BuildCraft" default="main">
|
|
|
|
<property environment="env"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
<!-- Properties -->
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<property name="build.dir" value="build"/>
|
|
|
|
<property name="src.dir" value="."/>
|
|
|
|
<property name="lang.dir" value="../buildcraft.localization"/>
|
|
|
|
<property name="resources.dir" value="buildcraft_resources"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<property name="download.dir" value="download"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<property name="classes.dir" value="${build.dir}/classes"/>
|
|
|
|
<property name="jar.dir" value="bin"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<property name="forge.dir" value="${build.dir}/forge"/>
|
|
|
|
<property name="mcp.dir" value="${forge.dir}/mcp"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<property name="mcpsrc.dir" value="${mcp.dir}/src"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<property name="mc.version" value="1.4.7"/>
|
2013-01-27 01:00:23 +01:00
|
|
|
<property name="forge.version" value="6.6.0.515"/>
|
|
|
|
<property name="project.version" value="3.4.1"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<property name="forge.name" value="minecraftforge-src-${mc.version}-${forge.version}.zip"/>
|
|
|
|
|
|
|
|
<available property="forge-exists" file="${download.dir}/${forge.name}"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<condition property="out-of-date">
|
|
|
|
<not>
|
|
|
|
<and>
|
|
|
|
<available file="${download.dir}/${forge.name}"/>
|
|
|
|
<available file="${mcpsrc.dir}"/>
|
|
|
|
</and>
|
|
|
|
</not>
|
|
|
|
</condition>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
|
|
|
<mkdir dir="${download.dir}"/>
|
|
|
|
|
|
|
|
<!-- Targets -->
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<!-- Clear build directory -->
|
2012-10-25 03:57:31 +02:00
|
|
|
<target name="clean">
|
|
|
|
<delete dir="${build.dir}"/>
|
|
|
|
</target>
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<!-- Set full version -->
|
2012-10-25 03:57:31 +02:00
|
|
|
<target name="initialize-version" depends="version-provided,version-not-provided">
|
2013-01-04 03:01:05 +01:00
|
|
|
<property name="project.version.full" value="${project.version}.${build.number}"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
</target>
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<!-- Set unknown build number -->
|
2012-10-25 03:57:31 +02:00
|
|
|
<target name="version-not-provided" unless="env.BUILD_NUMBER">
|
2013-01-04 03:01:05 +01:00
|
|
|
<property name="build.number" value="unknown"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
</target>
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<!-- Set build number from environment -->
|
2012-10-25 03:57:31 +02:00
|
|
|
<target name="version-provided" if="env.BUILD_NUMBER">
|
|
|
|
<property name="build.number" value="${env.BUILD_NUMBER}"/>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Download necessary files -->
|
2013-01-04 03:01:05 +01:00
|
|
|
<target name="download-files" depends="download-forge"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
|
|
|
<!-- Download forge (if it doesn't exist) -->
|
2013-01-04 03:01:05 +01:00
|
|
|
<target name="download-forge" unless="forge-exists">
|
|
|
|
<get src="http://files.minecraftforge.net/${forge.name}" dest="${download.dir}" usetimestamp="True"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Setup mcp and forge -->
|
2013-01-04 03:01:05 +01:00
|
|
|
<target name="setup" depends="download-files" if="out-of-date">
|
2012-10-25 03:57:31 +02:00
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<delete dir="${forge.dir}" failonerror="false"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<unzip dest="${forge.dir}/.." src="${download.dir}/${forge.name}"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<!-- Fix executable permissions -->
|
|
|
|
<chmod dir="${forge.dir}" perm="ugo+rx" includes="**.sh"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
|
|
|
<!-- Install forge -->
|
|
|
|
<exec dir="${forge.dir}" executable="cmd" osfamily="windows">
|
|
|
|
<arg line="/c install.cmd"/>
|
|
|
|
</exec>
|
|
|
|
|
|
|
|
<exec dir="${forge.dir}" executable="sh" osfamily="unix">
|
2013-01-04 03:01:05 +01:00
|
|
|
<arg value="install.sh"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
</exec>
|
|
|
|
|
|
|
|
</target>
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<target name="compile" depends="initialize-version,setup">
|
|
|
|
|
|
|
|
<delete dir="${classes.dir}"/>
|
|
|
|
<mkdir dir="${classes.dir}"/>
|
|
|
|
|
|
|
|
<!-- Copy sources -->
|
|
|
|
<copy todir="${mcpsrc.dir}/minecraft">
|
|
|
|
<fileset dir="${src.dir}/common"/>
|
2013-01-07 20:16:17 +01:00
|
|
|
<filterset>
|
|
|
|
<filter token="VERSION" value="${project.version.full}" />
|
|
|
|
<filter token="BUILD_NUMBER" value="${build.number}" />
|
|
|
|
</filterset>
|
2013-01-04 03:01:05 +01:00
|
|
|
</copy>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
|
|
|
<!-- Recompile -->
|
2013-01-04 03:01:05 +01:00
|
|
|
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
|
2012-10-25 03:57:31 +02:00
|
|
|
<arg line="/c recompile.bat"/>
|
|
|
|
</exec>
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
|
|
|
|
<arg value="recompile.sh"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
</exec>
|
2013-01-27 11:15:44 +01:00
|
|
|
|
|
|
|
<!-- Check for failure -->
|
|
|
|
<fail message="MCP failed to build">
|
|
|
|
<condition>
|
|
|
|
<resourcecontains resource="${mcp.dir}/logs/client_compile.log" substring="error:"/>
|
|
|
|
</condition>
|
|
|
|
</fail>
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<!-- Reobfuscate -->
|
2012-10-25 03:57:31 +02:00
|
|
|
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
|
|
|
|
<arg line="/c reobfuscate.bat"/>
|
|
|
|
</exec>
|
|
|
|
|
|
|
|
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
|
2013-01-04 03:01:05 +01:00
|
|
|
<arg value="reobfuscate.sh"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
</exec>
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<!-- Copy classes -->
|
2012-10-25 03:57:31 +02:00
|
|
|
<copy todir="${classes.dir}">
|
|
|
|
<fileset dir="${mcp.dir}/reobf/minecraft"/>
|
|
|
|
</copy>
|
|
|
|
|
|
|
|
<!-- Copy resources -->
|
|
|
|
<copy todir="${classes.dir}">
|
2013-01-04 03:01:05 +01:00
|
|
|
<fileset dir="${resources.dir}">
|
2012-10-25 03:57:31 +02:00
|
|
|
<exclude name="build.xml"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
|
|
|
|
<!-- Copy localizations -->
|
2013-01-04 03:01:05 +01:00
|
|
|
<copy todir="${classes.dir}" failonerror="false">
|
|
|
|
<fileset dir="${lang.dir}">
|
|
|
|
<exclude name="README.md"/>
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
|
|
|
|
|
|
|
<!-- Reset src dir to post-forge-install state -->
|
|
|
|
<delete dir="${mcpsrc.dir}/minecraft/buildcraft"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
|
|
|
</target>
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<!-- Package the compiled files -->
|
2012-10-25 03:57:31 +02:00
|
|
|
<target name="package" depends="compile">
|
|
|
|
|
2013-01-04 03:01:05 +01:00
|
|
|
<delete dir="${jar.dir}"/>
|
|
|
|
<mkdir dir="${jar.dir}"/>
|
|
|
|
<jar destfile="${jar.dir}/${ant.project.name}-${mc.version}-${project.version.full}.jar" basedir="${classes.dir}"/>
|
|
|
|
<copy todir="${jar.dir}/changelog">
|
|
|
|
<fileset dir="${resources.dir}/changelog">
|
|
|
|
<include name="*" />
|
|
|
|
</fileset>
|
|
|
|
</copy>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<!-- Default target to run -->
|
2013-01-04 03:01:05 +01:00
|
|
|
<target name="main" depends="package"/>
|
2012-10-25 03:57:31 +02:00
|
|
|
|
|
|
|
</project>
|