aboutsummaryrefslogtreecommitdiff
path: root/stage2
diff options
context:
space:
mode:
Diffstat (limited to 'stage2')
-rw-r--r--stage2/AdminStage2.scala2
-rw-r--r--stage2/BasicBuild.scala (renamed from stage2/DefaultBuild.scala)112
-rw-r--r--stage2/BuildBuild.scala3
-rw-r--r--stage2/BuildDependency.scala (renamed from stage2/dependencies.scala)2
-rw-r--r--stage2/Lib.scala74
-rw-r--r--stage2/PackageBuild.scala27
-rw-r--r--stage2/PublishBuild.scala41
-rw-r--r--stage2/Scaffold.scala8
-rw-r--r--stage2/Stage2.scala4
-rw-r--r--stage2/mixins.scala10
10 files changed, 138 insertions, 145 deletions
diff --git a/stage2/AdminStage2.scala b/stage2/AdminStage2.scala
index d3db3e7..4120b1c 100644
--- a/stage2/AdminStage2.scala
+++ b/stage2/AdminStage2.scala
@@ -5,7 +5,7 @@ object AdminStage2{
val lib = new Lib(init.logger)
val adminTasks = new AdminTasks(lib, args.drop(3))
new lib.ReflectObject(adminTasks){
- def usage = "Available methods: " + lib.taskNames(subclassType)
+ def usage: String = "Available methods: " ++ lib.taskNames(subclassType).mkString(" ")
}.callNullary(args.lift(2))
}
}
diff --git a/stage2/DefaultBuild.scala b/stage2/BasicBuild.scala
index c98aea0..6da31b7 100644
--- a/stage2/DefaultBuild.scala
+++ b/stage2/BasicBuild.scala
@@ -15,80 +15,17 @@ import scala.util._
import ammonite.ops.{cwd => _,_}
-
-
-
-abstract class PackageBuild(context: Context) extends Build(context) with ArtifactInfo{
- def `package`: Seq[File] = lib.concurrently( enableConcurrency )(
- Seq(() => jar, () => docJar, () => srcJar)
- )( _() )
-
- private object cacheJarBasicBuild extends Cache[File]
- def jar: File = cacheJarBasicBuild{
- lib.jar( artifactId, version, compile, jarTarget )
- }
-
- private object cacheSrcJarBasicBuild extends Cache[File]
- def srcJar: File = cacheSrcJarBasicBuild{
- lib.srcJar(sources, artifactId, version, scalaTarget)
- }
-
- private object cacheDocBasicBuild extends Cache[File]
- def docJar: File = cacheDocBasicBuild{
- lib.docJar( sources, dependencyClasspath, apiTarget, jarTarget, artifactId, version, scalacOptions )
- }
-
- override def jars = jar +: dependencyJars
- override def exportedJars: Seq[File] = Seq(jar)
-}
-abstract class PublishBuild(context: Context) extends PackageBuild(context){
- def name = artifactId
- def description: String
- def url: URL
- def developers: Seq[Developer]
- def licenses: Seq[License]
- def scmUrl: String
- def scmConnection: String
- def pomExtra: Seq[scala.xml.Node] = Seq()
-
- // ========== package ==========
-
- /** put additional xml that should go into the POM file in here */
- def pom: File = lib.pom(
- groupId = groupId,
- artifactId = artifactId,
- version = version,
- name = name,
- description = description,
- url = url,
- developers = developers,
- licenses = licenses,
- scmUrl = scmUrl,
- scmConnection = scmConnection,
- dependencies = dependencies,
- pomExtra = pomExtra,
- jarTarget = jarTarget
- )
-
- // ========== publish ==========
- final protected def releaseFolder = s"/${groupId.replace(".","/")}/$artifactId/$version/"
- def snapshotUrl = new URL("https://oss.sonatype.org/content/repositories/snapshots")
- def releaseUrl = new URL("https://oss.sonatype.org/service/local/staging/deploy/maven2")
- def publishSnapshot: Unit = lib.publishSnapshot(sourceFiles, pom +: `package`, new URL(snapshotUrl + releaseFolder) )
- def publishSigned: Unit = lib.publishSigned(sourceFiles, pom +: `package`, new URL(releaseUrl + releaseFolder) )
-}
-
-
class BasicBuild(context: Context) extends Build(context)
class Build(val context: Context) extends Dependency with TriggerLoop{
// library available to builds
final val logger = context.logger
override final protected val lib: Lib = new Lib(logger)
+
// ========== general stuff ==========
def enableConcurrency = false
- final def projectDirectory: File = new File(context.cwd)
- assert( projectDirectory.exists, "projectDirectory does not exist: "+projectDirectory )
+ final def projectDirectory: File = context.cwd
+ assert( projectDirectory.exists, "projectDirectory does not exist: " ++ projectDirectory.string )
final def usage: Unit = new lib.ReflectBuild(this).usage
/*
def scaffold: Unit = lib.generateBasicBuildFile(
@@ -106,18 +43,18 @@ class Build(val context: Context) extends Dependency with TriggerLoop{
)
// ========== paths ==========
- final private val defaultSourceDirectory = new File(projectDirectory+"/src/")
+ final private val defaultSourceDirectory = projectDirectory ++ "/src"
/** base directory where stuff should be generated */
- def target = new File(projectDirectory+"/target")
+ def target: File = projectDirectory ++ "/target"
/** base directory where stuff should be generated for this scala version*/
- def scalaTarget = new File(target + s"/scala-$scalaMajorVersion")
+ def scalaTarget: File = target ++ s"/scala-$scalaMajorVersion"
/** directory where jars (and the pom file) should be put */
- def jarTarget = scalaTarget
+ def jarTarget: File = scalaTarget
/** directory where the scaladoc should be put */
- def apiTarget = new File(scalaTarget + "/api")
+ def apiTarget: File = scalaTarget ++ "/api"
/** directory where the class files should be put (in package directories) */
- def compileTarget = new File(scalaTarget + "/classes")
+ def compileTarget: File = scalaTarget ++ "/classes"
/** Source directories and files. Defaults to .scala and .java files in src/ and top-level. */
def sources: Seq[File] = Seq(defaultSourceDirectory) ++ projectDirectory.listFiles.toVector.filter(sourceFileFilter)
@@ -138,36 +75,29 @@ class Build(val context: Context) extends Dependency with TriggerLoop{
.diff( Seq(defaultSourceDirectory) )
assert(
nonExisting.isEmpty,
- "Some sources do not exist: \n"+nonExisting.mkString("\n")
+ "Some sources do not exist: \n"++nonExisting.mkString("\n")
)
}
assertSourceDirectories()
-
-
/** SBT-like dependency builder DSL */
class GroupIdAndArtifactId( groupId: String, artifactId: String ){
def %(version: String) = new MavenDependency(groupId, artifactId, version)(lib.logger)
}
implicit class DependencyBuilder(groupId: String){
- def %%(artifactId: String) = new GroupIdAndArtifactId( groupId, artifactId+"_"+scalaMajorVersion )
+ def %%(artifactId: String) = new GroupIdAndArtifactId( groupId, artifactId++"_"++scalaMajorVersion )
def %(artifactId: String) = new GroupIdAndArtifactId( groupId, artifactId )
}
- final def BuildDependency(path: String) = cbt.BuildDependency(
- context.copy(
- cwd = path,
- args = Seq()
- )
+ final def BuildDependency(path: File) = cbt.BuildDependency(
+ context.copy( cwd = path, args = Seq() )
)
def triggerLoopFiles: Seq[File] = sources ++ transitiveDependencies.collect{ case b: TriggerLoop => b.triggerLoopFiles }.flatten
-
def localJars : Seq[File] =
- Seq(projectDirectory + "/lib/")
- .map(new File(_))
+ Seq(projectDirectory ++ "/lib")
.filter(_.exists)
.flatMap(_.listFiles)
.filter(_.toString.endsWith(".jar"))
@@ -220,15 +150,15 @@ class Build(val context: Context) extends Dependency with TriggerLoop{
def test: ExitCode = lib.test(context)
context.logger.composition(">"*80)
- context.logger.composition("class "+this.getClass)
- context.logger.composition("dir "+context.cwd)
- context.logger.composition("sources "+sources.toList.mkString(" "))
- context.logger.composition("target "+target)
- context.logger.composition("context "+context)
- context.logger.composition("dependencyTree\n"+dependencyTree)
+ context.logger.composition("class " ++ this.getClass.toString)
+ context.logger.composition("dir " ++ context.cwd.string)
+ context.logger.composition("sources " ++ sources.toList.mkString(" "))
+ context.logger.composition("target " ++ target.string)
+ context.logger.composition("context " ++ context.toString)
+ context.logger.composition("dependencyTree\n" ++ dependencyTree)
context.logger.composition("<"*80)
// ========== cbt internals ==========
private[cbt] def finalBuild = this
- override def show = this.getClass.getSimpleName + "("+context.cwd+")"
+ override def show = this.getClass.getSimpleName ++ "(" ++ context.cwd.string ++ ")"
}
diff --git a/stage2/BuildBuild.scala b/stage2/BuildBuild.scala
index 41589db..9283cdf 100644
--- a/stage2/BuildBuild.scala
+++ b/stage2/BuildBuild.scala
@@ -1,9 +1,10 @@
package cbt
+import java.io.File
import scala.collection.immutable.Seq
class BuildBuild(context: Context) extends Build(context){
override def dependencies = Seq( CbtDependency(context.logger) ) ++ super.dependencies
- def managedBuildDirectory = lib.realpath(projectDirectory + "/../")
+ def managedBuildDirectory: File = lib.realpath( projectDirectory.parent )
val managedBuild = {
val managedContext = context.copy( cwd = managedBuildDirectory )
val cl = new cbt.URLClassLoader(
diff --git a/stage2/dependencies.scala b/stage2/BuildDependency.scala
index 8ed36eb..f7b6b78 100644
--- a/stage2/dependencies.scala
+++ b/stage2/BuildDependency.scala
@@ -16,7 +16,7 @@ trait TriggerLoop extends Dependency{
}
/** You likely want to use the factory method in the BasicBuild class instead of this. */
case class BuildDependency(context: Context) extends TriggerLoop{
- override def show = this.getClass.getSimpleName + "("+context.cwd+")"
+ override def show = this.getClass.getSimpleName ++ "(" ++ context.cwd.string ++ ")"
final override lazy val logger = context.logger
final override lazy val lib: Lib = new Lib(logger)
private val root = lib.loadRoot( context.copy(args=Seq()) )
diff --git a/stage2/Lib.scala b/stage2/Lib.scala
index 9971b55..6bb9c0b 100644
--- a/stage2/Lib.scala
+++ b/stage2/Lib.scala
@@ -37,9 +37,9 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
*/
def loadRoot(context: Context, default: Context => Build = new Build(_)): Build = {
context.logger.composition( context.logger.showInvocation("Build.loadRoot",context) )
- def findStartDir(cwd: String): String = {
- val buildDir = realpath(cwd+"/build")
- if(new File(buildDir).exists) findStartDir(buildDir) else cwd
+ def findStartDir(cwd: File): File = {
+ val buildDir = realpath( cwd ++ "/build" )
+ if(buildDir.exists) findStartDir(buildDir) else cwd
}
val start = findStartDir(context.cwd)
@@ -51,7 +51,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
if(useBasicBuildBuild) default( context ) else new cbt.BuildBuild( context.copy( cwd = start ) )
} catch {
case e:ClassNotFoundException if e.getMessage == rootBuildClassName =>
- throw new Exception(s"no class $rootBuildClassName found in "+start)
+ throw new Exception(s"no class $rootBuildClassName found in " ++ start.string)
}
}
@@ -68,13 +68,13 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
}
def srcJar(sources: Seq[File], artifactId: String, version: String, jarTarget: File): File = {
- val file = new File(jarTarget+"/"+artifactId+"-"+version+"-sources.jar")
+ val file = jarTarget ++ ("/"++artifactId++"-"++version++"-sources.jar")
lib.jarFile(file, sources)
file
}
def jar(artifactId: String, version: String, compileTarget: File, jarTarget: File): File = {
- val file = new File(jarTarget+"/"+artifactId+"-"+version+".jar")
+ val file = jarTarget ++ ("/"++artifactId++"-"++version++".jar")
lib.jarFile(file, Seq(compileTarget))
file
}
@@ -102,7 +102,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
"scala.tools.nsc.ScalaDoc",
Seq(
// FIXME: can we use compiler dependency here?
- "-cp", /*javacp+":"+*/ScalaDependencies(logger).classpath.string + ":" + dependenyClasspath.string,
+ "-cp", /*javacp++":"++*/ScalaDependencies(logger).classpath.string ++ ":" ++ dependenyClasspath.string,
"-d", apiTarget.toString
) ++ compileArgs ++ sourceFiles.map(_.toString),
new URLClassLoader(
@@ -113,7 +113,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
}
}
}
- val docJar = new File(jarTarget+"/"+artifactId+"-"+version+"-javadoc.jar")
+ val docJar = jarTarget ++ ("/"++artifactId++"-"++version++"-javadoc.jar")
lib.jarFile(docJar, Vector(apiTarget))
docJar
}
@@ -122,11 +122,11 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
val loggers = logger.enabledLoggers.mkString(",")
// FIXME: this is a hack to pass logger args on to the tests.
// should probably have a more structured way
- val loggerArg = if(loggers != "") Some("-Dlog="+loggers) else None
+ val loggerArg = if(loggers != "") Some("-Dlog="++loggers) else None
logger.lib(s"invoke testDefault( $context )")
val exitCode: ExitCode = loadDynamic(
- context.copy( cwd = context.cwd+"/test/", args = loggerArg.toVector ++ context.args ),
+ context.copy( cwd = context.cwd ++ "/test", args = loggerArg.toVector ++ context.args ),
new Build(_) with mixins.Test
).run
logger.lib(s"return testDefault( $context )")
@@ -135,9 +135,9 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
// task reflection helpers
import ru._
- private lazy val anyRefMembers = ru.typeOf[AnyRef].members.toVector.map(taskName)
- def taskNames(tpe: Type) = tpe.members.toVector.flatMap(lib.toTask).map(taskName).sorted
- private def taskName(method: Symbol) = method.name.decodedName.toString
+ private lazy val anyRefMembers: Set[String] = ru.typeOf[AnyRef].members.toSet.map(taskName)
+ def taskNames(tpe: Type): Seq[String] = tpe.members.toVector.flatMap(lib.toTask).map(taskName).sorted
+ private def taskName(method: Symbol): String = method.name.decodedName.toString
def toTask(symbol: Symbol): Option[MethodSymbol] = {
Option(symbol)
.filter(_.isPublic)
@@ -161,10 +161,10 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
"""
} else ""
- ) + s"""Methods provided by CBT (but possibly overwritten)
+ ) ++ s"""Methods provided by CBT (but possibly overwritten)
${baseTasks.mkString(" ")}"""
- ) + "\n"
+ ) ++ "\n"
}
}
@@ -202,17 +202,13 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
}
}
-
// file system helpers
- def basename(path: String) = path.stripSuffix("/").split("/").last
- def basename(path: File) = path.toString.stripSuffix("/").split("/").last
- def dirname(path: String) = realpath(path).stripSuffix("/").split("/").dropRight(1).mkString("/")
- def realpath(name: String) = Paths.get(new File(name).getAbsolutePath).normalize.toString
- def realpath(name: File) = new File(Paths.get(name.getAbsolutePath).normalize.toString)
- def nameAndContents(file: File) = basename(file.toString) -> readAllBytes(Paths.get(file.toString))
+ def basename(path: File): String = path.toString.stripSuffix("/").split("/").last
+ def dirname(path: File): File = new File(realpath(path).string.stripSuffix("/").split("/").dropRight(1).mkString("/"))
+ def nameAndContents(file: File) = basename(file) -> readAllBytes(Paths.get(file.toString))
def jarFile( jarFile: File, files: Seq[File] ): Unit = {
- logger.lib("Start packaging "+jarFile)
+ logger.lib("Start packaging "++jarFile.string)
val manifest = new Manifest
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0")
val jar = new JarOutputStream(new FileOutputStream(jarFile.toString), manifest)
@@ -227,7 +223,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
val entry = new JarEntry( name )
entry.setTime(file.lastModified)
jar.putNextEntry(entry)
- jar.write( Files.readAllBytes( Paths.get(file.toString) ) )
+ jar.write( readAllBytes( Paths.get(file.toString) ) )
jar.closeEntry
name
}
@@ -235,11 +231,11 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
val duplicateFiles = (names diff names.distinct).distinct
assert(
duplicateFiles.isEmpty,
- s"Conflicting file names when trying to create $jarFile: "+duplicateFiles.mkString(", ")
+ s"Conflicting file names when trying to create $jarFile: "++duplicateFiles.mkString(", ")
)
jar.close
- logger.lib("Done packaging "+jarFile)
+ logger.lib("Done packaging " ++ jarFile.toString)
}
lazy val passphrase =
@@ -255,9 +251,9 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
new ProcessBuilder( "gpg", "--batch", "--yes", "-a", "-b", "-s", "--passphrase", passphrase, file.toString )
.inheritIO.start.waitFor
- if( 0 != statusCode ) throw new Exception("gpg exited with status code "+statusCode)
+ if( 0 != statusCode ) throw new Exception("gpg exited with status code " ++ statusCode.toString)
- new File(file+".asc")
+ file ++ ".asc"
}
//def requiredForPom[T](name: String): T = throw new Exception(s"You need to override `def $name` in order to generate a valid pom.")
@@ -324,9 +320,9 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
}
</dependencies>
</project>
- val path = new File(jarTarget+"/"+artifactId+"-"+version+".pom")
- write.over(Path(path), "<?xml version='1.0' encoding='UTF-8'?>\n" + xml.toString)
- path
+ val path = jarTarget.toString ++ ( "/" ++ artifactId ++ "-" ++ version ++ ".pom" )
+ write.over(Path(path), "<?xml version='1.0' encoding='UTF-8'?>\n" ++ xml.toString)
+ new File(path)
}
def concurrently[T,R]( concurrencyEnabled: Boolean )( items: Seq[T] )( projection: T => R ): Seq[R] = {
@@ -347,8 +343,8 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
val files = (artifacts ++ artifacts.map(sign)).map(nameAndContents)
lazy val checksums = files.flatMap{
case (name, content) => Seq(
- name+".md5" -> md5(content).toArray.map(_.toByte),
- name+".sha1" -> sha1(content).toArray.map(_.toByte)
+ name++".md5" -> md5(content).toArray.map(_.toByte),
+ name++".sha1" -> sha1(content).toArray.map(_.toByte)
)
}
val all = (files ++ checksums)
@@ -363,16 +359,14 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
def upload(fileName: String, fileContents: Array[Byte], baseUrl: URL): Unit = {
import java.net._
import java.io._
- logger.task("uploading "+fileName)
- val url = new URL(
- baseUrl + fileName
- )
+ logger.task("uploading "++fileName)
+ val url = baseUrl ++ fileName
val httpCon = url.openConnection.asInstanceOf[HttpURLConnection]
httpCon.setDoOutput(true)
httpCon.setRequestMethod("PUT")
val userPassword = read(Path(sonatypeLogin)).trim
val encoding = new sun.misc.BASE64Encoder().encode(userPassword.getBytes)
- httpCon.setRequestProperty("Authorization", "Basic " + encoding)
+ httpCon.setRequestProperty("Authorization", "Basic " ++ encoding)
httpCon.setRequestProperty("Content-Type", "application/binary")
httpCon.getOutputStream.write(
fileContents
@@ -389,7 +383,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
files.map{
file =>
- if(file.isFile) new File( dirname(file.toString) )
+ if(file.isFile) dirname(file)
else file
}.distinct.map{ file =>
val watchableFile = new WatchableFile(file)
@@ -411,7 +405,7 @@ final class Lib(logger: Logger) extends Stage1Lib(logger) with Scaffold{
.filterNot(_.kind == StandardWatchEventKind.OVERFLOW)
.map(_.context.toString)
.map(new File(_))
- changedFiles.foreach( f => logger.loop("Changed: "+f) )
+ changedFiles.foreach( f => logger.loop( "Changed: " ++ f.toString ) )
changedFiles.collect(action)
key.reset
}
diff --git a/stage2/PackageBuild.scala b/stage2/PackageBuild.scala
new file mode 100644
index 0000000..96c7b6f
--- /dev/null
+++ b/stage2/PackageBuild.scala
@@ -0,0 +1,27 @@
+package cbt
+import java.io.File
+import java.net.URL
+import scala.collection.immutable.Seq
+abstract class PackageBuild(context: Context) extends Build(context) with ArtifactInfo{
+ def `package`: Seq[File] = lib.concurrently( enableConcurrency )(
+ Seq(() => jar, () => docJar, () => srcJar)
+ )( _() )
+
+ private object cacheJarBasicBuild extends Cache[File]
+ def jar: File = cacheJarBasicBuild{
+ lib.jar( artifactId, version, compile, jarTarget )
+ }
+
+ private object cacheSrcJarBasicBuild extends Cache[File]
+ def srcJar: File = cacheSrcJarBasicBuild{
+ lib.srcJar(sources, artifactId, version, scalaTarget)
+ }
+
+ private object cacheDocBasicBuild extends Cache[File]
+ def docJar: File = cacheDocBasicBuild{
+ lib.docJar( sources, dependencyClasspath, apiTarget, jarTarget, artifactId, version, scalacOptions )
+ }
+
+ override def jars = jar +: dependencyJars
+ override def exportedJars: Seq[File] = Seq(jar)
+}
diff --git a/stage2/PublishBuild.scala b/stage2/PublishBuild.scala
new file mode 100644
index 0000000..e4e8fd7
--- /dev/null
+++ b/stage2/PublishBuild.scala
@@ -0,0 +1,41 @@
+package cbt
+import java.io.File
+import java.net.URL
+import scala.collection.immutable.Seq
+
+abstract class PublishBuild(context: Context) extends PackageBuild(context){
+ def name = artifactId
+ def description: String
+ def url: URL
+ def developers: Seq[Developer]
+ def licenses: Seq[License]
+ def scmUrl: String
+ def scmConnection: String
+ def pomExtra: Seq[scala.xml.Node] = Seq()
+
+ // ========== package ==========
+
+ /** put additional xml that should go into the POM file in here */
+ def pom: File = lib.pom(
+ groupId = groupId,
+ artifactId = artifactId,
+ version = version,
+ name = name,
+ description = description,
+ url = url,
+ developers = developers,
+ licenses = licenses,
+ scmUrl = scmUrl,
+ scmConnection = scmConnection,
+ dependencies = dependencies,
+ pomExtra = pomExtra,
+ jarTarget = jarTarget
+ )
+
+ // ========== publish ==========
+ final protected def releaseFolder = s"/${groupId.replace(".","/")}/$artifactId/$version/"
+ def snapshotUrl = new URL("https://oss.sonatype.org/content/repositories/snapshots")
+ def releaseUrl = new URL("https://oss.sonatype.org/service/local/staging/deploy/maven2")
+ def publishSnapshot: Unit = lib.publishSnapshot(sourceFiles, pom +: `package`, snapshotUrl ++ releaseFolder )
+ def publishSigned: Unit = lib.publishSigned(sourceFiles, pom +: `package`, releaseUrl ++ releaseFolder )
+}
diff --git a/stage2/Scaffold.scala b/stage2/Scaffold.scala
index 00c8706..18b2cc3 100644
--- a/stage2/Scaffold.scala
+++ b/stage2/Scaffold.scala
@@ -49,7 +49,7 @@ class Build(context: Context) extends BuildBuild(context){
override def scalaVersion: String = "2.11.7"
override def dependencies = super.dependencies ++ Seq(
- BuildDependency( projectDirectory + "/../build-shared/")
+ BuildDependency( projectDirectory.parent ++ "/build-shared")
// , "com.lihaoyi" %% "ammonite-ops" % "0.5.5"
)
}
@@ -85,7 +85,7 @@ class Build(context: Context) extends BuildBuild(context){
override def scalaVersion: String = "2.11.7"
override def dependencies = super.dependencies ++ Seq(
- BuildDependency( projectDirectory + "/../../build-shared/")
+ BuildDependency( projectDirectory.parent.parent ++ "/build-shared")
// , "com.lihaoyi" %% "ammonite-ops" % "0.5.5"
)
}
@@ -132,9 +132,9 @@ trait BuildShared extends BasicBuild{
generatedFiles.map{
case ( fileName, code ) =>
scala.util.Try{
- write( Path(projectDirectory+"/"+fileName), code )
+ write( Path( projectDirectory.string ++ "/" ++ fileName ), code )
import scala.Console._
- println( GREEN + "Created " + fileName + RESET )
+ println( GREEN ++ "Created " ++ fileName ++ RESET )
}
}.foreach(
_.recover{
diff --git a/stage2/Stage2.scala b/stage2/Stage2.scala
index c6783d4..ed63cf1 100644
--- a/stage2/Stage2.scala
+++ b/stage2/Stage2.scala
@@ -27,7 +27,7 @@ object Stage2{
}
val task = argsV.lift( taskIndex )
- val context = Context( argsV(0), argsV.drop( taskIndex + 1 ), logger )
+ val context = Context( new File(argsV(0)), argsV.drop( taskIndex + 1 ), logger )
val first = lib.loadRoot( context )
val build = first.finalBuild
@@ -38,7 +38,7 @@ object Stage2{
val triggerCbtFiles = Seq( nailgun, stage1, stage2 ).map(lib.realpath _)
val allTriggerFiles = triggerFiles ++ triggerCbtFiles
- logger.loop("Looping change detection over:\n - "+allTriggerFiles.mkString("\n - "))
+ logger.loop("Looping change detection over:\n - "++allTriggerFiles.mkString("\n - "))
lib.watch(allTriggerFiles) {
case file if triggerCbtFiles.exists(file.toString startsWith _.toString) =>
diff --git a/stage2/mixins.scala b/stage2/mixins.scala
index 4d72325..2b38cdf 100644
--- a/stage2/mixins.scala
+++ b/stage2/mixins.scala
@@ -3,15 +3,15 @@ package mixins
import scala.collection.immutable.Seq
import java.io._
trait Test extends Build{
- lazy val testedBuild = BuildDependency(projectDirectory+"/../")
+ lazy val testedBuild = BuildDependency( projectDirectory.parent )
override def dependencies = Seq( testedBuild ) ++ super.dependencies
override def scalaVersion = testedBuild.build.scalaVersion
}
trait Sbt extends Build{
- override def sources = Seq(new File(projectDirectory+"/src/main/scala/"))
+ override def sources = Seq( projectDirectory ++ "/src/main/scala" )
}
trait SbtTest extends Test{
- override def sources = Vector(new File(projectDirectory+"/../src/test/scala"))
+ override def sources = Vector( projectDirectory.parent ++ "/src/test/scala" )
}
trait ScalaTest extends Build with Test{
def scalaTestVersion: String
@@ -24,8 +24,8 @@ trait ScalaTest extends Build with Test{
override def cacheDependencyClassLoader = false
override def run: ExitCode = {
- val discoveryPath = compile.toString+"/"
- context.logger.lib("discoveryPath: "+discoveryPath)
+ val discoveryPath = compile.toString++"/"
+ context.logger.lib("discoveryPath: " ++ discoveryPath)
lib.runMain(
"org.scalatest.tools.Runner",
Seq("-R", discoveryPath, "-oF") ++ context.args.drop(1),