From 87d57275e29be71d0c6634fac5471cc96f6b5017 Mon Sep 17 00:00:00 2001 From: Tobias Johansson Date: Mon, 7 Mar 2016 00:58:58 +0100 Subject: Rewrite Java 8 code in BootstrapScala.java in Java 7 --- bootstrap_scala/BootstrapScala.java | 24 +++++++++++++++--------- 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 "); 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 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 { } } - diff --git a/cbt b/cbt index 1f8e3cc..d228e9f 100755 --- a/cbt +++ b/cbt @@ -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 -- cgit v1.2.3