diff options
author | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-12 00:09:26 -0500 |
---|---|---|
committer | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-12 00:09:26 -0500 |
commit | b143c01a2e180b647eb27338cb7302aa38ef10c6 (patch) | |
tree | 9608d8ff36a80ac68f968aea8fcc31e4dae4150f /stage1/resolver.scala | |
parent | fae67dc6124a12710599ede6e091e2de236079aa (diff) | |
parent | 55fff670befc97a871cf0f85c65764e108f3d3c1 (diff) | |
download | cbt-b143c01a2e180b647eb27338cb7302aa38ef10c6.tar.gz cbt-b143c01a2e180b647eb27338cb7302aa38ef10c6.tar.bz2 cbt-b143c01a2e180b647eb27338cb7302aa38ef10c6.zip |
Merge pull request #78 from cvogt/chris
Chris
Diffstat (limited to 'stage1/resolver.scala')
-rw-r--r-- | stage1/resolver.scala | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/stage1/resolver.scala b/stage1/resolver.scala index fae5e9d..30f03e2 100644 --- a/stage1/resolver.scala +++ b/stage1/resolver.scala @@ -32,12 +32,13 @@ abstract class Dependency{ def exportedJars: Seq[File] def jars: Seq[File] = exportedJars ++ dependencyJars + def canBeCached = false def cacheDependencyClassLoader = true private object cacheClassLoaderBasicBuild extends Cache[URLClassLoader] def classLoader: URLClassLoader = cacheClassLoaderBasicBuild{ val transitiveClassPath = transitiveDependencies.map{ - case d: MavenDependency => Left(d) + case d if d.canBeCached => Left(d) case d => Right(d) } val buildClassPath = ClassPath.flatten( @@ -95,35 +96,39 @@ abstract class Dependency{ } // TODO: all this hard codes the scala version, needs more flexibility -class ScalaCompiler(logger: Logger) extends MavenDependency("org.scala-lang","scala-compiler",constants.scalaVersion)(logger) -class ScalaLibrary(logger: Logger) extends MavenDependency("org.scala-lang","scala-library",constants.scalaVersion)(logger) -class ScalaReflect(logger: Logger) extends MavenDependency("org.scala-lang","scala-reflect",constants.scalaVersion)(logger) +class ScalaCompilerDependency(version: String)(implicit logger: Logger) extends MavenDependency("org.scala-lang","scala-compiler",version) +class ScalaLibraryDependency (version: String)(implicit logger: Logger) extends MavenDependency("org.scala-lang","scala-library",version) +class ScalaReflectDependency (version: String)(implicit logger: Logger) extends MavenDependency("org.scala-lang","scala-reflect",version) -case class ScalaDependencies(logger: Logger) extends Dependency{ +case class ScalaDependencies(version: String)(implicit val logger: Logger) extends Dependency{ sd => + final val updated = false + override def canBeCached = true def exportedClasspath = ClassPath(Seq()) def exportedJars = Seq[File]() - def dependencies = Seq( new ScalaCompiler(logger), new ScalaLibrary(logger), new ScalaReflect(logger) ) - final val updated = false + def dependencies = Seq( + new ScalaCompilerDependency(version)(logger), + new ScalaLibraryDependency(version)(logger), + new ScalaReflectDependency(version)(logger) + ) } -/* -case class BinaryDependency( path: File, dependencies: Seq[Dependency] ) extends Dependency{ +case class BinaryDependency( path: File, dependencies: Seq[Dependency] )(implicit val logger: Logger) extends Dependency{ + def updated = false def exportedClasspath = ClassPath(Seq(path)) - def exportedJars = Seq[File]() + def exportedJars = Seq[File](path) } -*/ -case class Stage1Dependency(logger: Logger) extends Dependency{ +case class Stage1Dependency()(implicit val logger: Logger) extends Dependency{ def exportedClasspath = ClassPath( Seq(nailgunTarget, stage1Target) ) def exportedJars = Seq[File]() - def dependencies = ScalaDependencies(logger: Logger).dependencies + def dependencies = ScalaDependencies(constants.scalaVersion).dependencies def updated = false // FIXME: think this through, might allow simplifications and/or optimizations } -case class CbtDependency(logger: Logger) extends Dependency{ +case class CbtDependency()(implicit val logger: Logger) extends Dependency{ def exportedClasspath = ClassPath( Seq( stage2Target ) ) def exportedJars = Seq[File]() override def dependencies = Seq( - Stage1Dependency(logger), + Stage1Dependency()(logger), MavenDependency("net.incongru.watchservice","barbary-watchservice","1.0")(logger), MavenDependency("com.lihaoyi","ammonite-repl_2.11.7","0.5.5")(logger), MavenDependency("org.scala-lang.modules","scala-xml_2.11","1.0.5")(logger) @@ -136,10 +141,11 @@ final case class Classifier(name: String) extends ClassifierBase case object javadoc extends ClassifierBase case object sources extends ClassifierBase -case class MavenDependency( groupId: String, artifactId: String, version: String, sources: Boolean = false )(val logger: Logger) +case class MavenDependency( groupId: String, artifactId: String, version: String, sources: Boolean = false )(implicit val logger: Logger) extends ArtifactInfo{ def updated = false + override def canBeCached = true private val groupPath = groupId.split("\\.").mkString("/") def basePath = s"/$groupPath/$artifactId/$version/$artifactId-$version"++(if(sources) "-sources" else "") |