Commits

md_5 authored 93595221756
Update to pull Jacobe directly from the TIOBE site.
No tags

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

Modified
34 34 import org.eclipse.jgit.api.errors.GitAPIException;
35 35 import org.eclipse.jgit.revwalk.RevCommit;
36 36
37 37 public class Builder
38 38 {
39 39
40 40 public static final boolean IS_WINDOWS = System.getProperty( "os.name" ).startsWith( "Windows" );
41 41 public static final boolean IS_MAC = System.getProperty( "os.name" ).startsWith( "Mac" );
42 42 public static final File CWD = new File( "." );
43 43 public static final String MC_VERSION = "1.8";
44 + private static final File jacobeDir = new File( "jacobe" );
44 45
45 46 public static void main(String[] args) throws Exception
46 47 {
47 48 if ( IS_MAC )
48 49 {
49 50 System.out.println( "Sorry, but Macintosh is not currently a supported platform for compilation at this time." );
50 51 System.out.println( "Please run this script on a Windows or Linux PC and then copy the jars to this computer." );
51 52 return;
52 53 }
53 54
97 98 {
98 99 clone( "https://hub.spigotmc.org/stash/scm/spigot/spigot.git", spigot );
99 100 }
100 101
101 102 File buildData = new File( "BuildData" );
102 103 if ( !buildData.exists() )
103 104 {
104 105 clone( "https://hub.spigotmc.org/stash/scm/spigot/builddata.git", buildData );
105 106 }
106 107
108 + if ( !jacobeDir.exists() )
109 + {
110 + System.out.println( "Jacobe does not exist, downloading" );
111 + getJacobe();
112 + }
113 +
107 114 File maven = new File( "apache-maven-3.2.3" );
108 115 if ( !maven.exists() )
109 116 {
110 117 System.out.println( "Maven does not exist, downloading. Please wait." );
111 118
112 119 File mvnTemp = new File( "mvn.zip" );
113 120 mvnTemp.deleteOnExit();
114 121
115 122 download( "http://static.spigotmc.org/maven/apache-maven-3.2.3-bin.zip", mvnTemp );
116 123 unzip( mvnTemp, new File( "." ) );
182 189
183 190 @Override
184 191 public boolean apply(String input)
185 192 {
186 193 return input.startsWith( "net/minecraft/server" );
187 194 }
188 195 } );
189 196
190 197 runProcess( "java -jar BuildData/bin/fernflower.jar -dgs=1 -hdc=0 -rbr=0 -asc=1 " + clazzDir + " " + decompileDir, CWD );
191 198
192 - String jacobePath = "BuildData/bin/jacobe";
199 + String jacobePath = jacobeDir.getPath() + "/jacobe";
193 200 if ( IS_WINDOWS )
194 201 {
195 202 jacobePath += ".exe";
196 203 }
197 204 runProcess( jacobePath + " -cfg=BuildData/bin/jacobe.cfg -nobackup -overwrite -outext=java " + decompileDir + "/net/minecraft/server", CWD );
198 205 }
199 206
200 207 System.out.println( "Applying CraftBukkit Patches" );
201 208 File nmsDir = new File( craftBukkit, "src/main/java/net" );
202 209 if ( nmsDir.exists() )
262 269 System.out.println( "*** Spigot patches applied!" );
263 270 System.out.println( "Compiling Spigot & Spigot-API" );
264 271 runProcess( mvnCmd + " clean install", spigot );
265 272 } catch ( Exception ex )
266 273 {
267 274 System.err.println( "Error compiling Spigot, are you running this jar via msysgit?" );
268 275 ex.printStackTrace();
269 276 }
270 277 }
271 278
279 + public static void getJacobe() throws Exception
280 + {
281 + if ( IS_WINDOWS )
282 + {
283 + File jacobeWindows = new File( "jacobe.win32.zip" );
284 + download( "http://www.tiobe.com/content/products/jacobe/jacobe.win32.zip", jacobeWindows );
285 + unzip( jacobeWindows, jacobeDir );
286 + } else
287 + {
288 + File jacobeLinux = new File( "jacobe.linux.tar.gz" );
289 + download( "http://www.tiobe.com/content/products/jacobe/jacobe.linux.tar.gz", jacobeLinux );
290 +
291 + jacobeDir.mkdir();
292 + runProcess( "tar xzvf " + jacobeLinux.getPath() + " -C " + jacobeDir.getPath(), CWD );
293 + }
294 + }
295 +
272 296 public static void pull(Git repo) throws Exception
273 297 {
274 298 System.out.println( "Pulling updates for " + repo.getRepository().getDirectory() );
275 299
276 300 repo.reset().setRef( "origin/master" ).setMode( ResetCommand.ResetType.HARD ).call();
277 301 boolean result = repo.pull().call().isSuccessful();
278 302
279 303 if ( !result )
280 304 {
281 305 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