From 33f79a9fcd21982409ba6694a045e595889ac16b Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 8 May 2017 14:07:37 +0100 Subject: [PATCH 1/8] Make sure addSbtModule will work in sbt 1 For some reason using ClasspathDependency doesn't work in sbt 1, while ClasspathDep[ProjectReference] does. The latter is less specific and works just as well. --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index d42e32616..6ab28e277 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -64,7 +64,7 @@ object Dependencies { c: Option[Configuration] = None) = path match { case Some(f) => - p dependsOn c.fold[ClasspathDependency](ProjectRef(file(f), projectName))( + p dependsOn c.fold[ClasspathDep[ProjectReference]](ProjectRef(file(f), projectName))( ProjectRef(file(f), projectName) % _) case None => p settings (libraryDependencies += c.fold(m)(m % _)) } From d5a10923f878377d335e9497dc4630fd7a512ef9 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 8 May 2017 14:08:40 +0100 Subject: [PATCH 2/8] Drop myProvided from the build Introduces by Mark in d928047678624b51c6d240eb63d4df91179354ef. Dropped because Project#copy no longer exists (publically) in sbt 1. It looks like it might have been added to deal with transitive dependencies of scala-compiler, possibly JLine. Now it looks like it's only used by launcher-interface, which has 0 dependencies. --- build.sbt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index 33a6c8956..8b8426856 100644 --- a/build.sbt +++ b/build.sbt @@ -312,8 +312,6 @@ def scriptedUnpublishedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask { lazy val publishLauncher = TaskKey[Unit]("publish-launcher") -lazy val myProvided = config("provided") intransitive - def allProjects = Seq( testingProj, @@ -332,10 +330,7 @@ def allProjects = bundledLauncherProj ) -def projectsWithMyProvided = - allProjects.map(p => - p.copy(configurations = (p.configurations.filter(_ != Provided)) :+ myProvided)) -lazy val nonRoots = projectsWithMyProvided.map(p => LocalProject(p.id)) +lazy val nonRoots = allProjects.map(p => LocalProject(p.id)) def rootSettings = fullDocSettings ++ From f9e0dc0a48ce91edca7cae22631cf98236e0a824 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 8 May 2017 14:16:35 +0100 Subject: [PATCH 3/8] Upgrade to sbt-mima 0.1.14 --- build.sbt | 11 ++++------- project/plugins.sbt | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index 8b8426856..7b1335d1b 100644 --- a/build.sbt +++ b/build.sbt @@ -2,10 +2,6 @@ import Util._ import Dependencies._ import Sxr.sxr -import com.typesafe.tools.mima.core._, ProblemFilters._ -import com.typesafe.tools.mima.plugin.MimaKeys.{ binaryIssueFilters, previousArtifact } -import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings - // ThisBuild settings take lower precedence, // but can be shared across the multi projects. def buildLevelSettings: Seq[Setting[_]] = @@ -52,11 +48,12 @@ def commonSettings: Seq[Setting[_]] = crossScalaVersions := Seq(baseScalaVersion), bintrayPackage := (bintrayPackage in ThisBuild).value, bintrayRepository := (bintrayRepository in ThisBuild).value, - mimaDefaultSettings, publishArtifact in Test := false, mimaPreviousArtifacts := Set.empty, // Set(organization.value % moduleName.value % "1.0.0"), - mimaBinaryIssueFilters ++= Seq( - ) + mimaBinaryIssueFilters ++= { + import com.typesafe.tools.mima.core._, ProblemFilters._ + Seq() + } ) flatMap (_.settings) def minimalSettings: Seq[Setting[_]] = diff --git a/project/plugins.sbt b/project/plugins.sbt index 3edebabca..520ce89f0 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,7 +2,7 @@ scalaVersion := "2.10.6" scalacOptions ++= Seq("-feature", "-language:postfixOps") addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5") -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.11") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.14") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.4") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.8.5") addSbtPlugin("com.typesafe.sbt" % "sbt-javaversioncheck" % "0.1.0") From 3a7fc6d1e5ef2cac0b469a9dda6a731fb3d3523c Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 8 May 2017 14:34:30 +0100 Subject: [PATCH 4/8] Upgrade to sbt-git 0.9.2 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 520ce89f0..fcc71cf05 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ scalacOptions ++= Seq("-feature", "-language:postfixOps") addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.14") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.4") -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.8.5") +addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.2") addSbtPlugin("com.typesafe.sbt" % "sbt-javaversioncheck" % "0.1.0") addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.6.8") addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.2") From ad035955849ea136fc5659609fe8506e24a99c28 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 8 May 2017 14:34:41 +0100 Subject: [PATCH 5/8] Upgrade to sbt-site 1.2.0 --- build.sbt | 40 +++++++++++++++++++--------------------- project/Docs.scala | 28 ++++++++++++++-------------- project/plugins.sbt | 2 +- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/build.sbt b/build.sbt index 7b1335d1b..7bcace179 100644 --- a/build.sbt +++ b/build.sbt @@ -67,13 +67,30 @@ def testedBaseSettings: Seq[Setting[_]] = baseSettings ++ testDependencies lazy val sbtRoot: Project = (project in file(".")) - .enablePlugins(ScriptedPlugin) + .enablePlugins(ScriptedPlugin, SiteScaladocPlugin) .configs(Sxr.sxrConf) .aggregate(nonRoots: _*) .settings( buildLevelSettings, minimalSettings, - rootSettings, + Util.baseScalacOptions, + Docs.settings, + Sxr.settings, + scalacOptions += "-Ymacro-expand:none", // for both sxr and doc + sources in sxr := { + val allSources = (sources ?? Nil).all(docProjects).value + allSources.flatten.distinct + }, //sxr + sources in (Compile, doc) := (sources in sxr).value, // doc + Sxr.sourceDirectories := { + val allSourceDirectories = (sourceDirectories ?? Nil).all(docProjects).value + allSourceDirectories.flatten + }, + fullClasspath in sxr := (externalDependencyClasspath in Compile in sbtProj).value, + dependencyClasspath in (Compile, doc) := (fullClasspath in sxr).value, + Util.publishPomSettings, + otherRootSettings, + Transform.conscriptSettings(bundledLauncherProj), publish := {}, publishLocal := {} ) @@ -329,10 +346,6 @@ def allProjects = lazy val nonRoots = allProjects.map(p => LocalProject(p.id)) -def rootSettings = - fullDocSettings ++ - Util.publishPomSettings ++ otherRootSettings ++ - Transform.conscriptSettings(bundledLauncherProj) def otherRootSettings = Seq( scripted := scriptedTask.evaluated, @@ -380,21 +393,6 @@ lazy val docProjects: ScopeFilter = ScopeFilter( inAnyProject -- inProjects(sbtRoot, sbtProj, scriptedSbtProj, scriptedPluginProj), inConfigurations(Compile) ) -def fullDocSettings = Util.baseScalacOptions ++ Docs.settings ++ Sxr.settings ++ Seq( - scalacOptions += "-Ymacro-expand:none", // for both sxr and doc - sources in sxr := { - val allSources = (sources ?? Nil).all(docProjects).value - allSources.flatten.distinct - }, //sxr - sources in (Compile, doc) := (sources in sxr).value, // doc - Sxr.sourceDirectories := { - val allSourceDirectories = (sourceDirectories ?? Nil).all(docProjects).value - allSourceDirectories.flatten - }, - fullClasspath in sxr := (externalDependencyClasspath in Compile in sbtProj).value, - dependencyClasspath in (Compile, doc) := (fullClasspath in sxr).value -) - lazy val safeUnitTests = taskKey[Unit]("Known working tests (for both 2.10 and 2.11)") lazy val safeProjects: ScopeFilter = ScopeFilter( inProjects(mainSettingsProj, mainProj, actionsProj, runProj, stdTaskProj), diff --git a/project/Docs.scala b/project/Docs.scala index 0721eb920..2db6636fd 100644 --- a/project/Docs.scala +++ b/project/Docs.scala @@ -1,24 +1,23 @@ import sbt._ import Keys._ import StatusPlugin.autoImport._ -import com.typesafe.sbt.{ SbtGhPages, SbtGit, SbtSite, site => sbtsite } -import SbtSite.{ site, SiteKeys } +import com.typesafe.sbt.site.SitePlugin.autoImport._ +import com.typesafe.sbt.site.SiteScaladocPlugin.autoImport._ +import com.typesafe.sbt.{ SbtGhPages, SbtGit } import SbtGhPages.{ ghpages, GhPagesKeys => ghkeys } import SbtGit.{ git, GitKeys } -import sbtsite.SphinxSupport -import SiteKeys.{ makeSite, siteMappings } -import Sxr.sxr +import Sxr.{ sxr, sxrConf } import SiteMap.Entry object Docs { val siteExcludes = Set(".buildinfo", "objects.inv") def siteInclude(f: File) = !siteExcludes.contains(f.getName) - def settings: Seq[Setting[_]] = - site.settings ++ - site.includeScaladoc("api") ++ - siteIncludeSxr("sxr") ++ - ghPagesSettings + def settings: Seq[Setting[_]] = Def settings ( + siteSubdirName in SiteScaladoc := "api", + siteIncludeSxr("sxr"), + ghPagesSettings + ) def ghPagesSettings = ghpages.settings ++ Seq( git.remoteRepo := "git@github.com:sbt/sbt.github.com.git", @@ -34,10 +33,11 @@ object Docs { Path.userHome / ".sbt" / "ghpages" / status / organization.value / name.value } - def siteIncludeSxr(prefix: String) = - Seq( - mappings in sxr := Path.allSubpaths(sxr.value).toSeq - ) ++ site.addMappingsToSiteDir(mappings in sxr, prefix) + def siteIncludeSxr(prefix: String) = Def settings ( + mappings in sxr := Path.allSubpaths(sxr.value).toSeq, + siteSubdirName in sxrConf := prefix, + addMappingsToSiteDir(mappings in sxr, siteSubdirName in sxrConf) + ) def synchLocalImpl = Def task { val repo = ghkeys.updatedRepository.value diff --git a/project/plugins.sbt b/project/plugins.sbt index fcc71cf05..be879644a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -7,6 +7,6 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.4") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.2") addSbtPlugin("com.typesafe.sbt" % "sbt-javaversioncheck" % "0.1.0") addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.6.8") -addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.2") +addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.2.0") addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0") addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M4") From b65dc1830e63ed58e4df45377dd5479d67dda1ae Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 8 May 2017 14:36:00 +0100 Subject: [PATCH 6/8] Upgrade to sbt-bintray 0.4.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index be879644a..9e7329162 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -8,5 +8,5 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.2") addSbtPlugin("com.typesafe.sbt" % "sbt-javaversioncheck" % "0.1.0") addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.6.8") addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.2.0") -addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0") +addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.4.0") addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M4") From 55e055fa3966bd7fe8f61e028e637e80314fd6d9 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 8 May 2017 14:46:29 +0100 Subject: [PATCH 7/8] Upgrade to sbt-ghpages 0.6.0 --- build.sbt | 2 +- project/Docs.scala | 21 +++++++++------------ project/plugins.sbt | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/build.sbt b/build.sbt index 7bcace179..071b73a9a 100644 --- a/build.sbt +++ b/build.sbt @@ -67,7 +67,7 @@ def testedBaseSettings: Seq[Setting[_]] = baseSettings ++ testDependencies lazy val sbtRoot: Project = (project in file(".")) - .enablePlugins(ScriptedPlugin, SiteScaladocPlugin) + .enablePlugins(ScriptedPlugin, SiteScaladocPlugin, GhpagesPlugin) .configs(Sxr.sxrConf) .aggregate(nonRoots: _*) .settings( diff --git a/project/Docs.scala b/project/Docs.scala index 2db6636fd..11410185a 100644 --- a/project/Docs.scala +++ b/project/Docs.scala @@ -1,13 +1,10 @@ -import sbt._ -import Keys._ +import sbt._, Keys._ import StatusPlugin.autoImport._ import com.typesafe.sbt.site.SitePlugin.autoImport._ import com.typesafe.sbt.site.SiteScaladocPlugin.autoImport._ -import com.typesafe.sbt.{ SbtGhPages, SbtGit } -import SbtGhPages.{ ghpages, GhPagesKeys => ghkeys } -import SbtGit.{ git, GitKeys } +import com.typesafe.sbt.sbtghpages.GhpagesPlugin.autoImport._ +import com.typesafe.sbt.SbtGit, SbtGit.{ git, GitKeys } import Sxr.{ sxr, sxrConf } -import SiteMap.Entry object Docs { val siteExcludes = Set(".buildinfo", "objects.inv") @@ -19,14 +16,14 @@ object Docs { ghPagesSettings ) - def ghPagesSettings = ghpages.settings ++ Seq( + def ghPagesSettings = Def settings ( git.remoteRepo := "git@github.com:sbt/sbt.github.com.git", localRepoDirectory, - ghkeys.synchLocal := synchLocalImpl.value, - GitKeys.gitBranch in ghkeys.updatedRepository := Some("master") + ghpagesSynchLocal := synchLocalImpl.value, + ghpagesBranch := "master" ) - def localRepoDirectory = ghkeys.repository := { + def localRepoDirectory = ghpagesRepository := { // distinguish between building to update the site or not so that CI jobs // that don't commit+publish don't leave uncommitted changes in the working directory val status = if (isSnapshot.value) "snapshot" else "public" @@ -40,11 +37,11 @@ object Docs { ) def synchLocalImpl = Def task { - val repo = ghkeys.updatedRepository.value + val repo = ghpagesUpdatedRepository.value val versioned = repo / version.value IO.delete(versioned / "sxr") IO.delete(versioned / "api") - val mappings = ghkeys.privateMappings.value + val mappings = ghpagesPrivateMappings.value val toCopy = for ((file, target) <- mappings if siteInclude(file)) yield (file, versioned / target) IO.copy(toCopy) diff --git a/project/plugins.sbt b/project/plugins.sbt index 9e7329162..8d51f7bb3 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,7 +3,7 @@ scalacOptions ++= Seq("-feature", "-language:postfixOps") addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.14") -addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.4") +addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.0") addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.2") addSbtPlugin("com.typesafe.sbt" % "sbt-javaversioncheck" % "0.1.0") addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.6.8") From 31f61948d6ee28d4d206f8dbc9573e0a631d171d Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 8 May 2017 15:18:36 +0100 Subject: [PATCH 8/8] Add a few more migration notes to 1.0.0 notes --- notes/1.0.0.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notes/1.0.0.markdown b/notes/1.0.0.markdown index a90421825..bdb40e59d 100644 --- a/notes/1.0.0.markdown +++ b/notes/1.0.0.markdown @@ -31,6 +31,10 @@ We are working with Scala Center to provide [an automatic migration tool][sbt-mi - Drops deprecated `seq(..)` DSL method. Use `Seq` or pass in the settings without wrapping. - Drops deprecated `File`/`Seq[File]` setting enrichments. Use `.value` and `Def.setting`. - Drops deprecated `SubProcess` `apply` overload. Use `SubProcess(ForkOptions(runJVMOptions = ..))`. +- Drops `toError(o: Option[String]): Unit` in favour of `o foreach sys.error`. +- A number of the methods on `sbt.Path` (such as `relativeTo` and `rebase` and `flat`) are now no longer in the + default namespace by virtue of being mixed into the sbt package object. Use `sbt.io.Path` to access them + again. #### Features