Skip to content

Commit

Permalink
Merge pull request #195 from cunei/wip-move-to-2121
Browse files Browse the repository at this point in the history
dbuild 0.9.7, with 1.0.0-M5 and 1.0.0-M6 compatibility
  • Loading branch information
cunei authored Jun 16, 2017
2 parents 89a970d + bf29875 commit ee1eaff
Show file tree
Hide file tree
Showing 54 changed files with 434 additions and 289 deletions.
20 changes: 18 additions & 2 deletions adapter/src/main/scala-2.10/Adapter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ object Adapter {
val IO = sbt.IO
val Path = sbt.Path
type RichFile = sbt.RichFile
def newIvyPaths(baseDirectory: java.io.File, ivyHome: Option[java.io.File]) =
new sbt.IvyPaths(baseDirectory, ivyHome)
type FileFilter = sbt.FileFilter
def toFF = sbt.FileFilter.globFilter _
val DirectoryFilter = sbt.DirectoryFilter
Expand All @@ -37,10 +39,24 @@ object Adapter {
type Logger = sbt.Logger
import Path._
def allPaths(f:File) = sbt.PathFinder(f).***
val syntax = new {}
val syntaxio = syntax
val syntaxio = new {}
type ModuleID = sbt.ModuleID
type Artifact = sbt.Artifact
type CrossVersion = sbt.CrossVersion
type IvyScala = sbt.IvyScala
def moduleWithName(m:ModuleID, n:String) = m.copy(name=n)
def moduleWithRevision(m:ModuleID, r:String) = m.copy(revision=r)
def moduleWithCrossVersion(m:ModuleID, cross:CrossVersion) = m.copy(crossVersion=cross)
def moduleWithExplicitArtifacts(m:ModuleID, ea:Seq[Artifact]) = m.copy(explicitArtifacts=ea)
def moduleWithExtraAttributes(m:ModuleID, ea:Map[String,String]) = m.copy(extraAttributes=ea)
def ivyScalaWithCheckExplicit(i:IvyScala, ce:Boolean) = i.copy(checkExplicit=ce)
def artifactWithClassifier(a:Artifact, cl:Option[String]) = a.copy(classifier=cl)
val crossDisabled = sbt.CrossVersion.Disabled
type crossDisabled = sbt.CrossVersion.Disabled.type
val crossBinary = sbt.CrossVersion.binary
type crossBinary = sbt.CrossVersion.Binary
val crossFull = sbt.CrossVersion.full
type crossFull = sbt.CrossVersion.Full
type ProjectResolver = sbt.ProjectResolver
type ScalaInstance = sbt.ScalaInstance
lazy val ScalaInstance = sbt.ScalaInstance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ object Adapter {
val IO = sbt.io.IO
val Path = sbt.io.Path
type RichFile = sbt.io.RichFile
def newIvyPaths(baseDirectory: java.io.File, ivyHome: Option[java.io.File]) =
sbt.internal.librarymanagement.IvyPaths(baseDirectory, ivyHome)
type FileFilter = sbt.io.FileFilter
def toFF = sbt.io.FileFilter.globFilter _
val DirectoryFilter = sbt.io.DirectoryFilter
Expand All @@ -34,9 +36,24 @@ object Adapter {
type Logger = sbt.util.Logger
def allPaths(f:File) = sbt.io.PathFinder(f).allPaths
val syntaxio = sbt.io.syntax
val syntax = sbt.syntax
type ModuleID = sbt.librarymanagement.ModuleID
type Artifact = sbt.librarymanagement.Artifact
type CrossVersion = sbt.librarymanagement.CrossVersion
type IvyScala = sbt.librarymanagement.IvyScala
val IvyScala = sbt.librarymanagement.IvyScala
def moduleWithName(m:ModuleID, name:String) = m.withName(name)
def moduleWithRevision(m:ModuleID, revision:String) = m.withRevision(revision)
def moduleWithCrossVersion(m:ModuleID, cross:CrossVersion) = m.withCrossVersion(cross)
def moduleWithExplicitArtifacts(m:ModuleID, ea:Seq[Artifact]) = m.withExplicitArtifacts(ea.toVector)
def moduleWithExtraAttributes(m:ModuleID, ea:Map[String,String]) = m.withExtraAttributes(ea)
def ivyScalaWithCheckExplicit(i:IvyScala, ce:Boolean) = i.withCheckExplicit(ce)
def artifactWithClassifier(a:Artifact, cl:Option[String]) = a.withClassifier(cl)
val crossDisabled = sbt.librarymanagement.Disabled()
type crossDisabled = sbt.librarymanagement.Disabled
val crossBinary = sbt.librarymanagement.Binary()
type crossBinary = sbt.librarymanagement.Binary
val crossFull = sbt.librarymanagement.Full()
type crossFull = sbt.librarymanagement.Full
type ProjectResolver = sbt.internal.librarymanagement.ProjectResolver
type ScalaInstance = sbt.internal.inc.ScalaInstance
val ScalaInstance = sbt.internal.inc.ScalaInstance
Expand Down
65 changes: 37 additions & 28 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Dependencies._

def MyVersion: String = "0.9.7-SNAPSHOT"
def MyVersion: String = "0.9.7"

def SubProj(name: String) = (
Project(name, file(if (name=="root") "." else name))
Expand All @@ -24,25 +24,30 @@ def SubProj(name: String) = (

import RemoteDepHelper._

def skip211 = Seq(
skip in compile := scalaVersion.value.startsWith("2.11"),
def skip212 = Seq(
skip in compile := scalaVersion.value.startsWith("2.12"),
sources in doc in Compile :=
{ if((skip in compile).value) List() else (sources in doc in Compile).value }
{
val theSources = (sources in doc in Compile).value
if((skip in compile).value) List() else theSources
}
)

def selectScalaVersion =
scalaVersion := {
val sb = (sbtVersion in sbtPlugin).value
if (sb.startsWith("0.13")) "2.10.6" else "2.11.8"
if (sb.startsWith("0.13")) "2.10.6" else "2.12.2"
}

lazy val root = (
SubProj("root")
aggregate(adapter, graph, hashing, logging, actorLogging, proj, actorProj, deploy,
aggregate(adapter, graph, hashing, logging, actorLogging, proj, actorProj, deploy, http,
core, plugin, build, support, supportGit, repo, metadata, docs, dist, indexmeta)
settings(publish := (), publishLocal := (), version := MyVersion)
//settings(CrossPlugin.crossBuildingSettings:_*)
//settings(CrossBuilding.crossSbtVersions := Seq("0.13","1.0.0-M4"), selectScalaVersion)
// settings(CrossPlugin.crossBuildingSettings:_*)
// settings(CrossBuilding.crossSbtVersions := Seq("0.13","1.0.0-M6"), selectScalaVersion)
// This would work with the integrated version of sbt-cross-building
// settings(crossSbtVersions := Seq("0.13","1.0.0-M6"), selectScalaVersion)
settings(commands += Command.command("release") { state =>
"clean" :: "publish" :: state
})
Expand All @@ -53,8 +58,7 @@ lazy val root = (
// the source file to sbt 0.13/1.0
lazy val adapter = (
SubProj("adapter")
dependsOnSbtProvided(sbtLogging, sbtIo, sbtLaunchInt, sbtIvy, sbtSbt)
dependsOnRemote(zincProvidedIf211:_*)
dependsOnSbtProvided((Seq[String=>ModuleID](sbtLogging, sbtIo, dbuildLaunchInt, sbtIvy, sbtSbt) ++ zincIf212):_*)
settings(sourceGenerators in Compile += task {
val dir = (sourceManaged in Compile).value
val fileName = "Default.scala"
Expand Down Expand Up @@ -93,15 +97,15 @@ lazy val indexmeta = (
lazy val logging = (
SubProj("logging")
dependsOn(adapter,graph)
dependsOnSbtProvided(sbtLogging, sbtIo, sbtLaunchInt)
dependsOnSbtProvided(sbtLogging, sbtIo, dbuildLaunchInt)
)

lazy val actorLogging = (
SubProj("actorLogging")
dependsOn(logging)
dependsOnRemote(akkaActor)
dependsOnSbtProvided(sbtLogging, sbtIo, sbtLaunchInt)
settings(skip211:_*)
dependsOnSbtProvided(sbtLogging, sbtIo, dbuildLaunchInt)
settings(skip212:_*)
)

lazy val metadata = (
Expand All @@ -112,9 +116,16 @@ lazy val metadata = (

lazy val repo = (
SubProj("repo")
dependsOn(adapter, metadata, logging)
dependsOnRemote(mvnAether, dispatch, aether, aetherApi, aetherSpi, aetherUtil, aetherImpl, aetherConnectorBasic, aetherFile, aetherHttp, aetherWagon, mvnAether)
dependsOnSbtProvided(sbtIo, sbtLaunchInt, sbtLogging)
dependsOn(http, adapter, metadata, logging)
dependsOnRemote(mvnAether, aether, aetherApi, aetherSpi, aetherUtil, aetherImpl, aetherConnectorBasic, aetherFile, aetherHttp, aetherWagon, mvnAether)
dependsOnSbtProvided(sbtIo, dbuildLaunchInt, sbtLogging, sbtSbt)
)

lazy val http = (
SubProj("http")
dependsOn(adapter)
dependsOnRemote(dispatch)
dependsOnSbtProvided(sbtIo, sbtIvy/*, dbuildLauncher*/)
)

lazy val core = (
Expand All @@ -135,15 +146,15 @@ lazy val actorProj = (
SubProj("actorProj")
dependsOn(core, actorLogging, proj)
dependsOnSbtProvided(sbtIo, sbtIvy)
settings(skip211:_*)
settings(skip212:_*)
)

lazy val support = (
SubProj("support")
dependsOn(core, repo, metadata, proj % "compile->compile;it->compile", logging % "it")
dependsOnRemote(mvnEmbedder, mvnWagon, javaMail, aether, aetherApi, aetherSpi, aetherUtil,
aetherImpl, aetherConnectorBasic, aetherFile, aetherHttp, slf4jSimple, ivy)
dependsOnSbtProvided(sbtLaunchInt, sbtIvy)
dependsOnSbtProvided(dbuildLaunchInt, sbtIvy)
settings(SbtSupport.buildSettings:_*)
settings(SbtSupport.settings:_*)
settings(
Expand All @@ -163,10 +174,8 @@ lazy val supportGit = (
SubProj("supportGit")
dependsOn(core, repo, metadata, proj, support)
dependsOnRemote(mvnEmbedder, mvnWagon, javaMail, jgit)
dependsOnSbtProvided(sbtLaunchInt, sbtIvy)
settings(SbtSupport.buildSettings:_*)
settings(SbtSupport.settings:_*)
settings(skip211:_*)
dependsOnSbtProvided(dbuildLaunchInt, sbtIvy)
settings(skip212:_*)
)

// SBT plugin
Expand All @@ -184,18 +193,18 @@ lazy val dist = (

lazy val deploy = (
SubProj("deploy")
dependsOn(adapter)
dependsOnRemote(jackson, typesafeConfig, commonsLang, aws, uriutil, dispatch, commonsIO, jsch, jacks)
dependsOnSbtProvided(sbtLogging, sbtIo)
dependsOn(adapter, http)
dependsOnRemote(jackson, typesafeConfig, commonsLang, aws, uriutil, commonsIO, jsch, jacks)
dependsOnSbtProvided(sbtLogging, sbtIo, sbtSbt)
)

lazy val build = (
SubProj("build")
dependsOn(actorProj, support, supportGit, repo, metadata, deploy, proj)
dependsOnRemote(aws, uriutil, dispatch, jsch, oro, scallop, commonsLang)
dependsOnRemote(aws, uriutil, jsch, oro, scallop, commonsLang)
dependsOnRemote(gpgLibIf210:_*)
dependsOnSbt(sbtLaunchInt, sbtLauncher, sbtLogging, sbtIo, sbtIvy, sbtSbt)
settings(skip211:_*)
dependsOnSbt(dbuildLaunchInt, sbtLogging, sbtIo, sbtIvy, sbtSbt, dbuildLauncher)
settings(skip212:_*)
settings(SbtSupport.settings:_*)
settings(
// We hook the testLoader of it to make sure all the it tasks have a legit sbt plugin to use.
Expand Down
4 changes: 2 additions & 2 deletions build/src/main/scala/com/typesafe/dbuild/build/Checkout.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ object Checkout {
case z => sys.error("Internal error, unexpected split result: " + z)
}
}
val listMap = xsbt.boot.ListMap(resolversMap.toSeq.reverse: _*)
// getRepositories contains a ListMap.toList, where sbt's definition
// of toList is "backing.reverse". So we have to reverse again,
// and we finally get the needed List[xsbti.Repository]
val listMap = xsbt.boot.ListMap(resolversMap.toSeq.reverse: _*)
val savedRepos = (new xsbt.boot.ConfigurationParser).getRepositories(listMap)

val repos = if (useLocalResolvers || savedRepos.isEmpty)
Expand Down Expand Up @@ -126,4 +126,4 @@ object Checkout {
// return declaring success
new xsbti.Exit { def code = 0 }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class DeployBuild(options: GeneralOptions, log: Logger) extends OptionTask(log)
}
goodModInfos
} catch {
case e =>
case e:Throwable =>
log.error("***ERROR*** Encountered an error while deploying to " + options.uri)
throw e
}
Expand All @@ -153,7 +153,7 @@ class DeployBuild(options: GeneralOptions, log: Logger) extends OptionTask(log)
Deploy.deploy(target = indexOptions, indexDir, log)
}
catch {
case e =>
case e:Throwable =>
log.error("***ERROR*** Encountered an error while generating or deploying the index file to " + indexOptions.uri)
throw e
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class EmailNotificationContext(log: Logger) extends NotificationContext[EmailNot
} catch {
// getLocalHost() will throw an exception if the current hostname is set but unrecognized
// by the local dns server. As a last resort, we fall back to "localhost".
case e => "localhost"
case e:java.net.UnknownHostException => "localhost"
}
"dbuild at " + host + " <" + userName + "@" + host + ">"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract class OptionTask(log: Logger) {
def runRememberingExceptions[A](diagnose: Boolean, i: Iterable[A])(f: A => Unit) = {
val status = i map { item =>
try { f(item); (true, "") } catch {
case e =>
case e:Throwable =>
// Got an error from this notification? remember it and continue.
// use "diagnose" to print diagnostics only in the innermost calls
if (diagnose) prepareLogMsg(log, e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ class SbtBuildMain extends xsbti.AppMain {
conflicts(noNotify, List(checkout.uuid, checkout.project, checkout.path))
conflicts(local, List(checkout.uuid, checkout.project, checkout.path))
// requireOne(checkout.uuid,configFile) // use manual checking (below) to get a better error message
addSubcommand(checkout)
verify()
}
try {
val useLocalResolvers = conf.noResolvers() || conf.local()
Expand Down Expand Up @@ -220,9 +222,9 @@ class SbtBuildMain extends xsbti.AppMain {
val repos = if (useLocalResolvers || resolvers.isEmpty)
localRepos
else {
val listMap = xsbt.boot.ListMap(resolvers.toSeq.reverse: _*)
// getRepositories contains a ListMap.toList, where sbt's definition
// of toList is "backing.reverse". So we have to reverse again.
val listMap = xsbt.boot.ListMap(resolvers.toSeq.reverse: _*)
(new xsbt.boot.ConfigurationParser).getRepositories(listMap)
}
if (debug) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SimpleBuildActor(extractor: ActorRef, builder: ActorRef, repository: Repos
t.afterBuild(rdb, buildOutcome)
(t.id, true)
} catch {
case e =>
case e:Throwable =>
(t.id, false)
}
}
Expand All @@ -85,7 +85,7 @@ class SimpleBuildActor(extractor: ActorRef, builder: ActorRef, repository: Repos
notifTask.afterBuild(rdb, outcomeForNotif)
(notifTask.id, true)
} catch {
case e =>
case e:Throwable =>
(notifTask.id, false)
})
}
Expand Down Expand Up @@ -149,7 +149,7 @@ class SimpleBuildActor(extractor: ActorRef, builder: ActorRef, repository: Repos
def nest[K](f: => K)(g: K => Future[BuildOutcome]): Future[BuildOutcome] = (try {
Left(f)
} catch {
case e =>
case e:Throwable =>
val outcome = Future(ExtractionFailed(".", extractionOutcome.outcomes, "Cause: " + prepareLogMsg(log, e)))
afterTasks(None, outcome)
Right(outcome)
Expand Down Expand Up @@ -183,7 +183,7 @@ class SimpleBuildActor(extractor: ActorRef, builder: ActorRef, repository: Repos
}
}
} catch {
case e =>
case e:Throwable =>
Future(UnexpectedOutcome(".", Seq.empty, "Cause: " + prepareLogMsg(log, e)))
}
result pipeTo listener
Expand All @@ -193,13 +193,13 @@ class SimpleBuildActor(extractor: ActorRef, builder: ActorRef, repository: Repos
final def wrapExceptionIntoOutcomeF[A <: BuildOutcome](log: Logger)(f: A => Future[BuildOutcome])(a: A): Future[BuildOutcome] = {
implicit val ctx = context.system
try f(a) catch {
case e =>
case e:Throwable =>
Future(UnexpectedOutcome(".", a.outcomes, "Cause: " + prepareLogMsg(log, e)))
}
}
final def wrapExceptionIntoOutcome[A <: BuildOutcome](log: Logger)(f: A => BuildOutcome)(a: A): BuildOutcome = {
try f(a) catch {
case e =>
case e:Throwable =>
UnexpectedOutcome(".", a.outcomes, "Cause: " + prepareLogMsg(log, e))
}
}
Expand Down
Loading

0 comments on commit ee1eaff

Please sign in to comment.