diff options
author | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-06 19:26:01 -0500 |
---|---|---|
committer | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-06 19:26:01 -0500 |
commit | 757b585522233c610dd021810fc8f1189103948c (patch) | |
tree | 61c52d841f0d2d5772699c4ef798b44fdbaedbdc /bootstrap_scala/BootstrapScala.java | |
parent | 7804a00216486988af5272d75239fba078cfb09e (diff) | |
parent | 87d57275e29be71d0c6634fac5471cc96f6b5017 (diff) | |
download | cbt-757b585522233c610dd021810fc8f1189103948c.tar.gz cbt-757b585522233c610dd021810fc8f1189103948c.tar.bz2 cbt-757b585522233c610dd021810fc8f1189103948c.zip |
Merge pull request #56 from tobias-johansson/master
Rewrite Java 8 code in BootstrapScala.java in Java 7
Diffstat (limited to 'bootstrap_scala/BootstrapScala.java')
-rw-r--r-- | bootstrap_scala/BootstrapScala.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/bootstrap_scala/BootstrapScala.java b/bootstrap_scala/BootstrapScala.java index 9c2565c..a4a2ed1 100644 --- a/bootstrap_scala/BootstrapScala.java +++ b/bootstrap_scala/BootstrapScala.java @@ -10,6 +10,7 @@ import java.nio.file.StandardCopyOption; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; +import java.util.Iterator; import javax.xml.bind.annotation.adapters.HexBinaryAdapter; /** @@ -29,24 +30,30 @@ public class BootstrapScala { } public static void main(String args[]) throws IOException, NoSuchAlgorithmException { - + if(args.length < 2){ System.err.println("Usage: bootstrap_scala <scala version> <download directory>"); System.exit(1); } - + Dependency[] ds = dependencies( args[1], args[0] ); new File(args[1]).mkdirs(); for (Dependency d: ds) { download( d.url, d.path, d.hash ); } - System.out.println( - String.join( - File.pathSeparator, - Arrays.stream(ds).map(d -> d.path.toString()).toArray(String[]::new) - ) - ); + // Join dep. paths as a classpath + String classpath = ""; + Iterator<Dependency> depsIter = Arrays.asList(ds).iterator(); + while (depsIter.hasNext()) { + Dependency dep = depsIter.next(); + classpath += dep.path.toString(); + if (depsIter.hasNext()) { + classpath += File.pathSeparator; + } + } + + System.out.println(classpath); } @@ -76,4 +83,3 @@ public class BootstrapScala { } } - |