ModularPowersuits/build.xml
2013-02-15 12:37:37 -07:00

263 lines
No EOL
11 KiB
XML

<project name="ModularPowersuits" default="install" basedir=".">
<property environment="env" />
<!-- Versions -->
<property name="build.ver" value="0.2.1" />
<property name="fullversion" value="${build.ver}-${env.BUILD_NUMBER}" />
<property name="mcp.version" value="723" />
<property name="forgebuild" value="524" />
<property name="forge.version" value="1.4.7-6.6.1.524" />
<property name="ic2api.version" value="1.115.218-lf" />
<property name="ueapi.version" value="1.2.5.337" />
<property name="icbmapi.version" value="1.0.4.140" />
<property name="thermexapi.version" value="2.2.1" />
<!-- Directories -->
<property name="download.dir" value="downloads" />
<property name="ue.download.dir" value="${download.dir}/ue/minecraft/universalelectricity" />
<property name="src.dir" value="src" />
<property name="lib.dir" value="${src.dir}/lib" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/packaging" />
<property name="forge.dir" value="${build.dir}/forge" />
<property name="dist.dir" value="${build.dir}/dist" />
<property name="mcp.dir" value="${forge.dir}/mcp" />
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft" />
<property name="resources.dir" value="resources/machinemuse" />
<!-- URLs -->
<property name="forge.url" value="http://files.minecraftforge.net/minecraftforge/minecraftforge-src-${forge.version}.zip" />
<!-- Name -->
<property name="package.meta-inf" value="META-INF" />
<!-- Version Checking -->
<property file="${forge.dir}/forgeversion.properties" />
<condition property="forge.already.installed">
<equals arg1="${forge.build.number}" arg2="${forgebuild}" />
</condition>
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip" />
<available property="already-compiled" file="${classes.dir}/net/machinemuse" />
<mkdir dir="${download.dir}" />
<mkdir dir="${build.dir}" />
<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>
<condition property="have-apis">
<and>
<available file="${download.dir}/industrialcraft-2-api_${ic2api.version}.zip" />
<available file="${download.dir}/UniversalElectricity_v${ueapi.version}_api.zip" />
<available file="${download.dir}/ICBM_v${icbmapi.version}_api.zip" />
<available file="${download.dir}/ThermalExpansion-API-${thermexapi.version}.zip" />
</and>
</condition>
<target name="download-apis" unless="${have-apis}">
<echo message="Downloading IC2 API... " />
<get src="http://machinemuse.net/industrialcraft-2-api_${ic2api.version}.zip" dest="${download.dir}/industrialcraft-2-api_${ic2api.version}.zip" />
<echo message="Downloading Universal Electricity API..." />
<get src="http://machinemuse.net/UniversalElectricity_v${ueapi.version}_api.zip" dest="${download.dir}/UniversalElectricity_v${ueapi.version}_api.zip" />
<echo message="Downloading ICBM API..." />
<get src="http://machinemuse.net/ICBM_v${icbmapi.version}_api.zip" dest="${download.dir}/ICBM_v${icbmapi.version}_api.zip" />
<echo message="Downloading ThermEx API..." />
<get src="http://machinemuse.net/ThermalExpansion-API-${thermexapi.version}.zip" dest="${download.dir}/ThermalExpansion-API-${thermexapi.version}.zip" />
</target>
<!-- Dependencies -->
<target name="extract-apis" depends="setup-forge,download-apis">
<echo message="Extracting IC2 API... " />
<unzip src="${download.dir}/industrialcraft-2-api_${ic2api.version}.zip" dest="${download.dir}" />
<mkdir dir="${mcpsrc.dir}/ic2" />
<mkdir dir="${mcpsrc.dir}/ic2/api" />
<move file="${download.dir}/ic2/api/Ic2Recipes.java" todir="${mcpsrc.dir}/ic2/api/" />
<move file="${download.dir}/ic2/api/ICustomElectricItem.java" todir="${mcpsrc.dir}/ic2/api/" />
<move file="${download.dir}/ic2/api/IElectricItem.java" todir="${mcpsrc.dir}/ic2/api/" />
<move file="${download.dir}/ic2/api/Items.java" todir="${mcpsrc.dir}/ic2/api/" />
<delete dir="${download.dir}/ic2" />
<echo message="Extracting UE API... " />
<mkdir dir="${download.dir}/ue" />
<unzip src="${download.dir}/UniversalElectricity_v${ueapi.version}_api.zip" dest="${download.dir}/ue" />
<mkdir dir="${mcpsrc.dir}/universalelectricity" />
<mkdir dir="${mcpsrc.dir}/universalelectricity/core" />
<mkdir dir="${mcpsrc.dir}/universalelectricity/core/electricity" />
<move file="${ue.download.dir}/core/electricity/ElectricInfo.java" todir="${mcpsrc.dir}/universalelectricity/core/electricity/ElectricInfo.java" />
<mkdir dir="${mcpsrc.dir}/universalelectricity/core/implement" />
<move file="${ue.download.dir}/core/implement/IItemElectric.java" todir="${mcpsrc.dir}/universalelectricity/core/implement/IItemElectric.java" />
<move file="${ue.download.dir}/core/implement/IJouleStorage.java" todir="${mcpsrc.dir}/universalelectricity/core/implement/IJouleStorage.java" />
<move file="${ue.download.dir}/core/implement/IVoltage.java" todir="${mcpsrc.dir}/universalelectricity/core/implement/IVoltage.java" />
<mkdir dir="${mcpsrc.dir}/universalelectricity/prefab" />
<move file="${ue.download.dir}/prefab/UEDamageSource.java" todir="${mcpsrc.dir}/universalelectricity/prefab/UEDamageSource.java" />
<mkdir dir="${mcpsrc.dir}/universalelectricity/prefab/potion" />
<move file="${ue.download.dir}/prefab/potion/CustomPotion.java" todir="${mcpsrc.dir}/universalelectricity/prefab/potion/CustomPotion.java" />
<move file="${ue.download.dir}/prefab/potion/CustomPotionEffect.java" todir="${mcpsrc.dir}/universalelectricity/prefab/potion/CustomPotionEffect.java" />
<echo message="Extracting ICBM API... " />
<unzip src="${download.dir}/ICBM_v1.0.4.135_api.zip" dest="${download.dir}/ue" />
<mkdir dir="${mcpsrc.dir}/icbm" />
<mkdir dir="${mcpsrc.dir}/icbm/api" />
<move file="${download.dir}/ue/minecraft/icbm/api/IExplosive.java" todir="${mcpsrc.dir}/icbm/api/IExplosive.java" />
<move file="${download.dir}/ue/minecraft/icbm/api/IEMPItem.java" todir="${mcpsrc.dir}/icbm/api/IEMPItem.java" />
<echo message="Extracting ThermalExpansion API... " />
<unzip src="${download.dir}/ThermalExpansion-API-${thermexapi.version}.zip" dest="${download.dir}" />
<mkdir dir="${mcpsrc.dir}/thermalexpansion" />
<mkdir dir="${mcpsrc.dir}/thermalexpansion/api" />
<mkdir dir="${mcpsrc.dir}/thermalexpansion/api/core" />
<move file="${download.dir}/thermalexpansion/api/core/ItemRegistry.java" todir="${mcpsrc.dir}/thermalexpansion/api/core/ItemRegistry.java" />
<move file="${download.dir}/thermalexpansion/api/core/IChargeableItem.java" todir="${mcpsrc.dir}/thermalexpansion/api/core/IChargeableItem.java" />
<delete dir="${download.dir}/thermalexpansion" />
</target>
<target name="install" depends="build">
<jar destfile="${dist.dir}/ModularPowersuits-${fullversion}.jar" basedir="${classes.dir}" />
<delete dir="${classes.dir}" />
</target>
<target name="forgeinstalled.check">
</target>
<target name="build" depends="extract-apis" unless="already-compiled">
<!-- Copy source -->
<copy todir="${mcpsrc.dir}/net/machinemuse">
<fileset dir="${src.dir}/minecraft/net/machinemuse" />
<filterset>
<filter token="MOD_VERSION" value="${fullversion}" />
</filterset>
</copy>
<!-- 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 todir="${classes.dir}">
<fileset dir="${mcp.dir}/reobf/minecraft" />
</copy>
<mkdir dir="${classes.dir}/resources" />
<mkdir dir="${classes.dir}/resources/machinemuse" />
<copy todir="${classes.dir}/resources/machinemuse">
<fileset dir="${resources.dir}" />
</copy>
<copy todir="${classes.dir}" file="mcmod.info">
<filterset>
<filter token="MOD_VERSION" value="${fullversion}" />
</filterset>
</copy>
</target>
<target name="setup-forge" depends="download-forge" unless="forge.already.installed">
<unzip dest="${build.dir}">
<fileset dir="${download.dir}">
<include name="minecraftforge-src-${forge.version}.zip" />
</fileset>
</unzip>
<!-- Change executables' permitions -->
<chmod file="${forge.dir}/install.sh" perm="+x" />
<!-- if your building on OSX these 2 should be executable -->
<!-- Install forge -->
<delete dir="${mcp.dir}" failonerror="no" />
<exec dir="${forge.dir}" executable="cmd" osfamily="windows" inputstring="Yes\n">
<arg line="/c install.cmd" />
</exec>
<exec dir="${forge.dir}" executable="sh" osfamily="unix" inputstring="Yes\n">
<arg value="install.sh" />
</exec>
<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="${mcp.dir}/runtime/bin/astyle-osx" perm="+x" />
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" />
<mkdir dir="${mcpsrc.dir}/net/machinemuse" />
<!-- Copy libraries
<copy todir="${mcp.dir}/lib">
<fileset dir="lib">
<patternset includes="*.jar" />
</fileset>
</copy> -->
</target>
<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>
<echo message="Downloading forge... " />
<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>
<target name="download-ant-contrib" unless="should-download-ant-contrib">
<echo message="Getting: ant-contrib" />
<mkdir dir="${download.dir}/tmp" />
<mkdir dir="${download.dir}/ant-contrib/lib" />
<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>
<target name="clean">
<delete dir="${build.dir}" />
</target>
</project>