Commits

md_5 authored 7954aca0ff4
Don't use Jacobe for formatting, add support for Mac systems.

Requires -Dmac.supported=true.
No tags

src/main/java/org/spigotmc/builder/Builder.java

Modified
51 51 import org.eclipse.jgit.revwalk.RevCommit;
52 52
53 53 public class Builder
54 54 {
55 55
56 56 public static final String LOG_FILE = "BuildTools.log.txt";
57 57 public static final boolean IS_WINDOWS = System.getProperty( "os.name" ).startsWith( "Windows" );
58 58 public static final boolean IS_MAC = System.getProperty( "os.name" ).startsWith( "Mac" );
59 59 public static final File CWD = new File( "." );
60 60 public static final String MC_VERSION = "1.8";
61 - private static final File jacobeDir = new File( "jacobe" );
62 61 private static boolean dontUpdate;
63 62 private static boolean skipCompile;
64 63
65 64 public static void main(String[] args) throws Exception
66 65 {
67 66 for ( String s : args )
68 67 {
69 68 if ( "--disable-certificate-check".equals( s ) )
70 69 {
71 70 disableHttpsCertificateCheck();
75 74 dontUpdate = true;
76 75 }
77 76 if ( "--skip-compile".endsWith( s ) )
78 77 {
79 78 skipCompile = true;
80 79 }
81 80 }
82 81
83 82 logOutput();
84 83
85 - if ( IS_MAC )
84 + if ( IS_MAC && !Boolean.getBoolean( "mac.supported" ) )
86 85 {
87 86 System.out.println( "Sorry, but Macintosh is not currently a supported platform for compilation at this time." );
88 - System.out.println( "Please run this script on a Windows or Linux PC and then copy the jars to this computer." );
87 + System.out.println( "If you feel like testing Macintosh support please run this script with the -Dmac.supported=true option." );
88 + System.out.println( "Else please run this script on a Windows or Linux PC and then copy the jars to this computer." );
89 89 System.exit( 1 );
90 90 }
91 91
92 92 try
93 93 {
94 94 runProcess( CWD, "bash", "-c", "exit" );
95 95 } catch ( Exception ex )
96 96 {
97 97 System.out.println( "You must run this jar through bash (msysgit)" );
98 98 System.exit( 1 );
135 135 {
136 136 clone( "https://hub.spigotmc.org/stash/scm/spigot/spigot.git", spigot );
137 137 }
138 138
139 139 File buildData = new File( "BuildData" );
140 140 if ( !buildData.exists() )
141 141 {
142 142 clone( "https://hub.spigotmc.org/stash/scm/spigot/builddata.git", buildData );
143 143 }
144 144
145 - if ( !jacobeDir.exists() )
146 - {
147 - System.out.println( "Jacobe does not exist, downloading" );
148 - getJacobe();
149 - }
150 -
151 145 File maven = new File( "apache-maven-3.2.3" );
152 146 if ( !maven.exists() )
153 147 {
154 148 System.out.println( "Maven does not exist, downloading. Please wait." );
155 149
156 150 File mvnTemp = new File( "mvn.zip" );
157 151 mvnTemp.deleteOnExit();
158 152
159 153 download( "http://static.spigotmc.org/maven/apache-maven-3.2.3-bin.zip", mvnTemp );
160 154 unzip( mvnTemp, new File( "." ) );
225 219 {
226 220
227 221 @Override
228 222 public boolean apply(String input)
229 223 {
230 224 return input.startsWith( "net/minecraft/server" );
231 225 }
232 226 } );
233 227
234 228 runProcess( CWD, "java", "-jar", "BuildData/bin/fernflower.jar", "-dgs=1", "-hdc=0", "-rbr=0", "-asc=1", clazzDir.getPath(), decompileDir.getPath() );
235 -
236 - String jacobePath = jacobeDir.getPath() + "/jacobe";
237 - if ( IS_WINDOWS )
238 - {
239 - jacobePath += ".exe";
240 - }
241 - runProcess( CWD, jacobePath, "-cfg=BuildData/bin/jacobe.cfg", "-nobackup", "-overwrite", "-outext=java", decompileDir + "/net/minecraft/server" );
242 229 }
243 230
244 231 System.out.println( "Applying CraftBukkit Patches" );
245 232 File nmsDir = new File( craftBukkit, "src/main/java/net" );
246 233 if ( nmsDir.exists() )
247 234 {
248 235 System.out.println( "Backing up NMS dir" );
249 236 FileUtils.moveDirectory( nmsDir, new File( workDir, "nms.old." + System.currentTimeMillis() ) );
250 237 }
251 238 File patchDir = new File( craftBukkit, "nms-patches" );
340 327 }
341 328 } );
342 329 for ( File file : files )
343 330 {
344 331 System.out.println( "Copying " + file.getName() + " to " + CWD.getAbsolutePath() );
345 332 Files.copy( file, new File( CWD, outJarName ) );
346 333 System.out.println( " - Saved as " + outJarName );
347 334 }
348 335 }
349 336
350 - public static void getJacobe() throws Exception
351 - {
352 - if ( IS_WINDOWS )
353 - {
354 - File jacobeWindows = new File( "jacobe.win32.zip" );
355 - download( "http://www.tiobe.com/content/products/jacobe/jacobe.win32.zip", jacobeWindows );
356 - unzip( jacobeWindows, jacobeDir );
357 - } else
358 - {
359 - File jacobeLinux = new File( "jacobe.linux.tar.gz" );
360 - download( "http://www.tiobe.com/content/products/jacobe/jacobe.linux.tar.gz", jacobeLinux );
361 -
362 - jacobeDir.mkdir();
363 - runProcess( CWD, "tar", "xzvf", jacobeLinux.getPath(), "-C", jacobeDir.getPath() );
364 - }
365 - }
366 -
367 337 public static void pull(Git repo) throws Exception
368 338 {
369 339 System.out.println( "Pulling updates for " + repo.getRepository().getDirectory() );
370 340
371 341 repo.reset().setRef( "origin/master" ).setMode( ResetCommand.ResetType.HARD ).call();
372 342 boolean result = repo.pull().call().isSuccessful();
373 343
374 344 if ( !result )
375 345 {
376 346 throw new RuntimeException( "Could not pull updates!" );

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut