Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade scala and zinc #560

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions cbt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ if [ ! "$DEBUG" == "" ]; then
shift
fi

JAVA_OPTS_CBT=($DEBUG -Xmx1536m -Xss10M "-XX:MaxJavaStackTraceDepth=-1" -XX:+TieredCompilation "-XX:TieredStopAtLevel=1" -Xverify:none)
# shellcheck disable=SC2153
if [ -z "${JAVA_OPTS_CBT+x}" ]; then
_JAVA_OPTS_CBT=($DEBUG -Xmx1536m -Xss10M "-XX:MaxJavaStackTraceDepth=-1" -XX:+TieredCompilation "-XX:TieredStopAtLevel=1" -Xverify:none)
else
_JAVA_OPTS_CBT=($DEBUG $JAVA_OPTS_CBT)
fi

# ng on osx, install via brew install nailgun
# ng-nailgun on unbuntu, install via apt-get install nailgun
Expand Down Expand Up @@ -214,7 +219,7 @@ fi
if [ $use_nailgun -eq 0 ] && [ ! $server_up -eq 0 ]; then
log "Starting background process (nailgun)" "$@"
# try to start nailgun-server, just in case it's not up
java "${options[@]}" "${JAVA_OPTS_CBT[@]}" -jar "$NG_SERVER_JAR" 127.0.0.1:$NAILGUN_PORT >> "$nailgun_out" 2>> "$nailgun_err" &
java "${_JAVA_OPTS_CBT[@]}" -jar "$NG_SERVER_JAR" 127.0.0.1:$NAILGUN_PORT >> "$nailgun_out" 2>> "$nailgun_err" &
if [ ! "$DEBUG" == "" ]; then
echo "Started nailgun server in debug mode"
exit 1
Expand Down Expand Up @@ -243,7 +248,7 @@ stage1 () {
touch -t "$COMPILE_TIME" "$NAILGUN_INDICATOR"
if [ $use_nailgun -eq 0 ]; then
echo "Starting background process (nailgun)" 1>&2
java "${options[@]}" "${JAVA_OPTS_CBT[@]}" -jar "$NG_SERVER_JAR" 127.0.0.1:$NAILGUN_PORT >> "$nailgun_out" 2>> "$nailgun_err" &
java "${_JAVA_OPTS_CBT[@]}" -jar "$NG_SERVER_JAR" 127.0.0.1:$NAILGUN_PORT >> "$nailgun_out" 2>> "$nailgun_err" &
sleep 1
fi
fi
Expand All @@ -255,9 +260,8 @@ stage1 () {
if [ ! $use_nailgun -eq 0 ]
then
log "Running JVM directly" "$@"
options=($JAVA_OPTS)
# JVM options to improve startup time. See https://github.com/cvogt/cbt/pull/262
java "${options[@]}" "${JAVA_OPTS_CBT[@]}" -cp "$NAILGUN$TARGET" cbt.NailgunLauncher "$(time_taken)" "$CWD" "$loop" "$@"
java "${_JAVA_OPTS_CBT[@]}" -cp "$NAILGUN$TARGET" cbt.NailgunLauncher "$(time_taken)" "$CWD" "$loop" "$@"
exitCode=$?
else
log "Running via background process (nailgun)" "$@"
Expand Down
6 changes: 6 additions & 0 deletions compatibility/build/build.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package cbt_build.compatibility
import cbt._
class Build(val context: Context) extends BaseBuild{
// don't depend on Scala, not needed
override def dependencies = Seq()
}
116 changes: 58 additions & 58 deletions nailgun_launcher/EarlyDependencies.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

public class EarlyDependencies{

public static String scalaVersion = "2.11.8";
public static String scalaVersion = "2.11.11";
public static String scalaXmlVersion = "1.0.6";
public static String zincVersion = "0.3.13";
public static String zincVersion = "0.3.15";

/** ClassLoader for stage1 */
ClassLoader classLoader;
Expand All @@ -29,20 +29,20 @@ public class EarlyDependencies{
public EarlyDependencies(
String mavenCache, String mavenUrl, ClassLoaderCache classLoaderCache, ClassLoader rootClassLoader
) throws Throwable {
String scalaReflect_2_11_8_File = mavenCache + "/org/scala-lang/scala-reflect/2.11.8/scala-reflect-2.11.8.jar";
String scalaCompiler_2_11_8_File = mavenCache + "/org/scala-lang/scala-compiler/2.11.8/scala-compiler-2.11.8.jar";
String scalaReflect_2_11_11_File = mavenCache + "/org/scala-lang/scala-reflect/2.11.11/scala-reflect-2.11.11.jar";
String scalaCompiler_2_11_11_File = mavenCache + "/org/scala-lang/scala-compiler/2.11.11/scala-compiler-2.11.11.jar";
String scalaXml_1_0_6_File = mavenCache + "/org/scala-lang/modules/scala-xml_2.11/1.0.6/scala-xml_2.11-1.0.6.jar";
String scalaLibrary_2_11_8_File = mavenCache + "/org/scala-lang/scala-library/2.11.8/scala-library-2.11.8.jar";
String zinc_0_3_13_File = mavenCache + "/com/typesafe/zinc/zinc/0.3.13/zinc-0.3.13.jar";
String incrementalCompiler_0_13_13_File = mavenCache + "/com/typesafe/sbt/incremental-compiler/0.13.13/incremental-compiler-0.13.13.jar";
String compilerInterface_0_13_13_File = mavenCache + "/com/typesafe/sbt/compiler-interface/0.13.13/compiler-interface-0.13.13-sources.jar";
String scalaLibrary_2_11_11_File = mavenCache + "/org/scala-lang/scala-library/2.11.11/scala-library-2.11.11.jar";
String zinc_0_3_15_File = mavenCache + "/com/typesafe/zinc/zinc/0.3.15/zinc-0.3.15.jar";
String incrementalCompiler_0_13_15_File = mavenCache + "/com/typesafe/sbt/incremental-compiler/0.13.15/incremental-compiler-0.13.15.jar";
String compilerInterface_0_13_15_File = mavenCache + "/com/typesafe/sbt/compiler-interface/0.13.15/compiler-interface-0.13.15-sources.jar";
String scalaCompiler_2_10_6_File = mavenCache + "/org/scala-lang/scala-compiler/2.10.6/scala-compiler-2.10.6.jar";
String sbtInterface_0_13_13_File = mavenCache + "/com/typesafe/sbt/sbt-interface/0.13.13/sbt-interface-0.13.13.jar";
String sbtInterface_0_13_15_File = mavenCache + "/com/typesafe/sbt/sbt-interface/0.13.15/sbt-interface-0.13.15.jar";
String scalaReflect_2_10_6_File = mavenCache + "/org/scala-lang/scala-reflect/2.10.6/scala-reflect-2.10.6.jar";
String scalaLibrary_2_10_6_File = mavenCache + "/org/scala-lang/scala-library/2.10.6/scala-library-2.10.6.jar";

download(new URL(mavenUrl + "/org/scala-lang/scala-reflect/2.11.8/scala-reflect-2.11.8.jar"), Paths.get(scalaReflect_2_11_8_File), "b74530deeba742ab4f3134de0c2da0edc49ca361");
download(new URL(mavenUrl + "/org/scala-lang/scala-compiler/2.11.8/scala-compiler-2.11.8.jar"), Paths.get(scalaCompiler_2_11_8_File), "fe1285c9f7b58954c5ef6d80b59063569c065e9a");
download(new URL(mavenUrl + "/org/scala-lang/scala-reflect/2.11.11/scala-reflect-2.11.11.jar"), Paths.get(scalaReflect_2_11_11_File), "2addc7e09cf2e77e2243a5772bd0430c32c2b410");
download(new URL(mavenUrl + "/org/scala-lang/scala-compiler/2.11.11/scala-compiler-2.11.11.jar"), Paths.get(scalaCompiler_2_11_11_File), "2f1568549280da6d0a332846cb7c27edae76fd10");

// org.scala-lang:scala-library:2.10.6
String[] scalaLibrary_2_10_6_ClasspathArray = new String[]{scalaLibrary_2_10_6_File};
Expand All @@ -66,92 +66,92 @@ public EarlyDependencies(
scalaReflect_2_10_6_ClasspathArray
);

// com.typesafe.sbt:sbt-interface:0.13.13
String[] sbtInterface_0_13_13_ClasspathArray = new String[]{sbtInterface_0_13_13_File, scalaLibrary_2_10_6_File, scalaReflect_2_10_6_File};
ClassLoader sbtInterface_0_13_13_ = loadDependency(
mavenUrl + "/com/typesafe/sbt/sbt-interface/0.13.13/sbt-interface-0.13.13.jar",
sbtInterface_0_13_13_File,
"9367c5c7a835f9505774fc3b7c3a8146a1396f85",
// com.typesafe.sbt:sbt-interface:0.13.15
String[] sbtInterface_0_13_15_ClasspathArray = new String[]{sbtInterface_0_13_15_File, scalaLibrary_2_10_6_File, scalaReflect_2_10_6_File};
ClassLoader sbtInterface_0_13_15_ = loadDependency(
mavenUrl + "/com/typesafe/sbt/sbt-interface/0.13.15/sbt-interface-0.13.15.jar",
sbtInterface_0_13_15_File,
"93fe450d5f5efb111397a34bc1fba0d50368a265",
classLoaderCache,
scalaReflect_2_10_6_,
sbtInterface_0_13_13_ClasspathArray
sbtInterface_0_13_15_ClasspathArray
);

// org.scala-lang:scala-compiler:2.10.6
String[] scalaCompiler_2_10_6_ClasspathArray = new String[]{sbtInterface_0_13_13_File, scalaCompiler_2_10_6_File, scalaLibrary_2_10_6_File, scalaReflect_2_10_6_File};
String[] scalaCompiler_2_10_6_ClasspathArray = new String[]{sbtInterface_0_13_15_File, scalaCompiler_2_10_6_File, scalaLibrary_2_10_6_File, scalaReflect_2_10_6_File};
ClassLoader scalaCompiler_2_10_6_ = loadDependency(
mavenUrl + "/org/scala-lang/scala-compiler/2.10.6/scala-compiler-2.10.6.jar",
scalaCompiler_2_10_6_File,
"9b15174852f5b6bb1edbf303d5722286a0a54011",
classLoaderCache,
sbtInterface_0_13_13_,
sbtInterface_0_13_15_,
scalaCompiler_2_10_6_ClasspathArray
);

// com.typesafe.sbt:compiler-interface:0.13.13
String[] compilerInterface_0_13_13_ClasspathArray = new String[]{compilerInterface_0_13_13_File, sbtInterface_0_13_13_File, scalaCompiler_2_10_6_File, scalaLibrary_2_10_6_File, scalaReflect_2_10_6_File};
ClassLoader compilerInterface_0_13_13_ = loadDependency(
mavenUrl + "/com/typesafe/sbt/compiler-interface/0.13.13/compiler-interface-0.13.13-sources.jar",
compilerInterface_0_13_13_File,
"691bf88813bb34771c0ca4418d579bb652e1526f",
// com.typesafe.sbt:compiler-interface:0.13.15
String[] compilerInterface_0_13_15_ClasspathArray = new String[]{compilerInterface_0_13_15_File, sbtInterface_0_13_15_File, scalaCompiler_2_10_6_File, scalaLibrary_2_10_6_File, scalaReflect_2_10_6_File};
ClassLoader compilerInterface_0_13_15_ = loadDependency(
mavenUrl + "/com/typesafe/sbt/compiler-interface/0.13.15/compiler-interface-0.13.15-sources.jar",
compilerInterface_0_13_15_File,
"bad996ed4fc3e83b872525e9cd7b80d81b98a324",
classLoaderCache,
scalaCompiler_2_10_6_,
compilerInterface_0_13_13_ClasspathArray
compilerInterface_0_13_15_ClasspathArray
);

// com.typesafe.sbt:incremental-compiler:0.13.13
String[] incrementalCompiler_0_13_13_ClasspathArray = new String[]{compilerInterface_0_13_13_File, incrementalCompiler_0_13_13_File, sbtInterface_0_13_13_File, scalaCompiler_2_10_6_File, scalaLibrary_2_10_6_File, scalaReflect_2_10_6_File};
ClassLoader incrementalCompiler_0_13_13_ = loadDependency(
mavenUrl + "/com/typesafe/sbt/incremental-compiler/0.13.13/incremental-compiler-0.13.13.jar",
incrementalCompiler_0_13_13_File,
"65008fb90b965ea44d0959b8a2e214df206cda6e",
// com.typesafe.sbt:incremental-compiler:0.13.15
String[] incrementalCompiler_0_13_15_ClasspathArray = new String[]{compilerInterface_0_13_15_File, incrementalCompiler_0_13_15_File, sbtInterface_0_13_15_File, scalaCompiler_2_10_6_File, scalaLibrary_2_10_6_File, scalaReflect_2_10_6_File};
ClassLoader incrementalCompiler_0_13_15_ = loadDependency(
mavenUrl + "/com/typesafe/sbt/incremental-compiler/0.13.15/incremental-compiler-0.13.15.jar",
incrementalCompiler_0_13_15_File,
"95e20d00b25a7aae19838009c11578b7e6b258ad",
classLoaderCache,
compilerInterface_0_13_13_,
incrementalCompiler_0_13_13_ClasspathArray
compilerInterface_0_13_15_,
incrementalCompiler_0_13_15_ClasspathArray
);

// com.typesafe.zinc:zinc:0.3.13
String[] zinc_0_3_13_ClasspathArray = new String[]{compilerInterface_0_13_13_File, incrementalCompiler_0_13_13_File, sbtInterface_0_13_13_File, zinc_0_3_13_File, scalaCompiler_2_10_6_File, scalaLibrary_2_10_6_File, scalaReflect_2_10_6_File};
ClassLoader zinc_0_3_13_ = loadDependency(
mavenUrl + "/com/typesafe/zinc/zinc/0.3.13/zinc-0.3.13.jar",
zinc_0_3_13_File,
"ae0dcd6105d6e87ece2d181c5f0f7a79a966775a",
// com.typesafe.zinc:zinc:0.3.15
String[] zinc_0_3_15_ClasspathArray = new String[]{compilerInterface_0_13_15_File, incrementalCompiler_0_13_15_File, sbtInterface_0_13_15_File, zinc_0_3_15_File, scalaCompiler_2_10_6_File, scalaLibrary_2_10_6_File, scalaReflect_2_10_6_File};
ClassLoader zinc_0_3_15_ = loadDependency(
mavenUrl + "/com/typesafe/zinc/zinc/0.3.15/zinc-0.3.15.jar",
zinc_0_3_15_File,
"12e1f782684f2702e847faa0994eed4711270687",
classLoaderCache,
incrementalCompiler_0_13_13_,
zinc_0_3_13_ClasspathArray
incrementalCompiler_0_13_15_,
zinc_0_3_15_ClasspathArray
);

// org.scala-lang:scala-library:2.11.8
String[] scalaLibrary_2_11_8_ClasspathArray = new String[]{scalaLibrary_2_11_8_File};
ClassLoader scalaLibrary_2_11_8_ = loadDependency(
mavenUrl + "/org/scala-lang/scala-library/2.11.8/scala-library-2.11.8.jar",
scalaLibrary_2_11_8_File,
"ddd5a8bced249bedd86fb4578a39b9fb71480573",
// org.scala-lang:scala-library:2.11.11
String[] scalaLibrary_2_11_11_ClasspathArray = new String[]{scalaLibrary_2_11_11_File};
ClassLoader scalaLibrary_2_11_11_ = loadDependency(
mavenUrl + "/org/scala-lang/scala-library/2.11.11/scala-library-2.11.11.jar",
scalaLibrary_2_11_11_File,
"e283d2b7fde6504f6a86458b1f6af465353907cc",
classLoaderCache,
rootClassLoader,
scalaLibrary_2_11_8_ClasspathArray
scalaLibrary_2_11_11_ClasspathArray
);

// org.scala-lang.modules:scala-xml_2.11:1.0.6
String[] scalaXml_1_0_6_ClasspathArray = new String[]{scalaXml_1_0_6_File, scalaLibrary_2_11_8_File};
String[] scalaXml_1_0_6_ClasspathArray = new String[]{scalaXml_1_0_6_File, scalaLibrary_2_11_11_File};
ClassLoader scalaXml_1_0_6_ = loadDependency(
mavenUrl + "/org/scala-lang/modules/scala-xml_2.11/1.0.6/scala-xml_2.11-1.0.6.jar",
scalaXml_1_0_6_File,
"4ebd108453e6455351c0ec50d32509ae1154fdb1",
classLoaderCache,
scalaLibrary_2_11_8_,
scalaLibrary_2_11_11_,
scalaXml_1_0_6_ClasspathArray
);

classLoader = scalaXml_1_0_6_;
classpathArray = scalaXml_1_0_6_ClasspathArray;

zinc = zinc_0_3_13_;
zinc = zinc_0_3_15_;

scalaCompiler_File = scalaCompiler_2_11_8_File;
scalaLibrary_File = scalaLibrary_2_11_8_File;
scalaReflect_File = scalaReflect_2_11_8_File;
sbtInterface_File = sbtInterface_0_13_13_File;
compilerInterface_File = compilerInterface_0_13_13_File;
scalaCompiler_File = scalaCompiler_2_11_11_File;
scalaLibrary_File = scalaLibrary_2_11_11_File;
scalaReflect_File = scalaReflect_2_11_11_File;
sbtInterface_File = sbtInterface_0_13_15_File;
compilerInterface_File = compilerInterface_0_13_15_File;
}
}
11 changes: 11 additions & 0 deletions nailgun_launcher/build/build.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package cbt_build.nailgun_launcher
import cbt._
class Build(val context: Context) extends BaseBuild{
// nailgun launcher doesn't need Scala. In fact not
// removing it here will lead to conflicts when
// is is loaded as a DirectoryDependency in
// loadCustomBuildWithDifferentCbtVersion
// because depending on a specific scala version conflicts
// with whatever scala version the host cbt runs
override def dependencies = Seq()
}
2 changes: 1 addition & 1 deletion stage1/ClassPath.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ case class ClassPath(files: Seq[File] = Seq()){
private val nonExisting = files.distinct.filterNot(_.exists)
assert(
nonExisting.isEmpty,
"Classpath contains entires that don't exist on disk:\n" ++ nonExisting.mkString("\n") ++ "\nin classpath:\n"++string
"Classpath contains entries that don't exist on disk:\n" ++ nonExisting.mkString("\n") ++ "\nin classpath:\n"++string
)

def +:(file: File) = ClassPath(file +: files)
Expand Down
4 changes: 2 additions & 2 deletions stage1/Stage1Lib.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class Stage1Lib( logger: Logger ) extends
None
}
}.getOrElse{
System.err.println("System.console() == null. Use `cbt direct <task>` or see https://github.com/cvogt/cbt/issues/236")
None
throw new Exception("System.console() == null. Use `cbt direct <task>` or see https://github.com/cvogt/cbt/issues/236")
//None
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions stage1/resolver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ trait DependencyImplementation extends Dependency{
throw new RuntimeException( "No main class found in " + this )
)

def mainClasses = classes.filter( lib.findMain(_).nonEmpty )

def mainClass = lib.pickOne(
"Which one do you want to run?",
classes.filter( lib.findMain(_).nonEmpty )
mainClasses
)( _.name.stripSuffix( "$" ) )

def classes = exportedClasspath.files.flatMap(
Expand Down Expand Up @@ -294,7 +296,7 @@ case class BoundMavenDependency(
file
}

private def resolveHash(suffix: String, useClassifier: Boolean) = {
private def resolveHash(suffix: String, useClassifier: Boolean): String = {
val path = resolve( suffix ++ ".sha1", None, useClassifier ).toPath
Option( classLoaderCache.hashMap.get("hash:"+path) ).map(_.asInstanceOf[String]).getOrElse{
val result = Files.readAllLines(
Expand Down
2 changes: 1 addition & 1 deletion test/library-test/build/build.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cbt._

// cbt:https://github.com/cvogt/cbt.git#f11b8318b85f16843d8cfa0743f64c1576614ad6
// cbt:https://github.com/cvogt/cbt.git#2ab3402e4899e722905a3a5a0825c5af38706303
class Build(val context: Context) extends BaseBuild with PackageJars{
def groupId = "cbt.test"
def version = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion test/simple-fixed-cbt/build/build.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cbt._

// cbt:https://github.com/cvogt/cbt.git#f11b8318b85f16843d8cfa0743f64c1576614ad6
// cbt:https://github.com/cvogt/cbt.git#2ab3402e4899e722905a3a5a0825c5af38706303
class Build(val context: cbt.Context) extends PackageJars{
override def dependencies = super.dependencies ++ Seq(
DirectoryDependency( context.cbtHome ++ "/test/library-test" )
Expand Down
2 changes: 1 addition & 1 deletion test/simple-fixed/build/build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Build(context: cbt.Context) extends BasicBuild(context){
super.dependencies
++
Seq(
GitDependency("https://github.com/cvogt/cbt.git", "f11b8318b85f16843d8cfa0743f64c1576614ad6", Some("test/library-test"))
GitDependency("https://github.com/cvogt/cbt.git", "2ab3402e4899e722905a3a5a0825c5af38706303", Some("test/library-test"))
)
)
}