Commit fc0d1934f5e73ad28d519f34d3eb4a0cf6af0d2b

Authored by Mumfrey
1 parent 5e8080bc

burn branding info into SNAPSHOT builds, tidying build script

ant/build_liteloader.xml
... ... @@ -16,70 +16,56 @@
16 16 <property name="tweakclass" value="com.mumfrey.liteloader.launch.LiteLoaderTweaker" />
17 17  
18 18 <property name="mcp.dir" location="../../.." />
19   - <property name="build" location="${mcp.dir}/build" />
20   - <property name="eclipse" location="${mcp.dir}/eclipse" />
21   - <property name="temp" location="${mcp.dir}/temp" />
  19 + <property name="build.dir" location="${mcp.dir}/build" />
  20 + <property name="eclipse.dir" location="${mcp.dir}/eclipse" />
  21 + <property name="temp.dir" location="${mcp.dir}/temp" />
22 22 <property name="md5.dir" location="${mcp.dir}/md5" />
23   - <property name="libs" location="${mcp.dir}/lib" />
  23 + <property name="libs.dir" location="${mcp.dir}/lib" />
  24 + <property name="src.dir" location="${build.dir}/src"/>
  25 + <property name="mc.src.dir" location="${mcp.dir}/src/minecraft" />
  26 + <property name="mc.bin.dir" location="${mcp.dir}/bin/minecraft" />
  27 + <property name="mc.libs.dir" location="${mcp.dir}/jars/libraries" />
24 28  
25   - <property name="dist.dir" location="${build}/dist" />
26   - <property name="stage.dir" location="${build}/stage/${ant.project.name}/${version}" />
  29 + <property name="dist.dir" location="${build.dir}/dist" />
27 30 <property name="filetype" value="jar" />
28 31  
29 32 <property name="python_windows" location="${mcp.dir}/runtime/bin/python/python_mcp.exe" />
30 33 <property name="python_linux" location="/usr/bin/python" />
31   -
32   - <target name="findmcp">
33   - <echo level="info" message="Searching for clean MCP source..." />
34   - <condition property="mcpsrc.exists">
35   - <available file="${mcp.dir}/src/mcp" type="dir"/>
36   - </condition>
37   - </target>
38   -
  34 +
  35 + <property environment="env" />
  36 +
39 37 <target name="setup_development">
40 38 <property name="skipremoval" value="DEV" />
41 39 <property name="md5.outfile" value="${md5.dir}/client_${outmd5set}.md5" />
42   - <property name="artefact.name" value="${ant.project.name}-${mcversion}-DEV" />
  40 + <property name="artefact.name" value="${ant.project.name}-${mcversion}" />
  41 + <property name="stage.dir" location="${build.dir}/stage/${ant.project.name}/${version}" />
  42 + <property name="meta.version" value="${version}" />
43 43 </target>
44   -
  44 +
45 45 <target name="setup_production">
46 46 <property name="skipremoval" value="" />
47 47 <property name="md5.outfile" value="${md5.dir}/client_${outmd5set}_production.md5" />
48 48 <property name="artefact.name" value="${ant.project.name}-${mcversion}" />
  49 + <property name="stage.dir" location="${build.dir}/stage/${ant.project.name}/${version}" />
  50 + <property name="meta.version" value="${version}" />
49 51 </target>
50   -
  52 +
51 53 <target name="setup_jenkins">
52 54 <property name="skipremoval" value="" />
53 55 <property name="md5.outfile" value="${md5.dir}/client_${outmd5set}_production.md5" />
54 56 <property name="artefact.name" value="${ant.project.name}-${mcversion}-SNAPSHOT" />
  57 + <property name="stage.dir" location="${build.dir}/stage" />
  58 + <property name="brand" value="${mcversion}-SNAPSHOT-r${env.SVN_REVISION}-b${env.BUILD_NUMBER}-${env.BUILD_ID}" />
  59 + <property name="meta.version" value="${version} [${brand}]" />
  60 + <property name="jenkins" value="" />
55 61 </target>
56   -
  62 +
57 63 <!-- Main target -->
58   - <target name="development" depends="setup_development, findmcp, setdirsold, setdirsnew, build" description="Entry point for MCP and upstream builds" />
59   -
60   - <target name="production" depends="setup_production, findmcp, setdirsold, setdirsnew, build, javadoc, mcpjar" description="Entry point for production builds" />
61   -
62   - <target name="jenkins" depends="setup_jenkins, findmcp, setdirsold, setdirsnew, build, javadoc, mcpjar" description="Entry point for CI builds" />
  64 + <target name="development" depends="setup_development, build" description="Entry point for MCP and upstream builds" />
63 65  
64   - <target name="setdirsnew" description="Set the MCP source directories for the new layout" unless="mcpsrc.exists">
65   - <echo level="info" message="Setting MCP source directories for NEW configuration" />
66   - <property name="src" location="${build}/src"/>
67   - <property name="mc.src" location="${mcp.dir}/src/minecraft" />
68   - <echo append="false" file="${temp}/build.cfg" message="[OUTPUT]&#x0A;SrcClient = build/src" />
69   - </target>
  66 + <target name="production" depends="setup_production, build, javadoc, mcpjar" description="Entry point for production builds" />
70 67  
71   - <target name="setdirsold" description="Set the MCP source directories for the old layout" if="mcpsrc.exists">
72   - <echo level="warning" message="--------------------------------------------------------------------------------" />
73   - <echo level="warning" message=" " />
74   - <echo level="warning" message=" Setting MCP source directories for OLD configuration!" />
75   - <echo level="warning" message=" " />
76   - <echo level="warning" message=" Renaming the MCP 'src' directory is no longer required and support for this" />
77   - <echo level="warning" message=" be removed in a future version." />
78   - <echo level="warning" message=" " />
79   - <echo level="warning" message="--------------------------------------------------------------------------------" />
80   - <property name="src" location="${mcp.dir}/src/minecraft"/>
81   - <property name="mc.src" location="${mcp.dir}/src/mcp" />
82   - </target>
  68 + <target name="jenkins" depends="setup_jenkins, build, javadoc, mcpjar" description="Entry point for CI builds" />
83 69  
84 70 <target name="build" description="Perform all tasks for a build" depends="init, recompile, reobfuscate, savemd5, stage, zip" >
85 71 </target>
... ... @@ -87,18 +73,18 @@
87 73 <target name="clean">
88 74 <echo level="info" message="Cleaning output directories" />
89 75  
90   - <delete dir="${src}" />
  76 + <delete dir="${src.dir}" />
91 77 <delete dir="${mcp.dir}/reobf" />
92 78 </target>
93 79  
94 80 <target name="contributesource" description="Contribute an upstream project source code to the source path">
95 81 <echo level="info" message="Contributing project ${lib}" />
96   - <copy todir="${src}" verbose="false" overwrite="true" failonerror="false">
97   - <fileset dir="${eclipse}/${lib}/java">
  82 + <copy todir="${src.dir}" verbose="false" overwrite="true" failonerror="false">
  83 + <fileset dir="${eclipse.dir}/${lib}/java">
98 84 <exclude name="**/debug" />
99 85 <exclude name="**/debug/*.java" />
100 86 </fileset>
101   - <fileset dir="${eclipse}/${lib}/src" />
  87 + <fileset dir="${eclipse.dir}/${lib}/src" />
102 88 <filterchain>
103 89 <linecontains negate="true">
104 90 <contains value="@MCPONLY${skipremoval}" />
... ... @@ -110,7 +96,7 @@
110 96 <target name="contributeresources" description="Contribute resources to the staging path">
111 97 <echo level="info" message="Contributing project resources for ${lib}" />
112 98 <copy todir="${stage.dir}" verbose="false" failonerror="false">
113   - <fileset dir="${eclipse}/${lib}/resources" excludes=".svn/**">
  99 + <fileset dir="${eclipse.dir}/${lib}/resources" excludes=".svn/**">
114 100 <exclude name="**/Thumbs.db" />
115 101 <exclude name="**/minecraft.key" />
116 102 </fileset>
... ... @@ -143,23 +129,23 @@
143 129 <target name="preparemd5" description="Copy patched MD5 to the temp directory" depends="seedmd5, notifymd5ok, clean">
144 130 <echo level="info" message="Prepare exclusion MD5s, using exclusion set &quot;${md5set}&quot;" />
145 131  
146   - <copy tofile="${temp}/client.md5" file="${md5.dir}/client_${md5set}.md5" failonerror="true" verbose="true" overwrite="true" />
  132 + <copy tofile="${temp.dir}/client.md5" file="${md5.dir}/client_${md5set}.md5" failonerror="true" verbose="true" overwrite="true" />
147 133 </target>
148 134  
149 135 <target name="prepare" description="Prepare source for MCP" depends="preparemd5">
150 136 <echo level="info" message="Prepare sources for compile" />
151 137  
152 138 <echo level="info" message="Contributing libs" />
153   - <copy todir="${libs}" verbose="true" overwrite="true">
154   - <fileset dir="${eclipse}/LiteLoader/lib">
  139 + <copy todir="${libs.dir}" verbose="true" overwrite="true">
  140 + <fileset dir="${eclipse.dir}/LiteLoader/lib">
155 141 <exclude name="**/authlib*.jar" />
156 142 <exclude name="**/log4j*.jar" />
157 143 </fileset>
158 144 </copy>
159 145  
160 146 <echo level="info" message="Contributing MC source" />
161   - <copy todir="${src}" verbose="false" overwrite="true">
162   - <fileset dir="${mc.src}" />
  147 + <copy todir="${src.dir}" verbose="false" overwrite="true">
  148 + <fileset dir="${mc.src.dir}" />
163 149 </copy>
164 150  
165 151 <echo level="info" message="Contributing upstream projects" />
... ... @@ -171,6 +157,8 @@
171 157 </target>
172 158  
173 159 <target name="init" description="Initialize build environment" depends="prepare">
  160 + <echo append="false" file="${temp.dir}/build.cfg" message="[OUTPUT]&#x0A;SrcClient = build/src" />
  161 +
174 162 <echo level="info" message="Cleaning old stage and dist, MCP reobf directories" />
175 163  
176 164 <delete dir="${stage.dir}" />
... ... @@ -188,7 +176,7 @@
188 176 <arg value="runtime/recompile.py" />
189 177 <arg value="--client" />
190 178 <arg value="--config" />
191   - <arg value="${temp}/build.cfg" />
  179 + <arg value="${temp.dir}/build.cfg" />
192 180 <arg value="%*" />
193 181 </exec>
194 182  
... ... @@ -196,7 +184,7 @@
196 184 <arg value="runtime/recompile.py" />
197 185 <arg value="--client" />
198 186 <arg value="--config" />
199   - <arg value="${temp}/build.cfg" />
  187 + <arg value="${temp.dir}/build.cfg" />
200 188 <arg value="%*" />
201 189 </exec>
202 190 </target>
... ... @@ -214,15 +202,13 @@
214 202 <arg value="runtime/reobfuscate.py" />
215 203 <arg value="--client" />
216 204 <arg value="%*" />
217   - </exec>
218   -
219   -
  205 + </exec>
220 206 </target>
221 207  
222 208 <target name="savemd5" description="Put post-obfuscation MD5 to stored md5 set" if="outmd5set">
223 209 <echo level="info" message="Storing obfuscated MD5s" />
224 210  
225   - <copy file="${temp}/client_reobf.md5" tofile="${md5.outfile}" overwrite="true" verbose="true" />
  211 + <copy file="${temp.dir}/client_reobf.md5" tofile="${md5.outfile}" overwrite="true" verbose="true" />
226 212 </target>
227 213  
228 214 <target name="stage" description="Stage resources into staging directory">
... ... @@ -233,6 +219,7 @@
233 219 <exclude name="?.class" />
234 220 <exclude name="??.class" />
235 221 <exclude name="???.class" />
  222 + <exclude name="/net/minecraft/**" />
236 223 </fileset>
237 224 </copy>
238 225  
... ... @@ -242,19 +229,28 @@
242 229 <param name="lib" value="${project}" />
243 230 </antcall>
244 231  
  232 + <antcall target="stamp">
  233 + </antcall>
  234 + </target>
  235 +
  236 + <target name="stamp" description="Stamp build information into staged resources" if="jenkins">
  237 + <echo level="info" message="Writing branding information into artefact staging area" />
  238 + <echo level="info" message="Brand: ${brand}" />
  239 +
  240 + <replaceregexp file="${stage.dir}/liteloader.properties" byline="true" match="^brand=.*$" replace="brand=${brand}" />
245 241 </target>
246 242  
247 243 <target name="zip" description="Build the output zip file">
248 244 <echo level="info" message="Building final output" />
249 245  
250 246 <mkdir dir="${dist.dir}" />
251   -
  247 +
252 248 <jar destfile="${dist.dir}/${artefact.name}.${filetype}" duplicate="preserve" index="true" manifestencoding="UTF-8">
253 249 <manifest>
254 250 <attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)" />
255 251 <attribute name="Implementation-Vendor" value="${author}" />
256 252 <attribute name="Implementation-Title" value="${ant.project.name}" />
257   - <attribute name="Implementation-Version" value="${version}" />
  253 + <attribute name="Implementation-Version" value="${meta.version}" />
258 254 <attribute name="TweakClass" value="${tweakclass}" />
259 255 <attribute name="TweakName" value="LiteLoader" />
260 256 <attribute name="TweakVersion" value="${version}" />
... ... @@ -263,7 +259,7 @@
263 259 <fileset dir="${stage.dir}" />
264 260 </jar>
265 261 </target>
266   -
  262 +
267 263 <target name="mcpjar" description="Build the MCP-names">
268 264 <echo level="info" message="Building mcpnamesjars" />
269 265  
... ... @@ -277,7 +273,7 @@
277 273 <attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)" />
278 274 <attribute name="Implementation-Vendor" value="${author}" />
279 275 <attribute name="Implementation-Title" value="${ant.project.name}" />
280   - <attribute name="Implementation-Version" value="${version}" />
  276 + <attribute name="Implementation-Version" value="${meta.version}" />
281 277 <attribute name="TweakClass" value="${tweakclass}" />
282 278 <attribute name="TweakName" value="LiteLoader" />
283 279 <attribute name="TweakVersion" value="${version}" />
... ... @@ -289,36 +285,45 @@
289 285 </fileset>
290 286 </jar>
291 287 <jar destfile="${dist.dir}/${artefact.name}-mcpnames-sources.${filetype}" duplicate="preserve" index="false" filesetmanifest="skip">
292   - <fileset dir="${eclipse}/LiteLoader/java/common" />
293   - <fileset dir="${eclipse}/LiteLoader/java/client" />
294   - <fileset dir="${eclipse}/LiteLoader/debug" />
295   - <fileset dir="${eclipse}/LiteLoader/resources" />
  288 + <fileset dir="${eclipse.dir}/LiteLoader/java/common" />
  289 + <fileset dir="${eclipse.dir}/LiteLoader/java/client" />
  290 + <fileset dir="${eclipse.dir}/LiteLoader/debug" />
  291 + <fileset dir="${eclipse.dir}/LiteLoader/resources" />
296 292 </jar>
297 293 </target>
298   -
  294 +
299 295 <target name="javadoc" description="Create the javadoc jar">
  296 + <echo level="info" message="Generating javadoc" />
  297 +
300 298 <javadoc destdir="${stage.dir}/docs" useexternalfile="true">
301   - <fileset dir="${eclipse}/${project}/java">
  299 + <fileset dir="${eclipse.dir}/${project}/java">
302 300 <exclude name="**/debug" />
303 301 <exclude name="**/debug/*.java" />
304 302 </fileset>
  303 + <classpath>
  304 + <fileset dir="${mc.libs.dir}">
  305 + <include name="**/*.jar" />
  306 + </fileset>
  307 + <fileset dir="${libs.dir}">
  308 + <include name="*.jar" />
  309 + </fileset>
  310 + <pathelement location="${mc.bin.dir}"/>
  311 + </classpath>
305 312 </javadoc>
306   - <jar destfile="${dist.dir}/${artefact.name}-javadoc.${filetype}" duplicate="preserve" index="true" manifestencoding="UTF-8">
307   - <manifest>
308   - <attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)" />
309   - <attribute name="Implementation-Vendor" value="${author}" />
310   - <attribute name="Implementation-Title" value="${ant.project.name}" />
311   - <attribute name="Implementation-Version" value="${version}" />
312   - </manifest>
313   - <fileset dir="${stage.dir}/docs" />
314   - </jar>
  313 + <jar destfile="${dist.dir}/${artefact.name}-javadoc.${filetype}" duplicate="preserve" index="true" manifestencoding="UTF-8">
  314 + <manifest>
  315 + <attribute name="Built-By" value="MCP (http://mcp.ocean-labs.de)" />
  316 + <attribute name="Implementation-Vendor" value="${author}" />
  317 + <attribute name="Implementation-Title" value="${ant.project.name}" />
  318 + <attribute name="Implementation-Version" value="${version}" />
  319 + </manifest>
  320 + <fileset dir="${stage.dir}/docs" />
  321 + </jar>
315 322 </target>
316 323  
317   - <property environment="env" />
318   -
319 324 <target name="deploy" depends="production" description="Deploy artifact to local minecraft installation in APPDATA">
320 325 <mkdir dir="${env.APPDATA}/.minecraft/libraries/com/mumfrey/liteloader/${mcversion}"/>
321 326 <copy todir="${env.APPDATA}/.minecraft/libraries/com/mumfrey/liteloader/${mcversion}" file="${dist.dir}/${artefact.name}.${filetype}" failonerror="false" overwrite="true" />
322   - <copy todir="${eclipse}/LiteLoaderInstaller/src/main/resources" file="${dist.dir}/${artefact.name}.${filetype}" failonerror="false" overwrite="true" />
  327 + <copy todir="${eclipse.dir}/LiteLoaderInstaller/src/main/resources" file="${dist.dir}/${artefact.name}.${filetype}" failonerror="false" overwrite="true" />
323 328 </target>
324 329 </project>
325 330 \ No newline at end of file
... ...
java/client/com/mumfrey/liteloader/client/gui/GuiLiteLoaderPanel.java
... ... @@ -124,6 +124,8 @@ public class GuiLiteLoaderPanel extends GuiScreen
124 124  
125 125 private String notification;
126 126  
  127 + private boolean isSnapshot;
  128 +
127 129 /**
128 130 * @param minecraft
129 131 * @param parentScreen
... ... @@ -151,6 +153,13 @@ public class GuiLiteLoaderPanel extends GuiScreen
151 153  
152 154 this.startupErrorCount = mods.getStartupErrorCount();
153 155 this.criticalErrorCount = mods.getCriticalErrorCount();
  156 +
  157 + String branding = LiteLoader.getBranding();
  158 + if (branding != null && branding.contains("SNAPSHOT"))
  159 + {
  160 + this.isSnapshot = true;
  161 + this.versionText = "\247c" + branding;
  162 + }
154 163 }
155 164  
156 165 /**
... ... @@ -264,7 +273,7 @@ public class GuiLiteLoaderPanel extends GuiScreen
264 273  
265 274 this.buttonList.add(new GuiHoverLabel(2, LEFT_EDGE + MARGIN, this.height - PANEL_BOTTOM + 9, this.fontRendererObj, I18n.format("gui.about.taboptions"), this.brandColour));
266 275  
267   - if (LiteLoaderVersion.getUpdateSite().canCheckForUpdate() && this.mc.theWorld == null)
  276 + if (LiteLoaderVersion.getUpdateSite().canCheckForUpdate() && this.mc.theWorld == null && !this.isSnapshot)
268 277 {
269 278 this.buttonList.add(new GuiHoverLabel(3, LEFT_EDGE + MARGIN + 38 + this.fontRendererObj.getStringWidth(this.versionText) + 6, 50, this.fontRendererObj, I18n.format("gui.about.checkupdates"), this.brandColour));
270 279 }
... ...
java/common/com/mumfrey/liteloader/util/net/LiteLoaderLogUpload.java
... ... @@ -13,6 +13,7 @@ import java.util.HashMap;
13 13 import java.util.Map;
14 14 import java.util.Map.Entry;
15 15  
  16 +import com.mumfrey.liteloader.core.LiteLoader;
16 17 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
17 18  
18 19 /**
... ... @@ -39,6 +40,8 @@ public class LiteLoaderLogUpload extends Thread
39 40 data.put("nick", nick);
40 41 data.put("uuid", uuid);
41 42 data.put("token", LITELOADER_KEY);
  43 + data.put("version", LiteLoader.getVersion());
  44 + data.put("brand", "" + LiteLoader.getBranding());
42 45 data.put("log", content);
43 46  
44 47 StringBuilder sb = new StringBuilder();
... ...