one more time

This commit is contained in:
StevenRS11 2013-12-17 00:56:22 -06:00
parent fd01d4e198
commit 602b55111f

149
build.xml
View file

@ -1,62 +1,93 @@
<project name="DimensionalDoors" default="install" basedir="."> <project name="DimensionalDoors" default="install" basedir=".">
<property environment="env" /> <property environment="env" />
<property name="project.name" value="DimDoors" />
<property name="src.dir" value="StevenDimDoors" />
<property name="resources.dir" value="resources" />
<property name="schematics.dir" value="schematics" />
<property name="versionclass.dir" value="mod_pocketDim" />
<property name="versionclass.file" value="mod_pocketDim.java"/>
<property name="minecraft.version" value="1.6.4" />
<property name="forge.forgeversion" value="9.11.1" />
<property name="forge.buildnum" value="953" />
<property name="build.dir" value="build" /> <property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/packaging" /> <property name="classes.dir" value="${build.dir}/packaging" />
<property name="src.dir" value="src" /> <property name="resourcePack.dir" value="${classes.dir}" />
<property name="forge.version" value="1.6.4-9.11.1.953" /> <property name="schematicPack.dir" value="${classes.dir}/schematics/" />
<property name="apiclasses.dir" value="${build.dir}/api-packaging" />
<property name="forge.version" value="${minecraft.version}-${forge.forgeversion}.${forge.buildnum}" />
<property name="forge.url" value="http://files.minecraftforge.net/minecraftforge/minecraftforge-src-${forge.version}.zip" /> <property name="forge.url" value="http://files.minecraftforge.net/minecraftforge/minecraftforge-src-${forge.version}.zip" />
<property name="mcp.version" value="811" />
<property name="forge.dir" value="${build.dir}/forge" /> <property name="forge.dir" value="${build.dir}/forge" />
<property name="mcp.dir" value="${forge.dir}/mcp" /> <property name="mcp.dir" value="${forge.dir}/mcp" />
<property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft" /> <property name="mcpsrc.dir" value="${mcp.dir}/src/minecraft/StevenDimDoors" />
<property name="resources.dir" value="resources" />
<property name="package.meta-inf" value="META-INF" /> <property name="package.meta-inf" value="META-INF" />
<property name="build.ver" value="1.6.4" />
<property name="dist.dir" value="${build.dir}/dist" /> <property name="dist.dir" value="${build.dir}/dist" />
<property name="download.dir" value="downloads" /> <property name="download.dir" value="${build.dir}/downloads" />
<property name="lib.dir" value="${mcp.dir}/lib" /> <property name="lib.dir" value="${mcp.dir}/lib" />
<property file="${forge.dir}/forgeversion.properties" /> <property file="${forge.dir}/forgeversion.properties" />
<condition property="forge.already.installed"> <condition property="forge.already.installed">
<equals arg1="${forge.build.number}" arg2="953" /> <equals arg1="${forge.build.number}" arg2="${forge.buildnum}" />
</condition> </condition>
<property name="verclass.dir" value="${mcpsrc.dir}/StevenDimDoors/mod_pocketDim/" />
<property name="verclass.name" value="mod_pocketDim.java"/>
<mkdir dir="${download.dir}"/> <mkdir dir="${download.dir}"/>
<mkdir dir="${build.dir}" /> <mkdir dir="${build.dir}" />
<target name="get-version" depends="setup-forge"> <target name="get-version" depends="setup-forge">
<mkdir dir="${mcpsrc.dir}/StevenDimDoors" /> <!-- Copy source -->
<copy todir="${mcpsrc.dir}/StevenDimDoors" overwrite="true"> <copy todir="${mcpsrc.dir}" overwrite="true">
<fileset dir="StevenDimDoors" /> <fileset dir="${src.dir}"/>
</copy> </copy>
<!-- Get the version from the mcmod.info -->
<script language="javascript">
importClass(java.io.File);
importClass(java.nio.file.Files)
importClass(java.io.FileReader);
importClass(java.io.BufferedReader);
importClass(java.io.FileWriter);
importClass(java.io.BufferedWriter);
echo = project.createTask("echo");
echo.setMessage("Parsing mcmod.info...");
echo.perform();
<exec dir="${verclass.dir}" executable="sh" osfamily="unix" outputproperty="grep.out"> var file = new File("./mcmod.info");
<arg value="-c"/>
<arg value="grep -o -P '[0-9.]+R[0-9.]+(RC[0-9]+)?(B[0-9]+)?' ${verclass.name}"/> fr = new FileReader(file);
</exec> br = new BufferedReader(fr);
<exec executable="python" osfamily="unix">
<arg value="versionscript.py" /> // Read the file.
<arg value="${grep.out}" /> // This assumes the file has no line
</exec> var line;
<echo message="Grepped version: ${grep.out}"/> var json = "";
<copy todir="${classes.dir}" file="mcmod.info" overwrite="true"/> while ((line = br.readLine()) != null) {
json += line;
}
var struct = JSON.parse(json);
var version = struct["modlist"][0].version;
echo = project.createTask("echo");
echo.setMessage("Parsed version: " + version);
echo.perform();
project.setProperty("mod.version", version);
</script>
<!-- Replace the version information in the mod class -->
<replace file="${mcpsrc.dir}/${versionclass.dir}/${versionclass.file}">
<replacefilter token="$VERSION$" value="${mod.version}"/>
</replace>
</target> </target>
<available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip" /> <available property="forge-exists" file="${download.dir}/minecraftforge-src-${forge.version}.zip" />
<available property="already-compiled" file="${classes.dir}/deathrat" /> <available property="already-compiled" file="${classes.dir}/${src.dir}" />
<condition property="should-download-ant-contrib"> <condition property="should-download-ant-contrib">
<or> <or>
<available file="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/> <available file="${download.dir}/ant-contrib/ant-contrib-1.0b3.jar"/>
@ -65,14 +96,13 @@
</condition> </condition>
<target name="install" depends="build"> <target name="install" depends="build">
<copy todir="${classes.dir}/schematics" overwrite="true"> <delete dir="${mcpsrc.dir}/${src.dir}" />
<fileset dir="schematics" /> <delete dir="${dist.dir}" />
</copy> <jar destfile="${dist.dir}/${project.name}-${mod.version}-${build.number}.jar" basedir="${classes.dir}"/>
<zip destfile="${dist.dir}/DimensionalDoors-${grep.out}-${build.number}.zip" basedir="${classes.dir}"/>
<delete dir="${classes.dir}" /> <delete dir="${classes.dir}" />
<delete dir="${mcp.dir}/reobf"/> <delete dir="${mcp.dir}/reobf"/>
<delete dir="${mcpsrc}/StevenDimDoors" /> <delete dir="{$apiclasses.dir}" />
<delete dir="${mcpsrc}/Steven" /> <delete dir="${mcpsrc.dir}/${src.dir}" />
</target> </target>
<target name="build" depends="get-version" unless="already-compiled"> <target name="build" depends="get-version" unless="already-compiled">
@ -87,19 +117,36 @@
<!-- Reobf --> <!-- Reobf -->
<exec dir="${mcp.dir}" executable="cmd" osfamily="windows"> <exec dir="${mcp.dir}" executable="cmd" osfamily="windows">
<arg line="/c reobfuscate_srg.bat"/> <arg line="/c reobfuscate.bat --srgnames"/>
</exec> </exec>
<exec dir="${mcp.dir}" executable="sh" osfamily="unix"> <exec dir="${mcp.dir}" executable="sh" osfamily="unix">
<arg value="reobfuscate_srg.sh" /> <arg value="reobfuscate.sh" />
</exec> </exec>
<copy todir="${classes.dir}"> <copy todir="${classes.dir}">
<fileset dir="${mcp.dir}/reobf/minecraft"/> <fileset dir="${mcp.dir}/reobf/minecraft"/>
</copy> </copy>
<copy todir="${classes.dir}">
<fileset dir="${resources.dir}"/> <copy todir="${resourcePack.dir}">
<fileset dir="${resources.dir}" />
</copy> </copy>
<copy todir="${schematicPack.dir}">
<fileset dir="${schematics.dir}" />
</copy>
<copy todir="${classes.dir}">
<fileset file="mcmod.info" />
</copy>
<copy todir="${classes.dir}">
<fileset file="${resources.dir}/pack.mcmeta" />
</copy>
<delete file="${resourcePack.dir}/mcmod.info" />
<delete file="${resourcePack.dir}/pack.mcmeta" />
</target> </target>
<target name="build-number-there" if="env.BUILD_NUMBER" > <target name="build-number-there" if="env.BUILD_NUMBER" >
@ -109,7 +156,7 @@
<target name="build-number-not-there" unless="env.BUILD_NUMBER" > <target name="build-number-not-there" unless="env.BUILD_NUMBER" >
<echo message="!! No build number set !!" /> <echo message="!! No build number set !!" />
<property name="build.number" value="CUSTOM_BUILD" /> <property name="build.number" value="0" />
</target> </target>
<target name="setup-forge" depends="download-forge,build-number-there,build-number-not-there" unless="forge.already.installed"> <target name="setup-forge" depends="download-forge,build-number-there,build-number-not-there" unless="forge.already.installed">
@ -121,15 +168,9 @@
</fileset> </fileset>
</unzip> </unzip>
<!-- Change executables' permitions --> <!-- Change executables' permitions -->
<chmod file="${forge.dir}/install.sh" perm="+x"/> <chmod file="${forge.dir}/install.sh" perm="+x"/>
<!-- if your building on OSX these 2 should be executable -->
<!-- Install forge --> <!-- Install forge -->
<delete dir="${mcp.dir}" failonerror="no"/> <delete dir="${mcp.dir}" failonerror="no"/>
<exec dir="${forge.dir}" executable="cmd" osfamily="windows" inputstring="Yes\n"> <exec dir="${forge.dir}" executable="cmd" osfamily="windows" inputstring="Yes\n">
@ -138,21 +179,13 @@
<exec dir="${forge.dir}" executable="sh" osfamily="unix" inputstring="Yes\n"> <exec dir="${forge.dir}" executable="sh" osfamily="unix" inputstring="Yes\n">
<arg value="install.sh" /> <arg value="install.sh" />
</exec> </exec>
<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_srg.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/astyle-osx" perm="+x" />
<chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" /> <chmod file="${mcp.dir}/runtime/bin/jad-osx" perm="+x" />
<!-- Copy libraries -->
<!-- <copy todir="${mcp.dir}/lib" >
<fileset dir="lib" >
<patternset includes="*.jar" />
</fileset>
</copy> -->
</target> </target>
<target name="download-forge" depends="download-ant-contrib" unless="forge-exists"> <target name="download-forge" depends="download-ant-contrib" unless="forge-exists">
@ -165,11 +198,10 @@
</classpath> </classpath>
</taskdef> </taskdef>
<echo message="Downloading forge... " /> <echo message="Downloading forge... " />
<get src="${forge.url}" dest="${download.dir}/minecraftforge-src-${forge.version}.zip" /> <get src="http://files.minecraftforge.net/minecraftforge-src-${forge.version}.zip"
dest="${download.dir}/minecraftforge-src-${forge.version}.zip" />
</target> </target>
<target name="download-ant-contrib" unless="should-download-ant-contrib"> <target name="download-ant-contrib" unless="should-download-ant-contrib">
<echo message="Getting: ant-contrib"/> <echo message="Getting: ant-contrib"/>
<mkdir dir="${download.dir}/tmp"/> <mkdir dir="${download.dir}/tmp"/>
@ -196,4 +228,3 @@
</project> </project>