Merge pull request #262 from psxlover/Build.xml

Build.xml
This commit is contained in:
SirSengir 2012-09-14 05:37:57 -07:00
commit 0fa5a9d38e
3 changed files with 194 additions and 112 deletions

View file

@ -12,10 +12,11 @@ features or change existing behaivour, please discuss it with Sengir or Krapht b
1. Ensure that `Apache Ant` (found [here](http://ant.apache.org/)) is installed correctly on your system. 1. Ensure that `Apache Ant` (found [here](http://ant.apache.org/)) is installed correctly on your system.
* Linux users will need the latest version of astyle installed as well. * Linux users will need the latest version of astyle installed as well.
1. Create a base directory for the build 1. Create a base directory for the build
1. Clone the Buildcraft repository into `basedir/src/` 1. Clone the Buildcraft repository into `basedir/BuildCraft/`
* Optional: Copy BuildCraft localization repository into `basedir/BuildCraft-Localization`
1. Copy the minecraft bin dir and minecraft_server.jar into `basedir/jars/` 1. Copy the minecraft bin dir and minecraft_server.jar into `basedir/jars/`
1. Navigate to basedir/src in a shell and run `ant clean package` (this will take 2-5 minutes) 1. Navigate to basedir/Buildcraft in a shell and run `ant` (this will take 2-5 minutes)
1. The compiled and obfuscated jars will be in basedir/build/dist 1. The compiled and obfuscated jar will be in basedir/build/dist
Your directory structure should look like this: Your directory structure should look like this:
*** ***
@ -26,10 +27,12 @@ Your directory structure should look like this:
\- bin \- bin
|- minecraft.jar |- minecraft.jar
|- ... |- ...
\- src \- BuildCraft
|- buildcraft_client |- buildcraft_resources
|- buildcraft_server |- common
|- ... |- ...
\- BuildCraft-Localization
|- lang
*** ***

125
build.xml
View file

@ -1,17 +1,10 @@
<project name="Buildcraft" basedir="../" default="main"> <project name="Buildcraft" basedir="../" default="main">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="contrib/ant-contrib.jar"/>
<pathelement location="contrib/commons-httpclient.jar"/>
<pathelement location="/usr/share/java/ant-contrib.jar"/>
<pathelement location="/usr/share/java/commons-httpclient.jar"/>
</classpath>
</taskdef>
<property environment="env" /> <property environment="env" />
<!-- Properties --> <!-- Properties -->
<property name="build.dir" value="build"/> <property name="build.dir" value="build"/>
<property name="src.dir" value="src"/> <property name="src.dir" value="BuildCraft"/>
<property name="lang.dir" value="BuildCraft-Localization"/>
<property name="download.dir" value="download"/> <property name="download.dir" value="download"/>
<property name="files.minecraft.dir" value="jars"/> <property name="files.minecraft.dir" value="jars"/>
@ -22,14 +15,23 @@
<property name="mcp.dir" value="${build.dir}/mcp"/> <property name="mcp.dir" value="${build.dir}/mcp"/>
<property name="forge.dir" value="${mcp.dir}/forge"/> <property name="forge.dir" value="${mcp.dir}/forge"/>
<property name="clientsrc.dir" value="${mcp.dir}/src/minecraft"/> <property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft"/>
<property name="mcp.version" value="72"/> <property name="mcp.version" value="72"/>
<property name="forge.version" value="4.0.0.232"/> <property name="forge.version" value="4.0.0.232"/>
<property name="bc.version" value="3.1.8"/> <property name="bc.version" value="3.1.8"/>
<property name="bc.version.full" value="${bc.version}.${env.BUILD_NUMBER}"/>
<echo message="Starting build for ${bc.version.full}"/> <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 --> <!-- Targets -->
@ -37,32 +39,93 @@
<delete dir="${build.dir}"/> <delete dir="${build.dir}"/>
</target> </target>
<target name="setup"> <!-- 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>
<mkdir dir="${download.dir}"/> <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://apache.cc.uoc.gr/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"/> <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" <getMethod url="http://files.minecraftforge.net/minecraftforge-src-${forge.version}.zip"
responseDataFile="${download.dir}/minecraftforge-src-${forge.version}.zip"> responseDataFile="${download.dir}/minecraftforge-src-${forge.version}.zip">
<header name="User-Agent" value="Ant-${ant.version}/${ant.java.version}"/> <header name="User-Agent" value="Ant-${ant.version}/${ant.java.version}"/>
</getMethod> </getMethod>
</target>
<!-- Setup mcp and forge -->
<target name="setup" depends="initialize-version">
<!-- Unzip them -->
<unzip dest="${mcp.dir}"> <unzip dest="${mcp.dir}">
<fileset dir="${download.dir}"> <fileset dir="${download.dir}">
<include name="mcp*.zip"/> <include name="mcp${mcp.version}.zip"/>
</fileset> </fileset>
</unzip> </unzip>
<unzip dest="${mcp.dir}"> <unzip dest="${mcp.dir}">
<fileset dir="${download.dir}"> <fileset dir="${download.dir}">
<include name="minecraftforge-src-*.zip"/> <include name="minecraftforge-src-${forge.version}.zip"/>
</fileset> </fileset>
</unzip> </unzip>
<!-- Copy the necessary jars -->
<copy todir="${mcp.dir}/jars"> <copy todir="${mcp.dir}/jars">
<fileset dir="${files.minecraft.dir}"/> <fileset dir="${files.minecraft.dir}"/>
</copy> </copy>
<!-- Change executables' permitions -->
<chmod file="${mcp.dir}/updatemd5.sh" perm="+x"/> <chmod file="${mcp.dir}/updatemd5.sh" perm="+x"/>
<chmod file="${mcp.dir}/recompile.sh" perm="+x"/> <chmod file="${mcp.dir}/recompile.sh" perm="+x"/>
<chmod file="${mcp.dir}/reobfuscate.sh" perm="+x"/> <chmod file="${mcp.dir}/reobfuscate.sh" perm="+x"/>
@ -82,12 +145,13 @@
</exec> </exec>
<!-- Copy BC source --> <!-- Copy BC source -->
<copy todir="${clientsrc.dir}"> <copy todir="${mcpsrc.dir}">
<fileset dir="${src.dir}/common"> <fileset dir="${src.dir}/common">
<exclude name="**/buildcraft/devel"/> <exclude name="**/buildcraft/devel"/>
</fileset> </fileset>
<filterset> <filterset>
<filter token="VERSION" value="${bc.version}" /> <filter token="VERSION" value="${bc.version}" />
<filter token="BUILD_NUMBER" value="${build.number}" />
</filterset> </filterset>
</copy> </copy>
@ -114,23 +178,38 @@
</exec> </exec>
<!-- Copy BC classes --> <!-- Copy BC classes -->
<copy todir="${classes.dir}/client"> <copy todir="${classes.dir}">
<fileset dir="${mcp.dir}/reobf/minecraft"/> <fileset dir="${mcp.dir}/reobf/minecraft"/>
</copy> </copy>
<!-- Copy resoucres --> <!-- Copy resources -->
<copy todir="${classes.dir}/client"> <copy todir="${classes.dir}">
<fileset dir="${src.dir}/buildcraft_resources"/> <fileset dir="${src.dir}/buildcraft_resources">
<exclude name="build.xml"/>
<exclude name="build.number"/>
</fileset>
<filterset>
<filter token="VERSION" value="${bc.version.full}" />
</filterset>
</copy>
<!-- Copy localizations -->
<copy todir="${classes.dir}">
<fileset dir="${lang.dir}">
<exclude name="README.md"/>
</fileset>
</copy> </copy>
</target> </target>
<!-- Zip the compiled files -->
<target name="package" depends="compile"> <target name="package" depends="compile">
<jar destfile="${jar.dir}/buildcraft-A-${bc.version.full}.jar" basedir="${classes.dir}/client"/> <jar destfile="${jar.dir}/buildcraft-A-${bc.version.full}.jar" basedir="${classes.dir}"/>
</target> </target>
<target name="main" depends="clean,package"/> <!-- Default target to run -->
<target name="main" depends="initialize-version,download-files,clean,package"/>
</project> </project>

View file

@ -3,7 +3,7 @@
"modid": "BuildCraft|Core", "modid": "BuildCraft|Core",
"name": "BuildCraft", "name": "BuildCraft",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more!", "description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more!",
"version": "", "version": "@VERSION@",
"credits": "Created by SpaceToad", "credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png", "logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "", "mcversion": "",
@ -20,7 +20,7 @@
"modid": "BuildCraft|Builders", "modid": "BuildCraft|Builders",
"name": "BC Builders", "name": "BC Builders",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Builders Component)", "description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Builders Component)",
"version": "", "version": "@VERSION@",
"credits": "Created by SpaceToad", "credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png", "logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "", "mcversion": "",
@ -37,7 +37,7 @@
"modid": "BuildCraft|Energy", "modid": "BuildCraft|Energy",
"name": "BC Energy", "name": "BC Energy",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Energy Component)", "description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Energy Component)",
"version": "", "version": "@VERSION@",
"credits": "Created by SpaceToad", "credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png", "logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "", "mcversion": "",
@ -54,7 +54,7 @@
"modid": "BuildCraft|Factory", "modid": "BuildCraft|Factory",
"name": "BC Factory", "name": "BC Factory",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Factory Component)", "description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Factory Component)",
"version": "", "version": "@VERSION@",
"credits": "Created by SpaceToad", "credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png", "logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "", "mcversion": "",
@ -71,7 +71,7 @@
"modid": "BuildCraft|Silicon", "modid": "BuildCraft|Silicon",
"name": "BC Silicon", "name": "BC Silicon",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Silicon Component)", "description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Silicon Component)",
"version": "", "version": "@VERSION@",
"credits": "Created by SpaceToad", "credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png", "logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "", "mcversion": "",
@ -88,7 +88,7 @@
"modid": "BuildCraft|Transport", "modid": "BuildCraft|Transport",
"name": "BC Transport", "name": "BC Transport",
"description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Transport Component)", "description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Transport Component)",
"version": "", "version": "@VERSION@",
"credits": "Created by SpaceToad", "credits": "Created by SpaceToad",
"logoFile": "/gfx/buildcraft/logo.png", "logoFile": "/gfx/buildcraft/logo.png",
"mcversion": "", "mcversion": "",