diff options
author | Tobias Johansson <tobias.j.e.johansson@gmail.com> | 2016-03-07 00:58:58 +0100 |
---|---|---|
committer | Tobias Johansson <tobias.j.e.johansson@gmail.com> | 2016-03-07 01:14:46 +0100 |
commit | 87d57275e29be71d0c6634fac5471cc96f6b5017 (patch) | |
tree | 510aab270fba783c73ebe8fc4b24b1612a6e71ec | |
parent | 5488e70259e41884d0739ba56e5fecea46aab50a (diff) | |
download | cbt-87d57275e29be71d0c6634fac5471cc96f6b5017.tar.gz cbt-87d57275e29be71d0c6634fac5471cc96f6b5017.tar.bz2 cbt-87d57275e29be71d0c6634fac5471cc96f6b5017.zip |
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 |