mirror of
https://github.com/GTNewHorizons/MouseTweaks.git
synced 2026-10-26 14:23:48 +00:00
320 lines
14 KiB
XML
320 lines
14 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
<project name="Mouse Tweaks" basedir="." default="main">
|
|
|
|
<property name="modid" value="MouseTweaks" />
|
|
|
|
<!-- The version of your mod, can be any string as long as it's valid as part of a file name -->
|
|
<!-- and should match the version string returned by your mod. -->
|
|
<property name="version" value="2.4.4" />
|
|
|
|
<!-- The Minecraft version the mod is for, appended to the output file name for reference -->
|
|
<property name="mcversion" value="1.7.10" />
|
|
|
|
<!-- The version inserted into the mod metadata to tell the loader what version of MC this mod is for -->
|
|
<property name="litemodversion" value="1.7.10" />
|
|
|
|
<!-- Your name, this gets written into the mod metadata and jar metadata -->
|
|
<property name="author" value="YaLTeR" />
|
|
|
|
<!-- The name of the eclipse project to build, for upstream dependencies see the targets below -->
|
|
<property name="project" value="Mouse Tweaks" />
|
|
|
|
<!-- The upstream MD5 set to use when outputting your mod classes, usually liteloader -->
|
|
<property name="md5set" value="liteloader" />
|
|
|
|
<!-- The MD5 set to *write* for downstream projects to use, uncomment this line to enable -->
|
|
<!-- <property name="outmd5set" value="${ant.project.name}" /> -->
|
|
|
|
<!-- The base MCP directory, normally 3 levels up from here but change if the build script is moved -->
|
|
<property name="mcp.dir" location="../../.." />
|
|
|
|
<!-- These directory entries should not be changed, they point at various resources below the MCP dir -->
|
|
<property name="eclipse.dir" location="${mcp.dir}/eclipse" />
|
|
<property name="mc.src.dir" location="${mcp.dir}/src/minecraft" />
|
|
<property name="temp.dir" location="${mcp.dir}/temp" />
|
|
<property name="md5.dir" location="${mcp.dir}/md5" />
|
|
<property name="build.dir" location="${mcp.dir}/build" />
|
|
<property name="target.dir" location="${build.dir}/src" />
|
|
<property name="sourcejar.dir" location="${build.dir}/srcjar"/>
|
|
<property name="dist.dir" location="${build.dir}/dist" />
|
|
<property name="stage.dir" location="${build.dir}/stage/${ant.project.name}/${version}" />
|
|
|
|
<!-- Output file properties, change as required but in general you won't need to -->
|
|
<property name="file.type" value="jar" />
|
|
|
|
<!-- Path to the python executable used by MCP, change if using a non-windows OS -->
|
|
<property name="python" location="${mcp.dir}/runtime/bin/python/python_mcp.exe" />
|
|
|
|
<!-- Main target -->
|
|
<target name="main" description="Perform all tasks for a build">
|
|
<!-- Increments and retrieves the build number. -->
|
|
<buildnumber file="./buildnumber.txt" />
|
|
|
|
<!-- Init sets up the environment ready for the build, cleaning the old staging paths -->
|
|
<!-- and creating new clean ones that we will use for output. Also copies all the -->
|
|
<!-- required source files to the target source directory ready for MCP to build them. -->
|
|
<antcall target="init" />
|
|
|
|
<!-- Calls the MCP recompile process on the aggregated sources. -->
|
|
<antcall target="recompile" />
|
|
|
|
<!-- Calls the MCP reobfuscate process, this will output all modified classes not masked -->
|
|
<!-- by the upstream MD5 set, which should be our mod classes! -->
|
|
<antcall target="reobfuscate" />
|
|
|
|
<!-- Saves the new MD5's to our own file, for use by downstream projects. If enabled. -->
|
|
<antcall target="savemd5" />
|
|
|
|
<!-- Stages the new class files, and our project resources into the staging directory -->
|
|
<!-- ready to be built into the output jar file. -->
|
|
<antcall target="stage" />
|
|
|
|
<!-- Compiles the MouseTweaksForge class. -->
|
|
<antcall target="compileforge" />
|
|
|
|
<!-- Builds the output jar file and writes it as a .jar file to the build directory. -->
|
|
<antcall target="litemod" />
|
|
|
|
<!-- Makes a source jar. -->
|
|
<antcall target="sourcejar" />
|
|
</target>
|
|
|
|
<!-- Clean the target and reobf dirs -->
|
|
<target name="clean">
|
|
<delete dir="${target.dir}" />
|
|
<delete dir="${mcp.dir}/reobf" />
|
|
</target>
|
|
|
|
<!-- Copies the upstream MD5's to the MCP directory -->
|
|
<target name="preparemd5" description="Copy patched MD5 to the temp directory" depends="clean">
|
|
<echo level="info" message="Prepare exclusion MD5s, using exclusion set "${md5set}"" />
|
|
|
|
<copy tofile="${temp.dir}/client.md5" file="${md5.dir}/client_${md5set}.md5" failonerror="true" verbose="true" overwrite="true" />
|
|
</target>
|
|
|
|
<!-- Contributes MCP and project sources to the target dir -->
|
|
<target name="prepare" description="Prepare source for MCP" depends="preparemd5">
|
|
<echo level="info" message="Prepare sources for compile" />
|
|
|
|
<!-- Contribute the MCP sources -->
|
|
<copy todir="${target.dir}" verbose="false" overwrite="true">
|
|
<fileset dir="${mc.src.dir}" />
|
|
</copy>
|
|
|
|
<!-- UPSTREAM PROJECTS -->
|
|
<!-- This is where upstream projects are contributed to the target directory, each -->
|
|
<!-- upstream project needs a line below, so if you have additional upstreams then -->
|
|
<!-- simply duplicate the line below and change "LiteLoader" to the name of the eclipse -->
|
|
<!-- project that you want to contribute sources from. -->
|
|
<antcall target="contributesource">
|
|
<param name="lib" value="LiteLoader" />
|
|
<param name="destination" value="${target.dir}" />
|
|
</antcall>
|
|
|
|
<!-- Lastly we contribute sources from the project itself, you do not need to change this -->
|
|
<antcall target="contributesource">
|
|
<param name="lib" value="${project}" />
|
|
<param name="destination" value="${target.dir}" />
|
|
</antcall>
|
|
</target>
|
|
|
|
<!-- Compile the MouseTweaksForge class -->
|
|
<target name="compileforge" description="Compile the MouseTweaksForge">
|
|
<echo level="info" message="Compiling the MouseTweaksForge class" />
|
|
|
|
<javac srcdir="../forge/"
|
|
destdir="${stage.dir}"
|
|
source="1.6"
|
|
target="1.6">
|
|
<classpath>
|
|
<pathelement location="../forge/forgeSrc.jar" />
|
|
<pathelement location="${stage.dir}" />
|
|
</classpath>
|
|
</javac>
|
|
</target>
|
|
|
|
<!-- Stage class files and resources into the staging directory -->
|
|
<target name="stage" description="Stage resources into staging directory">
|
|
<echo level="info" message="Staging resources" />
|
|
|
|
<!-- Stages the freshly-obfuscated class files into the staging directory. -->
|
|
<copy todir="${stage.dir}">
|
|
<fileset dir="${mcp.dir}/reobf/minecraft" excludes=".svn/**, *.txt">
|
|
<exclude name="*.class"/>
|
|
|
|
<!-- One Minecraft class gets copied for whatever reason. -->
|
|
<exclude name="net/**"/>
|
|
</fileset>
|
|
</copy>
|
|
|
|
<!-- UPSTREAM PROJECTS -->
|
|
<!-- Like with the sources, this is where upstream project resources are contributed to -->
|
|
<!-- the target directory, each upstream project needs a line below, so if you have -->
|
|
<!-- additioanl upstreams then simply duplicate the line below and change "LiteLoader" -->
|
|
<!-- to the name of the eclipse project that you want to contribute resources from. -->
|
|
<!-- <antcall target="contributeresources"><param name="lib" value="LiteLoader" /></antcall> -->
|
|
|
|
<!-- Lastly we contribute resources from the project itself -->
|
|
<antcall target="contributeresources">
|
|
<param name="lib" value="${project}" />
|
|
<param name="destination" value="${stage.dir}" />
|
|
</antcall>
|
|
|
|
<!-- Uses the template file to build the litemod.json file and stages it to the staging -->
|
|
<!-- directory. -->
|
|
<antcall target="gentemplates">
|
|
<param name="destination" value="${stage.dir}" />
|
|
</antcall>
|
|
</target>
|
|
|
|
<!-- Generates the files from the templates -->
|
|
<target name="gentemplates" description="Generate the necessary files from the templates">
|
|
<echo level="info" message="Generating the files from the templates" />
|
|
|
|
<concat destfile="${destination}/litemod.json" append="false">
|
|
<fileset file="./litemod.template.json" />
|
|
<filterchain><expandproperties /></filterchain>
|
|
</concat>
|
|
<concat destfile="${destination}/mcmod.info" append="false">
|
|
<fileset file="./mcmod.template.info" />
|
|
<filterchain><expandproperties /></filterchain>
|
|
</concat>
|
|
</target>
|
|
|
|
<!-- Contributes java sources from a project, do not alter -->
|
|
<target name="contributesource" description="Contribute an upstream project source code to the destination path">
|
|
<echo level="info" message="Contributing project ${lib} to ${destination}" />
|
|
<copy todir="${destination}" verbose="false" overwrite="true" failonerror="false">
|
|
<!-- Eclipse default -->
|
|
<fileset dir="${eclipse.dir}/${lib}/src" />
|
|
<!-- Legacy default -->
|
|
<fileset dir="${eclipse.dir}/${lib}/java" />
|
|
<!-- Maven default -->
|
|
<fileset dir="${eclipse.dir}/${lib}/src/main/java" />
|
|
|
|
<filterchain>
|
|
<replacetokens begintoken="@" endtoken="@">
|
|
<token key="MODNAME" value="${ant.project.name}"/>
|
|
<token key="MODID" value="${modid}"/>
|
|
<token key="VERSION" value="${version}"/>
|
|
</replacetokens>
|
|
</filterchain>
|
|
</copy>
|
|
</target>
|
|
|
|
<!-- Makes a source jar -->
|
|
<target name="sourcejar" description="Make the source jar">
|
|
<echo level="info" message="Making the source jar" />
|
|
|
|
<delete dir="${sourcejar.dir}" />
|
|
<mkdir dir="${sourcejar.dir}" />
|
|
|
|
<antcall target="contributesource">
|
|
<param name="lib" value="${project}" />
|
|
<param name="destination" value="${sourcejar.dir}" />
|
|
</antcall>
|
|
<antcall target="contributeresources">
|
|
<param name="lib" value="${project}" />
|
|
<param name="destination" value="${sourcejar.dir}" />
|
|
</antcall>
|
|
<antcall target="gentemplates">
|
|
<param name="destination" value="${sourcejar.dir}" />
|
|
</antcall>
|
|
|
|
<copy todir="${sourcejar.dir}" verbose="false" overwrite="true" failonerror="false">
|
|
<fileset dir="../forge/" includes="**/*.java" />
|
|
</copy>
|
|
|
|
<jar destfile="${dist.dir}/${modid}-${version}-mc${mcversion}-src.jar" duplicate="preserve" index="true" manifestencoding="UTF-8">
|
|
<manifest>
|
|
<attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)" />
|
|
<attribute name="Implementation-Vendor" value="${author}" />
|
|
<attribute name="Implementation-Title" value="${ant.project.name}" />
|
|
<attribute name="Implementation-Version" value="${version}" />
|
|
</manifest>
|
|
<fileset dir="${sourcejar.dir}" />
|
|
</jar>
|
|
|
|
<delete dir="${sourcejar.dir}" />
|
|
</target>
|
|
|
|
<!-- Contribute resources from a project, do not alter -->
|
|
<target name="contributeresources" description="Contribute resources to the destination path">
|
|
<echo level="info" message="Contributing project resources for ${lib} to ${destination}" />
|
|
<copy todir="${destination}" verbose="false" failonerror="false">
|
|
<fileset dir="${eclipse.dir}/${lib}/resources" excludes=".svn/**">
|
|
<exclude name="**/Thumbs.db" />
|
|
<exclude name="**/classes" />
|
|
<exclude name="liteloader.properties" />
|
|
</fileset>
|
|
<fileset dir="${eclipse.dir}/${lib}/src/main/resources" excludes=".svn/**">
|
|
<exclude name="**/Thumbs.db" />
|
|
<exclude name="**/classes" />
|
|
<exclude name="liteloader.properties" />
|
|
</fileset>
|
|
</copy>
|
|
</target>
|
|
|
|
<!-- Init task -->
|
|
<target name="init" description="Initialize build environment" depends="prepare">
|
|
<echo level="info" message="Cleaning old stage and dist, MCP reobf directories" />
|
|
|
|
<delete dir="${stage.dir}" />
|
|
|
|
<echo level="info" message="Creating stage and dist dirs" />
|
|
<mkdir dir="${stage.dir}" />
|
|
<mkdir dir="${dist.dir}" />
|
|
<mkdir dir="${md5.dir}" />
|
|
</target>
|
|
|
|
<!-- MCP recompilation task -->
|
|
<target name="recompile" description="MCP recompile">
|
|
<echo level="info" message="Compiling projects" />
|
|
|
|
<echo append="false" file="${temp.dir}/build.cfg" message="[OUTPUT]
SrcClient = build/src" />
|
|
|
|
<exec executable="${python}" dir="${mcp.dir}">
|
|
<arg value="runtime/recompile.py" />
|
|
<arg value="--client" />
|
|
<arg value="--config" />
|
|
<arg value="${temp.dir}/build.cfg" />
|
|
<arg value="%*" />
|
|
</exec>
|
|
</target>
|
|
|
|
<!-- MCP reobfuscation task -->
|
|
<target name="reobfuscate" description="MCP reobfuscate">
|
|
<echo level="info" message="Obfuscating classes" />
|
|
|
|
<exec executable="${python}" dir="${mcp.dir}">
|
|
<arg value="runtime/reobfuscate.py" />
|
|
<arg value="--client" />
|
|
<arg value="%*" />
|
|
</exec>
|
|
</target>
|
|
|
|
<!-- Stores generated output MD5's for downstream projects if specifed -->
|
|
<target name="savemd5" description="Put post-obfuscation MD5 to stored md5 set" if="outmd5set">
|
|
<echo level="info" message="Storing obfuscated MD5s" />
|
|
|
|
<copy file="${temp.dir}/client_reobf.md5" tofile="${md5.dir}/client_${outmd5set}.md5" overwrite="true" verbose="true" />
|
|
</target>
|
|
|
|
<!-- Builds the litemod jar file -->
|
|
<target name="litemod" description="Build the litemod file">
|
|
<echo level="info" message="Building final output" />
|
|
|
|
<mkdir dir="${dist.dir}" />
|
|
<jar destfile="${dist.dir}/${modid}-${version}-mc${mcversion}.${file.type}" duplicate="preserve" index="true" manifestencoding="UTF-8">
|
|
<manifest>
|
|
<attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)" />
|
|
<attribute name="Implementation-Vendor" value="${author}" />
|
|
<attribute name="Implementation-Title" value="${ant.project.name}" />
|
|
<attribute name="Implementation-Version" value="${version}" />
|
|
</manifest>
|
|
<fileset dir="${stage.dir}" />
|
|
</jar>
|
|
</target>
|
|
</project>
|