diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-27 09:55:00 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-28 13:34:01 -0400 |
commit | f946be87b81cc9cb040ab5e3f8a5195a915ad1e4 (patch) | |
tree | 2907459834a584fb0f34992c3c3b9af5647a745b | |
parent | 7f9380157a5cf95e767f74d6f7c52da24ea8f51f (diff) | |
download | cbt-f946be87b81cc9cb040ab5e3f8a5195a915ad1e4.tar.gz cbt-f946be87b81cc9cb040ab5e3f8a5195a915ad1e4.tar.bz2 cbt-f946be87b81cc9cb040ab5e3f8a5195a915ad1e4.zip |
minor improvements to docs, imports, visibilities
-rw-r--r-- | DEVELOPER_GUIDE.txt | 2 | ||||
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | stage1/Cache.scala | 2 | ||||
-rw-r--r-- | stage1/MultiClassLoader.scala | 1 | ||||
-rw-r--r-- | stage1/cbt.scala | 2 | ||||
-rw-r--r-- | stage1/resolver.scala | 11 |
6 files changed, 13 insertions, 11 deletions
diff --git a/DEVELOPER_GUIDE.txt b/DEVELOPER_GUIDE.txt index 0e20339..e42277e 100644 --- a/DEVELOPER_GUIDE.txt +++ b/DEVELOPER_GUIDE.txt @@ -1,6 +1,6 @@ Welcome developer. -CBT has a very easy code base that you can fully master it in an afternoon. +CBT has a very easy code base that you can fully master in very little time. Don't shy away from submiting PRs :). And because CBT bootstraps from source you already have the code there. @@ -71,16 +71,16 @@ You can see how your build is configured via overrides. call `cbt` to see a full list of available commands for this build. -Look into the class `DefaultBuild` in CBT's source code to see their +Look into the class PackageBuild (and it's super class BasicBuild) in CBT's source code to see their details. The source code is really simple. Don't shy away from looking, even as a beginner. No crazy stuff, I promise ;). You -can find the relevant code in CBT's `stage2/DefaultBuild.scala` +can find the relevant code in CBT's stage2/BasicBuild.scala I order to keep executing the same command triggered by file changes use `cbt loop <command>`. You can find example builds in CBT's own `test/` folder. Not all of them have a build file, in which case CBT uses the default -`cbt.DefaultBuild`. +cbt.BasicBuild. A folder `build/` can have its own folder `build/` inside in order to add source or maven dependencies to your build. Eventually diff --git a/stage1/Cache.scala b/stage1/Cache.scala index 6e6b9eb..a8036e5 100644 --- a/stage1/Cache.scala +++ b/stage1/Cache.scala @@ -1,6 +1,6 @@ package cbt /** -Caches exactly one value +Caches exactly one value. Is there a less boiler-platy way to achieve this, that doesn't require creating an instance for each thing you want to cache? */ diff --git a/stage1/MultiClassLoader.scala b/stage1/MultiClassLoader.scala index cce4cd5..74e65aa 100644 --- a/stage1/MultiClassLoader.scala +++ b/stage1/MultiClassLoader.scala @@ -1,6 +1,5 @@ package cbt import java.net._ -import scala.util.Try import scala.collection.immutable.Seq // do not make this a case class, required object identity equality diff --git a/stage1/cbt.scala b/stage1/cbt.scala index 01af0d5..7b8b632 100644 --- a/stage1/cbt.scala +++ b/stage1/cbt.scala @@ -2,6 +2,8 @@ package cbt import java.io._ import java.nio.file._ import java.net._ +import scala.collection.immutable.Seq + object `package`{ private val lib = new BaseLib implicit class FileExtensionMethods( file: File ){ diff --git a/stage1/resolver.scala b/stage1/resolver.scala index c2855c5..ad6df23 100644 --- a/stage1/resolver.scala +++ b/stage1/resolver.scala @@ -159,7 +159,7 @@ abstract class Dependency{ noInfo ++ BoundMavenDependency.updateOutdated( hasInfo ).reverse.distinct } - def show: String = this.getClass.getSimpleName + override def show: String = this.getClass.getSimpleName // ========== debug ========== def dependencyTree: String = dependencyTreeRecursion() private def dependencyTreeRecursion(indent: Int = 0): String = ( @@ -296,6 +296,7 @@ case class BoundMavenDependency( import scala.collection.JavaConversions._ private def resolve(suffix: String, hash: Option[String]): File = { + logger.resolver("Resolving "+this) val file = mavenCache ++ basePath ++ "." ++ suffix val urls = repositories.map(_ ++ basePath ++ "." ++ suffix) urls.find( @@ -325,10 +326,10 @@ case class BoundMavenDependency( private object pomCache extends Cache[File] def pom: File = pomCache{ resolve("pom", Some(pomSha1)) } - def pomXml = XML.loadFile(pom.string) + private def pomXml = XML.loadFile(pom.string) // ========== pom traversal ========== - lazy val transitivePom: Seq[BoundMavenDependency] = { + private lazy val transitivePom: Seq[BoundMavenDependency] = { (pomXml \ "parent").collect{ case parent => BoundMavenDependency( @@ -342,7 +343,7 @@ case class BoundMavenDependency( }.flatMap(_.transitivePom) :+ this } - lazy val properties: Map[String, String] = ( + private lazy val properties: Map[String, String] = ( transitivePom.flatMap{ d => val props = (d.pomXml \ "properties").flatMap(_.child).map{ tag => tag.label -> tag.text @@ -352,7 +353,7 @@ case class BoundMavenDependency( } ).toMap - lazy val dependencyVersions: Map[String, (String,String)] = + private lazy val dependencyVersions: Map[String, (String,String)] = transitivePom.flatMap( p => (p.pomXml \ "dependencyManagement" \ "dependencies" \ "dependency").map{ |