diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-12 20:03:37 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-12 20:03:37 -0500 |
commit | 3777d17027dfb99454d210702551866f2b570830 (patch) | |
tree | 158b31c08f7a2cea18305f0689a2850fa5d2a590 /stage2 | |
parent | ea95bdeb62a44d12faee0a6fcabc121d45b9b0b8 (diff) | |
parent | ba680c938f5ea7b83faba97e2b21aeedb4b175b3 (diff) | |
download | cbt-3777d17027dfb99454d210702551866f2b570830.tar.gz cbt-3777d17027dfb99454d210702551866f2b570830.tar.bz2 cbt-3777d17027dfb99454d210702551866f2b570830.zip |
Merge remote-tracking branch 'origin/master' into farmdawg/zinc-exit-codes
# Conflicts:
# stage1/Stage1Lib.scala
# stage1/resolver.scala
Diffstat (limited to 'stage2')
-rw-r--r-- | stage2/AdminTasks.scala | 4 | ||||
-rw-r--r-- | stage2/BasicBuild.scala | 25 | ||||
-rw-r--r-- | stage2/BuildDependency.scala | 2 | ||||
-rw-r--r-- | stage2/PackageBuild.scala | 1 |
4 files changed, 21 insertions, 11 deletions
diff --git a/stage2/AdminTasks.scala b/stage2/AdminTasks.scala index 70b140e..bce0ae7 100644 --- a/stage2/AdminTasks.scala +++ b/stage2/AdminTasks.scala @@ -7,7 +7,7 @@ class AdminTasks(lib: Lib, args: Array[String]){ args(1).split(",").toVector.map{ d => val v = d.split(":") - new MavenDependency(v(0),v(1),v(2))(lib.logger).classpath + new JavaDependency(v(0),v(1),v(2))(lib.logger).classpath } ) } @@ -15,7 +15,7 @@ class AdminTasks(lib: Lib, args: Array[String]){ def ammonite = { val version = args.lift(1).getOrElse(constants.scalaVersion) val scalac = new ScalaCompilerDependency( version ) - val d = MavenDependency( + val d = JavaDependency( "com.lihaoyi","ammonite-repl_2.11.7",args.lift(1).getOrElse("0.5.6") ) // FIXME: this does not work quite yet, throws NoSuchFileException: /ammonite/repl/frontend/ReplBridge$.class diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index 37602b2..07c2c1e 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -35,7 +35,7 @@ class Build(val context: Context) extends Dependency with TriggerLoop{ // ========== meta data ========== def scalaVersion: String = constants.scalaVersion - final def scalaMajorVersion: String = scalaVersion.split("\\.").take(2).mkString(".") + final def scalaMajorVersion: String = lib.scalaMajorVersion(scalaVersion) def zincVersion = "0.3.9" def dependencies: Seq[Dependency] = Seq( @@ -80,14 +80,25 @@ class Build(val context: Context) extends Dependency with TriggerLoop{ } assertSourceDirectories() - - /** SBT-like dependency builder DSL */ - class GroupIdAndArtifactId( groupId: String, artifactId: String ){ - def %(version: String) = new MavenDependency(groupId, artifactId, version)(lib.logger) + def ScalaDependency( + groupId: String, artifactId: String, version: String, classifier: Classifier = Classifier.none, + scalaVersion: String = scalaMajorVersion + ) = lib.ScalaDependency( groupId, artifactId, version, classifier, scalaVersion ) + + /** SBT-like dependency builder DSL for syntax compatibility */ + class DependencyBuilder2( groupId: String, artifactId: String, scalaVersion: Option[String] ){ + def %(version: String) = scalaVersion.map( + v => ScalaDependency(groupId, artifactId, version, scalaVersion = v) + ).getOrElse( + JavaDependency(groupId, artifactId, version) + ) } implicit class DependencyBuilder(groupId: String){ - def %%(artifactId: String) = new GroupIdAndArtifactId( groupId, artifactId++"_"++scalaMajorVersion ) - def %(artifactId: String) = new GroupIdAndArtifactId( groupId, artifactId ) + def %%(artifactId: String) = new DependencyBuilder2( groupId, artifactId, Some(scalaMajorVersion) ) + def %(artifactId: String) = new DependencyBuilder2( groupId, artifactId, None ) + } + implicit class DependencyBuilder3(d: JavaDependency){ + def %(classifier: String) = d.copy(classifier = Classifier(Some(classifier))) } final def BuildDependency(path: File) = cbt.BuildDependency( diff --git a/stage2/BuildDependency.scala b/stage2/BuildDependency.scala index f7b6b78..f400be7 100644 --- a/stage2/BuildDependency.scala +++ b/stage2/BuildDependency.scala @@ -28,7 +28,7 @@ case class BuildDependency(context: Context) extends TriggerLoop{ final val updated = build.updated } /* -case class DependencyOr(first: BuildDependency, second: MavenDependency) extends ProjectProxy with BuildDependencyBase{ +case class DependencyOr(first: BuildDependency, second: JavaDependency) extends ProjectProxy with BuildDependencyBase{ val isFirst = new File(first.context.cwd).exists def triggerLoopFiles = if(isFirst) first.triggerLoopFiles else Seq() protected val delegate = if(isFirst) first else second diff --git a/stage2/PackageBuild.scala b/stage2/PackageBuild.scala index 4c4e478..2866b7c 100644 --- a/stage2/PackageBuild.scala +++ b/stage2/PackageBuild.scala @@ -1,6 +1,5 @@ package cbt import java.io.File -import java.net.URL import scala.collection.immutable.Seq abstract class PackageBuild(context: Context) extends BasicBuild(context) with ArtifactInfo{ def `package`: Seq[File] = lib.concurrently( enableConcurrency )( |