diff options
Diffstat (limited to 'stage2')
-rw-r--r-- | stage2/BasicBuild.scala | 4 | ||||
-rw-r--r-- | stage2/BuildBuild.scala | 4 | ||||
-rw-r--r-- | stage2/BuildDependency.scala | 4 | ||||
-rw-r--r-- | stage2/GitDependency.scala | 2 | ||||
-rw-r--r-- | stage2/Scaffold.scala | 117 | ||||
-rw-r--r-- | stage2/ToolsTasks.scala | 3 |
6 files changed, 17 insertions, 117 deletions
diff --git a/stage2/BasicBuild.scala b/stage2/BasicBuild.scala index 3784d58..42384db 100644 --- a/stage2/BasicBuild.scala +++ b/stage2/BasicBuild.scala @@ -87,7 +87,7 @@ trait BaseBuild extends DependencyImplementation with BuildInterface with Trigge scalaVersion: String = scalaMajorVersion ) = lib.ScalaDependency( groupId, artifactId, version, classifier, scalaVersion ) - final def BuildDependency(path: File) = cbt.BuildDependency( + final def DirectoryDependency(path: File) = cbt.DirectoryDependency( context.copy( projectDirectory = path, args = Seq() ) ) @@ -138,7 +138,7 @@ trait BaseBuild extends DependencyImplementation with BuildInterface with Trigge def test: Option[ExitCode] = Some(new lib.ReflectBuild( - BuildDependency(projectDirectory++"/test").build + DirectoryDependency(projectDirectory++"/test").build ).callNullary(Some("run"))) def t = test def rt = recursiveUnsafe(Some("test")) diff --git a/stage2/BuildBuild.scala b/stage2/BuildBuild.scala index 7eab5e6..db5374c 100644 --- a/stage2/BuildBuild.scala +++ b/stage2/BuildBuild.scala @@ -8,8 +8,8 @@ trait BuildBuild extends BaseBuild{ ) object plugins{ - final val scalaTest = BuildDependency( managedContext.cbtHome ++ "/plugins/scalatest" ) - final val sbtLayout = BuildDependency( managedContext.cbtHome ++ "/plugins/sbt_layout" ) + final val scalaTest = DirectoryDependency( managedContext.cbtHome ++ "/plugins/scalatest" ) + final val sbtLayout = DirectoryDependency( managedContext.cbtHome ++ "/plugins/sbt_layout" ) } override def dependencies = diff --git a/stage2/BuildDependency.scala b/stage2/BuildDependency.scala index aba35c6..c0b53ad 100644 --- a/stage2/BuildDependency.scala +++ b/stage2/BuildDependency.scala @@ -15,7 +15,7 @@ trait TriggerLoop extends DependencyImplementation{ def triggerLoopFiles: Seq[File] } /** You likely want to use the factory method in the BasicBuild class instead of this. */ -case class BuildDependency(context: Context) extends TriggerLoop{ +case class DirectoryDependency(context: Context) extends TriggerLoop{ override def show = this.getClass.getSimpleName ++ "(" ++ context.projectDirectory.string ++ ")" final override lazy val logger = context.logger final override lazy val lib: Lib = new Lib(logger) @@ -28,7 +28,7 @@ case class BuildDependency(context: Context) extends TriggerLoop{ def targetClasspath = ClassPath() } /* -case class DependencyOr(first: BuildDependency, second: JavaDependency) extends ProjectProxy with BuildDependencyBase{ +case class DependencyOr(first: DirectoryDependency, second: JavaDependency) extends ProjectProxy with DirectoryDependencyBase{ val isFirst = new File(first.context.projectDirectory).exists def triggerLoopFiles = if(isFirst) first.triggerLoopFiles else Seq() protected val delegate = if(isFirst) first else second diff --git a/stage2/GitDependency.scala b/stage2/GitDependency.scala index bb3cc63..6510ede 100644 --- a/stage2/GitDependency.scala +++ b/stage2/GitDependency.scala @@ -39,7 +39,7 @@ case class GitDependency( } private object dependencyCache extends Cache[DependencyImplementation] def dependency = dependencyCache{ - BuildDependency( + DirectoryDependency( context.copy( projectDirectory = checkout ++ subDirectory.map("/" ++ _).getOrElse("") ) diff --git a/stage2/Scaffold.scala b/stage2/Scaffold.scala index 0214a0d..32e474f 100644 --- a/stage2/Scaffold.scala +++ b/stage2/Scaffold.scala @@ -24,55 +24,25 @@ trait Scaffold{ ) } - def createBasicBuild( + def createBuild( projectDirectory: File ): Unit = { createFile(projectDirectory, "build/build.scala", s"""import cbt._ class Build(val context: Context) extends BaseBuild{ /* - override def dependencies = ( - super.dependencies // don't forget super.dependencies here - ++ + override def dependencies = + super.dependencies ++ // don't forget super.dependencies here + Seq( + // source dependency + DirectoryDependency( projectDirectory ++ "/subProject" ) + ) ++ Resolver( mavenCentral ).bind( - // automatically add Scala major version to artifact id - // CBT-style Scala dependency + // CBT-style Scala dependencies ScalaDependency( "com.lihaoyi", "ammonite-ops", "0.5.5" ) - // or SBT-style Scala dependency - "com.lihaoyi" %% "ammonite-ops" % "0.5.5" - - // don't mess with the artifact id - // CBT-Style Java dependency MavenDependency( "com.lihaoyi", "ammonite-ops_2.11", "0.5.5" ) - // or SBT-style Java dependency - "com.lihaoyi" % "ammonite-ops_2.11" % "0.5.5" - ) - ) - */ -} -""" - ) - } - def createBuildBuild( - projectDirectory: File - ): Unit = { - createFile(projectDirectory, "build/build/build.scala", s"""import cbt._ -class Build(val context: Context) extends BuildBuild{ -/* - override def dependencies = ( - super.dependencies // don't forget super.dependencies here - ++ - Resolver( mavenCentral ).bind( - // automatically add Scala major version to artifact id - // CBT-style Scala dependency - ScalaDependency( "com.lihaoyi", "ammonite-ops", "0.5.5" ) - // or SBT-style Scala dependency + // SBT-style dependencies "com.lihaoyi" %% "ammonite-ops" % "0.5.5" - - // don't mess with the artifact id - // CBT-Style Java dependency - MavenDependency( "com.lihaoyi", "ammonite-ops_2.11", "0.5.5" ) - // or SBT-style Java dependency "com.lihaoyi" % "ammonite-ops_2.11" % "0.5.5" ) ) @@ -81,73 +51,4 @@ class Build(val context: Context) extends BuildBuild{ """ ) } - -/*, - - "build/build/build.scala" -> s"""import cbt._ -class Build(val context: Context) extends BuildBuild{ - override def dependencies = super.dependencies ++ Seq( - BuildDependency( projectDirectory.parent ++ "/build-shared") - // , "com.lihaoyi" %% "ammonite-ops" % "0.5.5" - ) -} -""", - - "test/Main.scala" -> s"""object Main{ - def main( args: Array[String] ) = { - assert( false, "Go. Write some tests :)!" ) - } -} -""", - - "test/build/build.scala" -> s"""import cbt._ -class Build(val context: Context) extends BaseBuild with BuildShared/* with mixins.ScalaTest*/{ - // def scalaTestVersion = "2.2.6" - - override def dependencies = super.dependencies ++ Seq( - // , "org.scalacheck" %% "scalacheck" % "1.13.0" - ) } -""", - - "test/build/build/build.scala" -> s"""import cbt._ -class Build(val context: Context) extends BuildBuild{ - override def scalaVersion: String = "2.11.8" - - override def dependencies = super.dependencies ++ Seq( - BuildDependency( projectDirectory.parent.parent ++ "/build-shared") - // , "com.lihaoyi" %% "ammonite-ops" % "0.5.5" - ) -} -""", - - "build-shared/build/build.scala" -> s"""import cbt._ -class Build(val context: Context) extends BaseBuild{ - override def scalaVersion: String = "$scalaVersion" - - override def dependencies = super.dependencies ++ Seq( // don't forget super.dependencies here - CbtDependency - // , "org.cvogt" %% "scala-extensions" % "0.4.1" - ) -} -""", - - "build-shared/BuildShared.scala" -> s"""import cbt._ -trait BuildShared extends BaseBuild{ - override def scalaVersion: String = "$scalaVersion" - override def enableConcurrency = false // enable for speed, disable for debugging - - override def groupId = "$groupId" - override def version = "$version" - - // required for .pom file - override def url : URL = lib.requiredForPom("url") - override def developers: Seq[Developer] = lib.requiredForPom("developers") - override def licenses : Seq[License] = lib.requiredForPom("licenses") - override def scmUrl : String = lib.requiredForPom("scmUrl") - override def scmConnection: String = lib.requiredForPom("scmConnection") - override def pomExtra: Seq[scala.xml.Node] = Seq() -} -"""*/ - -}
\ No newline at end of file diff --git a/stage2/ToolsTasks.scala b/stage2/ToolsTasks.scala index bac3406..2c4978e 100644 --- a/stage2/ToolsTasks.scala +++ b/stage2/ToolsTasks.scala @@ -16,8 +16,7 @@ class ToolsTasks( private def Resolver( urls: URL* ) = MavenResolver(cbtHasChanged,mavenCache,urls: _*) implicit val logger: Logger = lib.logger def createMain: Unit = lib.createMain( cwd ) - def createBasicBuild: Unit = lib.createBasicBuild( cwd ) - def createBuildBuild: Unit = lib.createBuildBuild( cwd ) + def createBuild: Unit = lib.createBuild( cwd ) def resolve = { ClassPath.flatten( args(1).split(",").toVector.map{ |