ForgePatch/fml/build.xml

334 lines
14 KiB
XML
Raw Normal View History

2012-03-30 20:22:10 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
30 Mar 2012 13:35:40
2012-03-30 20:22:10 +00:00
FML
2012-03-30 20:22:10 +00:00
The Forge Mod Loader
cpw
2012-03-30 20:22:10 +00:00
====================================================================== -->
<project name="FML" default="jenkinsbuild">
2012-03-30 20:22:10 +00:00
<description>The Forge Mod Loader</description>
<macrodef name="side">
<attribute name="prop" />
<attribute name="src" />
<attribute name="side" />
<sequential>
<property name="@{prop}" value="${@{side}.@{src}}" />
<condition property="is.client">
<equals arg1="@{side}" arg2="client" />
</condition>
<condition property="is.server">
<equals arg1="@{side}" arg2="server" />
</condition>
</sequential>
</macrodef>
2012-06-01 04:27:46 +00:00
<target name="writeversion" depends="buildenvsetup">
2012-05-10 17:01:39 +00:00
<exec executable="${python.exe}" dir="${basedir}" failonerror="true">
<arg value="${basedir}/getversion.py" />
<arg value="${mcp.home}" />
2012-05-10 17:01:39 +00:00
</exec>
<propertyfile file="fmlversion.properties">
<entry key="fmlbuild.build.number" type="int" value="${version.build}"/>
</propertyfile>
</target>
2012-06-01 04:27:46 +00:00
<target name="buildenvsetup">
2012-03-30 20:22:10 +00:00
<tstamp>
<format pattern="yyMMddHHmmss" property="timestamp" />
</tstamp>
<property environment="env" />
<property file="fmlbuild.properties" />
<property name="modname" value="fml" />
2012-03-30 20:22:10 +00:00
<condition property="dev.home" value="${env.WORKSPACE}" else="${default.dev.home}">
<isset property="env.WORKSPACE" />
</condition>
<condition property="mcp.home" value="${env.WORKSPACE}/mcpworkspace" else="${default.mcp.home}">
<isset property="env.WORKSPACE" />
</condition>
<condition property="python.exe" value="${mcp.home}/runtime/bin/python/python_mcp" else="python">
<os family="Windows" />
2012-03-30 20:22:10 +00:00
</condition>
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
<property name="server.mcp.obfoutput" location="${mcp.obfoutput}/minecraft_server" />
<property name="mcp.srcdir" location="${mcp.home}/src" />
<property name="client.mcp.srcdir" location="${mcp.srcdir}/minecraft" />
<property name="server.mcp.srcdir" location="${mcp.srcdir}/minecraft_server" />
2012-07-03 12:14:35 +00:00
<property name="clean.mcp.srcdir" location="${mcp.home}/src-base" />
<property name="patch.mcp.srcdir" location="${mcp.home}/src-work" />
<property name="tmp.mcp.srcdir" location="${mcp.home}/src-tmp" />
<property name="renamed.mcp.srcdir" location="${mcp.home}/src-renamed" />
2012-03-30 20:22:10 +00:00
<property name="common.src.dir" location="${basedir}/common" />
<property name="client.src.dir" location="${basedir}/client" />
<property name="server.src.dir" location="${basedir}/server" />
<property name="patch.src.dir" location="${basedir}/patches" />
2012-05-10 17:01:39 +00:00
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
<isset property="env.BUILD_NUMBER" />
</condition>
2012-06-01 04:27:46 +00:00
</target>
<target name="makeversion" depends="buildenvsetup">
2012-05-10 17:01:39 +00:00
<antcall target="writeversion" />
<property file="fmlversion.properties" />
<property name="build.number" value="${fmlbuild.major.number}.${fmlbuild.minor.number}.${fmlbuild.revision.number}" />
<property name="version.major" value="${fmlbuild.major.number}" />
<property name="version.minor" value="${fmlbuild.minor.number}" />
<property name="version.rev" value="${fmlbuild.revision.number}" />
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
2012-03-30 20:22:10 +00:00
</target>
2012-04-04 13:48:36 +00:00
<target name="clean" depends="buildenvsetup">
2012-03-30 20:22:10 +00:00
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
2012-03-30 20:22:10 +00:00
<arg value="-f" />
</exec>
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/decompile.py" />
<arg value="-d" />
<arg value="-n" />
2012-03-30 20:22:10 +00:00
</exec>
</target>
2012-08-02 13:03:29 +00:00
<target name="buildandreobfmcp" depends="buildenvsetup">
2012-03-31 05:04:29 +00:00
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
<arg value="${mcp.home}/runtime/recompile.py" />
2012-03-30 20:22:10 +00:00
</exec>
<fail message="Compilation failed">
<condition>
<not>
<and>
<available file="${mcp.home}/bin/minecraft/net/minecraft/client/Minecraft.class"/>
2012-07-03 12:14:35 +00:00
<available file="${mcp.home}/bin/minecraft_server/net/minecraft/server/MinecraftServer.class"/>
</and>
</not>
</condition>
</fail>
2012-03-30 20:22:10 +00:00
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/reobfuscate.py" />
</exec>
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${basedir}/generatechangedfilelist.py"/>
<arg value="${mcp.home}"/>
<arg value="${basedir}/difflist.txt"/>
2012-03-30 20:22:10 +00:00
</exec>
</target>
<target name="merge-client" depends="buildenvsetup">
2012-03-30 20:22:10 +00:00
<antcall target="merge-source">
<param name="side" value="client" />
</antcall>
</target>
<target name="merge-server" depends="buildenvsetup">
2012-03-30 20:22:10 +00:00
<antcall target="merge-source">
<param name="side" value="server" />
</antcall>
</target>
<target name="merge-source">
<side prop="merge-to" src="mcp.srcdir" side="${side}" />
<side prop="side-from" src="src.dir" side="${side}" />
<copy todir="${merge-to}" overwrite="true" verbose="true">
<fileset dir="${side-from}" includes="**/*.java" />
<fileset dir="${common.src.dir}" includes="**/*.java" />
</copy>
</target>
2012-08-02 13:03:29 +00:00
<target name="build-client" depends="buildenvsetup,fmldecompile,merge-client,buildandreobfmcp,makeversion">
2012-03-30 20:22:10 +00:00
<antcall target="extract-built-jar">
<param name="side" value="client" />
</antcall>
</target>
2012-08-02 13:03:29 +00:00
<target name="build-server" depends="buildenvsetup,fmldecompile,merge-server,buildandreobfmcp,makeversion">
2012-03-30 20:22:10 +00:00
<antcall target="extract-built-jar">
<param name="side" value="server" />
</antcall>
</target>
<target name="extract-built-jar">
<side prop="output" src="mcp.obfoutput" side="${side}" />
<property name="jarname" value="${modname}-${side}-${version}" />
<mkdir dir="${basedir}/target" />
2012-03-31 01:10:43 +00:00
<zip destfile="${basedir}/target/${jarname}.zip">
2012-03-30 20:22:10 +00:00
<fileset dir="${output}" includes="**/*.class" />
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
2012-04-04 13:48:36 +00:00
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
2012-04-04 13:48:36 +00:00
<mappedresources>
<concat>
<fileset dir="${basedir}/install" includes="README.txt" />
<filterchain>
<replacetokens>
<token key="MAJOR" value="${version.major}" />
<token key="MINOR" value="${version.minor}" />
<token key="REV" value="${version.rev}" />
<token key="BUILD" value="${version.build}" />
<token key="MCVERSION" value="${version.minecraft}" />
</replacetokens>
</filterchain>
</concat>
<mergemapper to="README-fml.txt" />
2012-04-04 13:48:36 +00:00
</mappedresources>
2012-03-31 01:10:43 +00:00
</zip>
2012-03-30 20:22:10 +00:00
</target>
<target name="build-source-pack" depends="makeversion">
2012-03-30 20:22:10 +00:00
<property name="jarname" value="${modname}-src-${version}" />
<zip destfile="${basedir}/target/${jarname}.zip">
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt,difflist.txt" prefix="fml" />
<zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/src/minecraft_server" />
<zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/src/minecraft" />
<zipfileset dir="${client.src.dir}" includes="**/*.java" prefix="fml/src/minecraft" />
<zipfileset dir="${server.src.dir}" includes="**/*.java" prefix="fml/src/minecraft_server" />
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/src/minecraft" />
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/src/minecraft_server" />
<zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" />
2012-04-04 13:48:36 +00:00
<mappedresources>
<concat>
<fileset dir="${basedir}/install" includes="README.txt" />
<filterchain>
<replacetokens>
<token key="MAJOR" value="${version.major}" />
<token key="MINOR" value="${version.minor}" />
<token key="REV" value="${version.rev}" />
<token key="BUILD" value="${version.build}" />
<token key="MCVERSION" value="${version.minecraft}" />
</replacetokens>
</filterchain>
</concat>
<mergemapper to="fml/README-fml.txt" />
2012-04-04 13:48:36 +00:00
</mappedresources>
<zipfileset dir="${basedir}/install" excludes="README.txt" prefix="fml" />
2012-03-30 20:22:10 +00:00
</zip>
</target>
2012-04-04 13:48:36 +00:00
<target name="build" depends="buildenvsetup,merge-server,merge-client,build-server,build-client,build-source-pack" />
2012-03-30 20:22:10 +00:00
2012-08-02 13:03:29 +00:00
<target name="jenkinsbuild" depends="buildenvsetup,fmldecompile,patch,build"/>
<target name="patch" depends="buildenvsetup">
2012-03-31 00:38:31 +00:00
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/applypatches.py" />
<arg value="${basedir}" />
<arg value="${mcp.srcdir}" />
<arg value="${mcp.home}" />
2012-03-31 00:38:31 +00:00
</exec>
2012-04-04 13:48:36 +00:00
2012-03-30 20:22:10 +00:00
</target>
<target name="setupenvironment" depends="buildenvsetup">
<input message="This will clean the mcp environment at ${mcp.home} and backup any src-work folder there (src-base will be erased). Continue?" validargs="y,n" addproperty="do.continue" />
<condition property="do.not.continue">
<equals arg1="n" arg2="${do.continue}" />
</condition>
<fail if="do.not.continue">You have decided not to continue. This script will stop now.</fail>
<echo>Preparing the MCP environment at ${mcp.home}</echo>
<!--<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/download_fernflower.py" />
<arg value="${mcp.home}"/>
</exec>-->
2012-08-02 13:00:52 +00:00
<antcall target="fmldecompile"/>
2012-07-03 12:14:35 +00:00
<echo>Moving old patched sources at ${patch.mcp.srcdir} out of the way</echo>
<move todir="${mcp.home}/src-work${timestamp}" failonerror="false" verbose="true">
2012-07-03 12:14:35 +00:00
<fileset dir="${patch.mcp.srcdir}"/>
</move>
2012-07-03 12:14:35 +00:00
<echo>Deleting old patch references at ${clean.mcp.srcdir}</echo>
<delete dir="${clean.mcp.srcdir}" failonerror="false"/>
<echo>Creating new patch references at ${clean.mcp.srcdir}</echo>
<copy todir="${clean.mcp.srcdir}">
<fileset dir="${mcp.srcdir}"/>
</copy>
<antcall target="cleanargo"/>
<antcall target="patch"/>
2012-07-03 12:14:35 +00:00
<echo>Creating clean patched references at ${patch.mcp.srcdir}</echo>
<copy todir="${patch.mcp.srcdir}">
<fileset dir="${mcp.srcdir}"/>
</copy>
<antcall target="writeversion"/>
<echo>Setup complete! You should now be able to open ${basedir}/eclipse as a workspace in eclipse and import/refresh the FML-Server and FML-Client projects</echo>
</target>
2012-08-02 13:00:52 +00:00
<target name="fmldecompile" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/cleanup.py" />
<arg value="-f" />
</exec>
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/decompile.py" />
<arg value="${mcp.home}" />
<arg value="${basedir}" />
</exec>
<!--<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${basedir}/cleanup_source.py" />
<arg value="${mcp.srcdir}" />
</exec>-->
<!--<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/updatemd5.py" />
<arg value="-f" />
</exec>-->
</target>
<target name="repatch" depends="buildenvsetup,checkpatches">
<echo>Moving old patched sources at ${mcp.home}/src-work out of the way</echo>
<move todir="${mcp.home}/src-work${timestamp}" failonerror="false" verbose="true">
<fileset dir="${patch.mcp.srcdir}"/>
</move>
2012-07-03 12:14:35 +00:00
<delete dir="${mcp.srcdir}"/>
<copy todir="${mcp.srcdir}">
<fileset dir="${clean.mcp.srcdir}"/>
</copy>
<antcall target="cleanargo"/>
<antcall target="patch"/>
<copy todir="${patch.mcp.srcdir}">
2012-07-03 12:14:35 +00:00
<fileset dir="${mcp.srcdir}"/>
</copy>
</target>
2012-07-03 12:14:35 +00:00
<target name="cleanargo" depends="buildenvsetup">
<delete dir="${client.mcp.srcdir}/argo"/>
</target>
<target name="checkpatches" depends="buildenvsetup">
<uptodate property="checkUptodate.uptodate">
<srcfiles dir="${patch.mcp.srcdir}" includes="**/*.java">
<present targetdir="${patch.src.dir}">
<globmapper from="*.java" to="*.java.patch"/>
</present>
</srcfiles>
<globmapper from="*.java" to="${patch.src.dir}/*.java.patch"/>
</uptodate>
<fail unless="checkUptodate.uptodate">
A patch is out of date. Update your patches!
</fail>
</target>
<target name="updatepatches" depends="buildenvsetup">
<exec executable="${python.exe}" dir="${basedir}">
<arg value="${basedir}/update_patches.py" />
<arg value="${mcp.home}"/>
<arg value="${basedir}"/>
</exec>
</target>
<target name="makerenamedsource" depends="buildenvsetup,repatch,merge-client,merge-server,buildandreobfmcp">
<copy todir="${tmp.mcp.srcdir}">
<fileset dir="${mcp.srcdir}"/>
</copy>
<exec executable="${python.exe}" dir="${mcp.home}">
<arg value="${mcp.home}/runtime/updatenames.py" />
<arg value="-f" />
</exec>
<copy todir="${renamed.mcp.srcdir}">
<fileset dir="${mcp.srcdir}"/>
</copy>
<move todir="${mcp.srcdir}">
<fileset dir="${tmp.mcp.srcdir}"/>
</move>
</target>
2012-03-30 20:22:10 +00:00
</project>