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 | |
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
-rw-r--r-- | bootstrap_scala/BootstrapScala.java | 24 | ||||
-rwxr-xr-x | cbt | 4 |
2 files changed, 17 insertions, 11 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 { } } - @@ -39,8 +39,8 @@ if [ ! $javac_installed -eq 0 ]; then fi javac_version=$(javac -version 2>&1 | cut -d ' ' -f 2) javac_version_minor=$(echo -n $javac_version | cut -d '.' -f 2) -if [ ! "$javac_version_minor" -ge "8" ]; then - echo "You need to install javac version 1.8 or greater! CBT currently relies on Java 8." 2>&1 +if [ ! "$javac_version_minor" -ge "7" ]; then + echo "You need to install javac version 1.7 or greater!" 2>&1 echo "Current javac version is $javac_version" 2>&1 exit 1 fi |