diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-09-28 08:46:29 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-09-28 10:37:45 -0400 |
commit | 88d871ba309afc80971ded2095c630f01f965cdf (patch) | |
tree | 7ab4242a87b0a99328aaacffcf9daa6c4b0b9031 /stage2/plugins | |
parent | cfa41097812e1d80ef536790fd1a130f82935ae8 (diff) | |
download | cbt-88d871ba309afc80971ded2095c630f01f965cdf.tar.gz cbt-88d871ba309afc80971ded2095c630f01f965cdf.tar.bz2 cbt-88d871ba309afc80971ded2095c630f01f965cdf.zip |
move some DottyLib args to class level as preparation for adding repl
Diffstat (limited to 'stage2/plugins')
-rw-r--r-- | stage2/plugins/Dotty.scala | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index ef6246f..0a5d91d 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -8,15 +8,17 @@ trait Dotty extends BaseBuild{ def dottyVersion: String = "0.1-20160925-b2b475d-NIGHTLY" def dottyOptions: Seq[String] = Seq() + private lazy val dottyLib = new DottyLib( + logger, context.cbtHasChanged, context.paths.mavenCache, + context.classLoaderCache, dottyVersion = dottyVersion + ) private object compileCache extends Cache[Option[File]] override def compile: Option[File] = compileCache{ - new DottyLib(logger).compile( - context.cbtHasChanged, + dottyLib.compile( needsUpdate || context.parentBuild.map(_.needsUpdate).getOrElse(false), sourceFiles, compileTarget, compileStatusFile, dependencyClasspath ++ compileClasspath, - context.paths.mavenCache, scalacOptions, context.classLoaderCache, - dottyOptions = dottyOptions, dottyVersion = dottyVersion + dottyOptions ) } @@ -25,22 +27,28 @@ trait Dotty extends BaseBuild{ ) } -class DottyLib(logger: Logger){ +class DottyLib( + logger: Logger, + cbtHasChanged: Boolean, + mavenCache: File, + classLoaderCache: ClassLoaderCache, + dottyVersion: String +){ val lib = new Lib(logger) import lib._ + private def Resolver(urls: URL*) = MavenResolver(cbtHasChanged, mavenCache, urls: _*) + private lazy val dottyDependency = Resolver(mavenCentral).bindOne( + MavenDependency("ch.epfl.lamp","dotty_2.11",dottyVersion) + ) + def compile( - cbtHasChanged: Boolean, needsRecompile: Boolean, files: Seq[File], compileTarget: File, statusFile: File, classpath: ClassPath, - mavenCache: File, - scalacOptions: Seq[String] = Seq(), - classLoaderCache: ClassLoaderCache, - dottyOptions: Seq[String], - dottyVersion: String + dottyOptions: Seq[String] ): Option[File] = { if(classpath.files.isEmpty) @@ -50,10 +58,7 @@ class DottyLib(logger: Logger){ None }else{ if( needsRecompile ){ - def Resolver(urls: URL*) = MavenResolver(cbtHasChanged, mavenCache, urls: _*) - val dotty = Resolver(mavenCentral).bindOne( - MavenDependency("ch.epfl.lamp","dotty_2.11",dottyVersion) - ) + val dotty = dottyDependency val cp = classpath ++ dotty.classpath |