From d46b1713321b1c8c2e400699ecefc57556a86515 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 7 Dec 2014 00:35:01 -0500 Subject: Copy final jars to current directory This should help users find the .jar to use. --- src/main/java/org/spigotmc/builder/Builder.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src') diff --git a/src/main/java/org/spigotmc/builder/Builder.java b/src/main/java/org/spigotmc/builder/Builder.java index 45971b5..ba9ff81 100644 --- a/src/main/java/org/spigotmc/builder/Builder.java +++ b/src/main/java/org/spigotmc/builder/Builder.java @@ -16,6 +16,7 @@ import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; +import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -273,6 +274,29 @@ public class Builder ex.printStackTrace(); System.exit( 1 ); } + + for ( int i = 0; i < 35; i++ ) System.out.println( " " ); + System.out.println( "Success! Everything compiled successfully. Copying final .jar files now." ); + copyJar( "CraftBukkit/target", "craftbukkit", "craftbukkit-" + MC_VERSION + ".jar" ); + copyJar( "Spigot/Spigot-Server/target", "spigot", "spigot-" + MC_VERSION + ".jar" ); + } + + public static void copyJar( String path, final String jarPrefix, String outJarName ) throws Exception + { + File[] files = new File( path ).listFiles( new FilenameFilter() + { + @Override + public boolean accept( File dir, String name ) + { + return name.startsWith( jarPrefix ) && name.endsWith( ".jar" ); + } + } ); + for ( File file : files ) + { + System.out.println( "Copying " + file.getName() + " to " + CWD.getAbsolutePath() ); + Files.copy( file, new File( CWD, outJarName ) ); + System.out.println( " - Saved as " + outJarName ); + } } public static void getJacobe() throws Exception -- cgit v1.2.3