65bf678080
Update build.xml
207 lines
6.5 KiB
XML
207 lines
6.5 KiB
XML
<project name="Buildcraft" basedir="../" default="main">
|
|
<property environment="env" />
|
|
<!-- Properties -->
|
|
|
|
<property name="build.dir" value="build"/>
|
|
<property name="src.dir" value="BuildCraft"/>
|
|
<property name="lang.dir" value="BuildCraft-Localization"/>
|
|
|
|
<property name="download.dir" value="download"/>
|
|
<property name="files.minecraft.dir" value="jars"/>
|
|
|
|
<property name="classes.dir" value="${build.dir}/classes"/>
|
|
<property name="jar.dir" value="${build.dir}/dist"/>
|
|
|
|
<property name="mcp.dir" value="${build.dir}/mcp"/>
|
|
<property name="forge.dir" value="${mcp.dir}/forge"/>
|
|
|
|
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft"/>
|
|
|
|
<property name="mcp.version" value="725"/>
|
|
<property name="forge.version" value="1.4.6-6.5.0.467"/>
|
|
<property name="bc.version" value="3.2.3"/>
|
|
|
|
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>
|
|
<condition property="should-download-ant-contrib">
|
|
<or>
|
|
<available file="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
|
|
<available file="${download.dir}/minecraftforge-src-${forge.version}.zip"/>
|
|
</or>
|
|
</condition>
|
|
|
|
|
|
|
|
<mkdir dir="${download.dir}"/>
|
|
|
|
<!-- Targets -->
|
|
|
|
<target name="clean">
|
|
<delete dir="${build.dir}"/>
|
|
</target>
|
|
|
|
<!-- Set build number -->
|
|
<target name="initialize-version" depends="version-provided,version-not-provided">
|
|
<property name="bc.version.full" value="${bc.version}.${build.number}"/>
|
|
<echo message="Starting build for ${bc.version.full}"/>
|
|
</target>
|
|
|
|
<target name="version-not-provided" unless="env.BUILD_NUMBER">
|
|
<buildnumber/>
|
|
</target>
|
|
|
|
<target name="version-provided" if="env.BUILD_NUMBER">
|
|
<property name="build.number" value="${env.BUILD_NUMBER}"/>
|
|
</target>
|
|
|
|
<!-- Download necessary files -->
|
|
<target name="download-files" depends="download-mcp,download-forge"/>
|
|
|
|
<!-- Download ant-contrib, necessary to be able to download forge (only if neither forge zip nor ant-contrib exist) -->
|
|
<target name="download-ant-contrib" unless="should-download-ant-contrib">
|
|
|
|
<echo message="Getting: ant-contrib"/>
|
|
<mkdir dir="${download.dir}/tmp"/>
|
|
|
|
<get src="http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip/download" dest="${download.dir}/tmp/ant-contrib-1.0b3-bin.zip"/>
|
|
<get src="http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.6-bin.zip" dest="${download.dir}/tmp/commons-codec-1.6-bin.zip"/>
|
|
|
|
<unzip src="${download.dir}/tmp/ant-contrib-1.0b3-bin.zip" dest="${download.dir}"/>
|
|
<unzip src="${download.dir}/tmp/commons-codec-1.6-bin.zip" dest="${download.dir}/tmp"/>
|
|
|
|
<move todir="${download.dir}/ant-contrib/lib">
|
|
<fileset file="${download.dir}/tmp/commons-codec-1.6/commons-codec-1.6.jar"/>
|
|
</move>
|
|
|
|
<!-- Delete useless files -->
|
|
<delete dir="${download.dir}/ant-contrib/docs"/>
|
|
<delete dir="${download.dir}/tmp"/>
|
|
|
|
</target>
|
|
|
|
<!-- Download mcp -->
|
|
<target name="download-mcp">
|
|
|
|
<get src="http://mcp.ocean-labs.de/files/mcp${mcp.version}.zip" dest="${download.dir}" usetimestamp="True"/>
|
|
|
|
</target>
|
|
|
|
<!-- Download forge (if it doesn't exist) -->
|
|
<target name="download-forge" depends="download-ant-contrib" unless="forge-exists" >
|
|
|
|
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
|
<classpath>
|
|
<pathelement location="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
|
|
<fileset dir="${download.dir}/ant-contrib/lib">
|
|
<include name="*.jar"/>
|
|
</fileset>
|
|
</classpath>
|
|
</taskdef>
|
|
|
|
<getMethod url="http://files.minecraftforge.net/minecraftforge-src-${forge.version}.zip"
|
|
responseDataFile="${download.dir}/minecraftforge-src-${forge.version}.zip">
|
|
<header name="User-Agent" value="Ant-${ant.version}/${ant.java.version}"/>
|
|
</getMethod>
|
|
|
|
</target>
|
|
|
|
<!-- Setup mcp and forge -->
|
|
<target name="setup" depends="initialize-version">
|
|
|
|
<!-- Unzip them -->
|
|
<unzip dest="${mcp.dir}">
|
|
<fileset dir="${download.dir}">
|
|
<include name="mcp${mcp.version}.zip"/>
|
|
</fileset>
|
|
</unzip>
|
|
|
|
<unzip dest="${mcp.dir}">
|
|
<fileset dir="${download.dir}">
|
|
<include name="minecraftforge-src-${forge.version}.zip"/>
|
|
</fileset>
|
|
</unzip>
|
|
|
|
<!-- Change executables' permitions -->
|
|
<chmod file="${mcp.dir}/updatemd5.sh" perm="+x"/>
|
|
<chmod file="${mcp.dir}/recompile.sh" perm="+x"/>
|
|
<chmod file="${mcp.dir}/reobfuscate.sh" perm="+x"/>
|
|
<chmod file="${forge.dir}/install.sh" perm="+x"/>
|
|
|
|
<!-- if your building on OSX these 2 should be executable -->
|
|
<chmod file="${mcp.dir}/runtime/bin/astyle-osx" perm="+x" />
|
|
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" />
|
|
|
|
<!-- Install forge -->
|
|
<exec dir="${forge.dir}" executable="cmd" osfamily="windows">
|
|
<arg line="/c install.cmd"/>
|
|
</exec>
|
|
|
|
<exec dir="${forge.dir}" executable="sh" osfamily="unix">
|
|
<arg value="install.sh" />
|
|
</exec>
|
|
|
|
<!-- Copy BC source -->
|
|
<copy todir="${mcpsrc.dir}">
|
|
<fileset dir="${src.dir}/common">
|
|
<exclude name="**/buildcraft/devel"/>
|
|
</fileset>
|
|
<filterset>
|
|
<filter token="VERSION" value="${bc.version}" />
|
|
<filter token="BUILD_NUMBER" value="${build.number}" />
|
|
</filterset>
|
|
</copy>
|
|
|
|
</target>
|
|
|
|
<target name="compile" depends="setup">
|
|
|
|
<!-- Recompile -->
|
|
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows" failonerror="true">
|
|
<arg line="/c recompile.bat"/>
|
|
</exec>
|
|
|
|
<exec dir="${mcp.dir}" executable="sh" osfamily="unix" failonerror="true">
|
|
<arg value="recompile.sh" />
|
|
</exec>
|
|
|
|
<!-- Reobf -->
|
|
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
|
|
<arg line="/c reobfuscate.bat"/>
|
|
</exec>
|
|
|
|
<exec dir="${mcp.dir}" executable="sh" osfamily="unix">
|
|
<arg value="reobfuscate.sh" />
|
|
</exec>
|
|
|
|
<!-- Copy BC classes -->
|
|
<copy todir="${classes.dir}">
|
|
<fileset dir="${mcp.dir}/reobf/minecraft"/>
|
|
</copy>
|
|
|
|
<!-- Copy resources -->
|
|
<copy todir="${classes.dir}">
|
|
<fileset dir="${src.dir}/buildcraft_resources">
|
|
<exclude name="build.xml"/>
|
|
<exclude name="build.number"/>
|
|
</fileset>
|
|
</copy>
|
|
|
|
<!-- Copy localizations -->
|
|
<copy todir="${classes.dir}" failonerror="false">
|
|
<fileset dir="${lang.dir}">
|
|
<exclude name="README.md"/>
|
|
</fileset>
|
|
</copy>
|
|
|
|
</target>
|
|
|
|
<!-- Zip the compiled files -->
|
|
<target name="package" depends="compile">
|
|
|
|
<jar destfile="${jar.dir}/buildcraft-A-${bc.version.full}.jar" basedir="${classes.dir}"/>
|
|
|
|
</target>
|
|
|
|
<!-- Default target to run -->
|
|
<target name="main" depends="initialize-version,download-files,clean,package"/>
|
|
|
|
</project>
|