diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d37622bac..7d12e06ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -153,7 +153,7 @@ sbt uses two branches for development: - Development branch: `1.x` (this is also called "master") - Stable branch: `1.$MINOR.x`, where `$MINOR` is current minor version (e.g. `1.1.x` during 1.1.x series) -If you're working on a bug fix, it's a good idea to start with the `1.$MINOR.x` branch. Since we can always safely merge from stable to `1.x`, but not other way around. +If you're working on a bug fix, it's a good idea to start with the `1.$MINOR.x` branch, since we can always safely merge from stable to `1.x`, but not other way around. ### Instruction to build all modules from source @@ -170,12 +170,11 @@ If you're working on a bug fix, it's a good idea to start with the `1.$MINOR.x` $ ./sbt-allsources.sh ``` -3. To build the launcher and publish all components locally, +3. To build and publish all components locally, ``` $ ./sbt-allsources.sh - > ;{../io}/publishLocal; {../util}/publishLocal; {../librarymanagement}/publishLocal; {../zinc}/publishLocal - > publishLocal + sbt:sbtRoot> publishLocalAllModule ``` ### Instruction to build just sbt @@ -184,23 +183,24 @@ If the change you are making is contained in sbt/sbt, you could publishLocal on ``` $ sbt -> publishLocal +sbt:sbtRoot> publishLocal ``` ### Using the locally built sbt -To use the locally built sbt, set the version in `build.properties` file to `1.$MINOR.$PATCH-SNAPSHOT`, or pass it in as `-Dsbt-version` property. +To use the locally built sbt, set the version in `build.properties` file to `1.$MINOR.$PATCH-SNAPSHOT`. ``` $ cd ../hello -$ sbt -Dsbt-version=1.1.2-SNAPSHOT +$ sbt +> compile ``` ### Clearing out boot and local cache -When you run a locally built sbt, the JAR artifacts will be now cached under `$HOME/.sbt/boot/scala-2.12.4/org.scala-sbt/sbt/1.$MINOR.$PATCh-SNAPSHOT` directory. To clear this out run: `reboot dev` command from sbt's session of your test application. +When you run a locally built sbt, the JAR artifacts will be now cached under `$HOME/.sbt/boot/scala-2.12.4/org.scala-sbt/sbt/1.$MINOR.$PATCH-SNAPSHOT` directory. To clear this out run: `reboot dev` command from sbt's session of your test application. -One drawback of `-SNAPSHOT` version is that it's slow to resolve as it tries to hit all the resolvers. You can workaround that by using a version name like `1.$MONIR.$PATCH-LOCAL1`. A non-SNAPSHOT artifacts will now be cached under `$HOME/.ivy/cache/` directory, so you need to clear that out using [sbt-dirty-money](https://github.com/sbt/sbt-dirty-money)'s `cleanLocal` task. +One drawback of `-SNAPSHOT` version is that it's slow to resolve as it tries to hit all the resolvers. You can workaround that by using a version name like `1.$MINOR.$PATCH-LOCAL1`. A non-SNAPSHOT artifacts will now be cached under `$HOME/.ivy/cache/` directory, so you need to clear that out using [sbt-dirty-money](https://github.com/sbt/sbt-dirty-money)'s `cleanLocal` task. ### Diagnosing build failures diff --git a/build.sbt b/build.sbt index 82fcd4ef6..adadee53c 100644 --- a/build.sbt +++ b/build.sbt @@ -669,6 +669,29 @@ def customCommands: Seq[Setting[_]] = Seq( "reload" :: state }, + commands += Command.command("publishLocalAllModule") { state => + val extracted = Project.extract(state) + import extracted._ + val sv = get(scalaVersion) + val projs = structure.allProjectRefs + val ioOpt = projs find { case ProjectRef(_, id) => id == "ioRoot"; case _ => false } + val utilOpt = projs find { case ProjectRef(_, id) => id == "utilRoot"; case _ => false } + val lmOpt = projs find { case ProjectRef(_, id) => id == "lmRoot"; case _ => false } + val zincOpt = projs find { case ProjectRef(_, id) => id == "zincRoot"; case _ => false } + (ioOpt map { case ProjectRef(build, _) => "{" + build.toString + "}/publishLocal" }).toList ::: + (utilOpt map { case ProjectRef(build, _) => "{" + build.toString + "}/publishLocal" }).toList ::: + (lmOpt map { case ProjectRef(build, _) => "{" + build.toString + "}/publishLocal" }).toList ::: + (zincOpt map { case ProjectRef(build, _) => + val zincSv = get(scalaVersion in ProjectRef(build, "zinc")) + val csv = get(crossScalaVersions in ProjectRef(build, "compilerBridge")).toList + (csv flatMap { bridgeSv => + s"++$bridgeSv" :: ("{" + build.toString + "}compilerBridge/publishLocal") :: Nil + }) ::: + List(s"++$zincSv", "{" + build.toString + "}/publishLocal") + }).getOrElse(Nil) ::: + List(s"++$sv", "publishLocal") ::: + state + }, /** There are several complications with sbt's build. * First is the fact that interface project is a Java-only project * that uses source generator from datatype subproject in Scala 2.10.6. diff --git a/project/Dependencies.scala b/project/Dependencies.scala index a8bb47140..aa50fc3e1 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -55,7 +55,7 @@ object Dependencies { def addSbtModule(p: Project, path: Option[String], projectName: String, m: ModuleID) = path match { case Some(f) => p dependsOn ProjectRef(file(f), projectName) - case None => p settings (libraryDependencies += m) + case None => p settings (libraryDependencies += m, dependencyOverrides += m) } def addSbtIO(p: Project): Project = addSbtModule(p, sbtIoPath, "io", sbtIO)