diff options
author | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-04 00:46:06 -0400 |
---|---|---|
committer | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-04 00:46:06 -0400 |
commit | 2d1a51d64aaca9ad00057a5bb822a50158b67429 (patch) | |
tree | 8fb5377f275bb639dd5a25ec5dcb37148f0faf10 /stage2/BasicBuild.scala | |
parent | 2b52377b6f6fbbc45ef705f33088e8e414a77105 (diff) | |
parent | 6e65120d99b6480b4d2577bde61e8754a60a2ee6 (diff) | |
download | cbt-2d1a51d64aaca9ad00057a5bb822a50158b67429.tar.gz cbt-2d1a51d64aaca9ad00057a5bb822a50158b67429.tar.bz2 cbt-2d1a51d64aaca9ad00057a5bb822a50158b67429.zip |
Merge pull request #99 from cvogt/maven-repos
Support for alternative maven resolvers
Diffstat (limited to 'stage2/BasicBuild.scala')
-rw-r--r-- | stage2/BasicBuild.scala | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index 9ed8c26..39cc9e3 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -12,14 +12,16 @@ import scala.collection.immutable.Seq import scala.util._ class BasicBuild( context: Context ) extends Build( context ) -class Build(val context: Context) extends Dependency with TriggerLoop{ +class Build(val context: Context) extends Dependency with TriggerLoop with SbtDependencyDsl{ // library available to builds implicit final val logger: Logger = context.logger implicit final val classLoaderCache: ClassLoaderCache = context.classLoaderCache + implicit final val _context = context override final protected val lib: Lib = new Lib(logger) // ========== general stuff ========== + override def canBeCached = false def enableConcurrency = false final def projectDirectory: File = lib.realpath(context.cwd) assert( projectDirectory.exists, "projectDirectory does not exist: " ++ projectDirectory.string ) @@ -32,7 +34,9 @@ class Build(val context: Context) extends Dependency with TriggerLoop{ def zincVersion = "0.3.9" def dependencies: Seq[Dependency] = Seq( - "org.scala-lang" % "scala-library" % scalaVersion + MavenRepository.central.resolve( + "org.scala-lang" % "scala-library" % scalaVersion + ) ) // ========== paths ========== @@ -84,22 +88,6 @@ class Build(val context: Context) extends Dependency with TriggerLoop{ 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 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( context.copy( cwd = path, args = Seq() ) ) @@ -125,12 +113,11 @@ class Build(val context: Context) extends Dependency with TriggerLoop{ def scalacOptions: Seq[String] = Seq( "-feature", "-deprecation", "-unchecked" ) private object needsUpdateCache extends Cache[Boolean] - def needsUpdate: Boolean = { - needsUpdateCache( - lib.needsUpdate( sourceFiles, compileStatusFile ) - || transitiveDependencies.exists(_.needsUpdate) - ) - } + def needsUpdate: Boolean = needsUpdateCache( + context.cbtHasChanged + || lib.needsUpdate( sourceFiles, compileStatusFile ) + || transitiveDependencies.exists(_.needsUpdate) + ) private object compileCache extends Cache[Option[File]] def compile: Option[File] = compileCache{ |