Subversion Repository Public Repository

litesoft

Diff Revisions 315 vs 318 for /trunk/Java/ScarPlus/src/com/esotericsoftware/scar/Scar.java

Diff revisions: vs.
  @@ -758,88 +758,6 @@
758 758 return zipFile;
759 759 }
760 760
761 - /**
762 - * Decodes the specified ZIP file.
763 - *
764 - * @return The path to the output directory.
765 - */
766 - public String unzip( String zipFile, String outputDir )
767 - {
768 - Util.assertNotNull( "zipFile", zipFile );
769 - Util.assertNotNull( "outputDir", outputDir );
770 - progress( "ZIP decoding: " + zipFile + " -> " + outputDir );
771 -
772 - ZipInputStream input;
773 - try
774 - {
775 - input = new ZipInputStream( new FileInputStream( zipFile ) );
776 - }
777 - catch ( FileNotFoundException e )
778 - {
779 - throw new WrappedIOException( e );
780 - }
781 - try
782 - {
783 - while ( true )
784 - {
785 - ZipEntry entry;
786 - try
787 - {
788 - entry = input.getNextEntry();
789 - }
790 - catch ( IOException e )
791 - {
792 - throw new WrappedIOException( e );
793 - }
794 - if ( entry == null )
795 - {
796 - break;
797 - }
798 - File file = new File( outputDir, entry.getName() );
799 - if ( entry.isDirectory() )
800 - {
801 - mkdir( file.getPath() );
802 - continue;
803 - }
804 - mkdir( file.getParent() );
805 - FileOutputStream output;
806 - try
807 - {
808 - output = new FileOutputStream( file );
809 - }
810 - catch ( FileNotFoundException e )
811 - {
812 - throw new WrappedIOException( e );
813 - }
814 - try
815 - {
816 - byte[] buffer = new byte[4096];
817 - while ( true )
818 - {
819 - int length = input.read( buffer );
820 - if ( length == -1 )
821 - {
822 - break;
823 - }
824 - output.write( buffer, 0, length );
825 - }
826 - }
827 - catch ( IOException e )
828 - {
829 - throw new WrappedIOException( e );
830 - }
831 - finally
832 - {
833 - dispose( output );
834 - }
835 - }
836 - }
837 - finally
838 - {
839 - dispose( input );
840 - }
841 - return outputDir;
842 - }
843 761
844 762 /**
845 763 * Encodes the specified file with LZMA. The resulting filename is the filename plus ".lzma". The file is deleted after
  @@ -1281,64 +1199,6 @@
1281 1199 }
1282 1200
1283 1201 /**
1284 - * Unzips all JARs in the "dist" directory and creates a single JAR containing those files in the "dist/onejar" directory. The
1285 - * manifest from the project's JAR is used. Putting everything into a single JAR makes it harder to see what libraries are
1286 - * being used, but makes it easier for end users to distribute the application.
1287 - * <p/>
1288 - * Note: Files with the same path in different JARs will be overwritten. Files in the project's JAR will never be overwritten,
1289 - * but may overwrite other files.
1290 - *
1291 - * @param excludeJARs The names of any JARs to exclude.
1292 - */
1293 - public void oneJAR( Project project, String... excludeJARs )
1294 - {
1295 - Util.assertNotNull( "Project", project );
1296 -
1297 - progress( "One JAR: " + project );
1298 -
1299 - String onejarDir = mkdir( project.path( "$target$/onejar/" ) );
1300 - String distDir = project.path( "$target$/dist/" );
1301 - String projectJarName;
1302 - if ( project.hasVersion() )
1303 - {
1304 - projectJarName = project.format( "$name$-$version$.jar" );
1305 - }
1306 - else
1307 - {
1308 - projectJarName = project.format( "$name$.jar" );
1309 - }
1310 -
1311 - ArrayList<String> processedJARs = new ArrayList();
1312 - outer:
1313 - for ( String jarFile : new Paths( distDir, "*.jar", "!" + projectJarName ).getFullPaths() )
1314 - {
1315 - String jarName = fileName( jarFile );
1316 - for ( String exclude : excludeJARs )
1317 - {
1318 - if ( jarName.equals( exclude ) )
1319 - {
1320 - continue outer;
1321 - }
1322 - }
1323 - unzip( jarFile, onejarDir );
1324 - processedJARs.add( jarFile );
1325 - }
1326 - unzip( distDir + projectJarName, onejarDir );
1327 -
1328 - String onejarFile;
1329 - if ( project.hasVersion() )
1330 - {
1331 - onejarFile = project.path( "$target$/dist/onejar/$name$-$version$-all.jar" );
1332 - }
1333 - else
1334 - {
1335 - onejarFile = project.path( "$target$/dist/onejar/$name$-all.jar" );
1336 - }
1337 - mkdir( parent( onejarFile ) );
1338 - // todo: jar( onejarFile, new Paths( onejarDir ) );
1339 - }
1340 -
1341 - /**
1342 1202 * Compiles and executes the specified Java code. The code is compiled as if it were a Java method body.
1343 1203 * <p/>
1344 1204 * Imports statements can be used at the start of the code. These imports are automatically used:<br>