aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Christopher Vogt <oss.nsp@cvogt.org>2017-03-07 08:15:19 -0500
committerGitHub <noreply@github.com>2017-03-07 08:15:19 -0500
commit34ee0fd1015a4aa0c657dbd3a53b9d3c908045b9 (patch)
treec90d55afd62d25f3b5362e053115e5453560f030
parent3882bd543a860ca64a9639ecd46868d8f4ad858e (diff)
parent92de237d66e74e44087f13541cfdd04389894a76 (diff)
downloadcbt-34ee0fd1015a4aa0c657dbd3a53b9d3c908045b9.tar.gz
cbt-34ee0fd1015a4aa0c657dbd3a53b9d3c908045b9.tar.bz2
cbt-34ee0fd1015a4aa0c657dbd3a53b9d3c908045b9.zip
Merge pull request #392 from cvogt/chris
Chris
-rw-r--r--nailgun_launcher/Stage0Lib.java2
-rw-r--r--stage1/Stage1Lib.scala2
-rw-r--r--stage1/cbt.scala2
-rw-r--r--stage1/resolver.scala3
-rw-r--r--stage2/BasicBuild.scala18
5 files changed, 14 insertions, 13 deletions
diff --git a/nailgun_launcher/Stage0Lib.java b/nailgun_launcher/Stage0Lib.java
index 6057c21..8ab6150 100644
--- a/nailgun_launcher/Stage0Lib.java
+++ b/nailgun_launcher/Stage0Lib.java
@@ -204,7 +204,7 @@ public class Stage0Lib{
if(sha1 == null || sha1.toLowerCase().equals(checksum)) {
Files.move(unverified, target, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
} else {
- System.err.println(target + " checksum does not match.\nExpected: |" + sha1 + "|\nFound: |" + checksum + "|");
+ System.err.println(unverified + " checksum does not match.\nExpected: |" + sha1 + "|\nFound: |" + checksum + "|");
System.exit(1);
}
}
diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala
index 91e63f1..c46e00c 100644
--- a/stage1/Stage1Lib.scala
+++ b/stage1/Stage1Lib.scala
@@ -98,7 +98,7 @@ class Stage1Lib( logger: Logger ) extends BaseLib{
}
// ========== compilation / execution ==========
-
+ // TODO: move classLoader first
def runMain( cls: String, args: Seq[String], classLoader: ClassLoader, fakeInstance: Boolean = false ): ExitCode = {
import java.lang.reflect.Modifier
logger.run(s"Running $cls.main($args) with classLoader: " ++ classLoader.toString)
diff --git a/stage1/cbt.scala b/stage1/cbt.scala
index 0305dd2..062e11d 100644
--- a/stage1/cbt.scala
+++ b/stage1/cbt.scala
@@ -61,6 +61,8 @@ object `package`{
)
}
+ def lastModifiedRecursive = listRecursive.map(_.lastModified).max
+
def readAsString = new String( readAllBytes( file.toPath ) )
}
implicit class URLExtensionMethods( url: URL ){
diff --git a/stage1/resolver.scala b/stage1/resolver.scala
index 6e7ec09..86cf5ab 100644
--- a/stage1/resolver.scala
+++ b/stage1/resolver.scala
@@ -154,8 +154,9 @@ class ScalaDependencies(cbtLastModified: Long, mavenCache: File, version: String
case class BinaryDependency( paths: Seq[File], dependencies: Seq[Dependency] )(implicit val logger: Logger, val transientCache: java.util.Map[AnyRef,AnyRef], val classLoaderCache: ClassLoaderCache) extends DependencyImplementation{
assert(paths.nonEmpty)
+ paths.foreach(p => assert(p.exists))
def exportedClasspath = ClassPath(paths)
- override def lastModified = paths.map(_.lastModified).maxOption.getOrElse(0) // FIXME: cache this
+ override def lastModified = paths.map(_.lastModifiedRecursive).max // FIXME: cache this
def targetClasspath = exportedClasspath
def moduleKey = this.getClass.getName ++ "(" ++ paths.mkString(", ") ++ ")"
}
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala
index f102d5c..f3e5f99 100644
--- a/stage2/BasicBuild.scala
+++ b/stage2/BasicBuild.scala
@@ -106,14 +106,11 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
throw new RuntimeException( "no source files found" )
} else sourceFiles
- protected def logEmptySourceDirectories(): Unit = {
- val nonExisting =
- sources
- .filterNot( _.exists )
- .diff( Seq(defaultSourceDirectory) )
- if(!nonExisting.isEmpty) logger.stage2("Some sources do not exist: \n"++nonExisting.mkString("\n"))
+ {
+ val nonExisting = sources.filterNot( _.exists ).diff( Seq(defaultSourceDirectory) )
+ if( nonExisting.nonEmpty )
+ logger.stage2("Some sources do not exist: \n"++nonExisting.mkString("\n"))
}
- logEmptySourceDirectories()
def Resolver( urls: URL* ) = MavenResolver( context.cbtLastModified, context.paths.mavenCache, urls: _* )
@@ -129,7 +126,7 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
def triggerLoopFiles: Seq[File] = sources ++ transitiveDependencies.collect{ case b: TriggerLoop => b.triggerLoopFiles }.flatten
- def localJars : Seq[File] =
+ def localJars: Seq[File] =
Seq(projectDirectory ++ "/lib")
.filter(_.exists)
.flatMap(_.listFiles)
@@ -199,14 +196,15 @@ trait BaseBuild extends BuildInterface with DependencyImplementation with Trigge
}
val scalac = new ScalaCompilerDependency(context.cbtLastModified, context.paths.mavenCache, scalaVersion)
- runMain(
+ lib.runMain(
"scala.tools.nsc.MainGenericRunner",
Seq(
"-bootclasspath",
scalac.classpath.string,
"-classpath",
classpath.string
- ) ++ context.args : _*
+ ) ++ context.args ,
+ scalac.classLoader
)
}