Merge pull request #114 from eed3si9n/wip/sbt_bump

Bump to sbt 1.0.0-M6
This commit is contained in:
eugene yokota 2017-06-17 02:32:50 -04:00 committed by GitHub
commit 0bb1aa7120
8 changed files with 32 additions and 95 deletions

View File

@ -5,7 +5,7 @@ scala:
- 2.12.1 - 2.12.1
script: script:
- sbt -Dfile.encoding=UTF8 -J-XX:ReservedCodeCacheSize=256M ";++$TRAVIS_SCALA_VERSION test;scalafmtCheck" - sbt -Dfile.encoding=UTF8 -J-XX:ReservedCodeCacheSize=256M ";++$TRAVIS_SCALA_VERSION test;scalafmt::test;test:scalafmt::test"
jdk: jdk:
- oraclejdk8 - oraclejdk8

View File

@ -1,5 +1,7 @@
import Dependencies._ import Dependencies._
import com.typesafe.tools.mima.core._, ProblemFilters._ import Path._
// import com.typesafe.tools.mima.core._, ProblemFilters._
def baseVersion = "1.0.0" def baseVersion = "1.0.0"
@ -12,26 +14,24 @@ def commonSettings: Seq[Setting[_]] = Seq(
// concurrentRestrictions in Global += Util.testExclusiveRestriction, // concurrentRestrictions in Global += Util.testExclusiveRestriction,
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"), javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"),
incOptions := incOptions.value.withNameHashing(true),
crossScalaVersions := Seq(scala211, scala212), crossScalaVersions := Seq(scala211, scala212),
resolvers += Resolver.sonatypeRepo("public"), resolvers += Resolver.sonatypeRepo("public"),
scalacOptions += "-Ywarn-unused", scalacOptions := {
mimaPreviousArtifacts := Set(), // Some(organization.value %% moduleName.value % "1.0.0"), val old = scalacOptions.value
scalaVersion.value match {
case sv if sv.startsWith("2.10") => old diff List("-Xfuture", "-Ywarn-unused", "-Ywarn-unused-import")
case sv if sv.startsWith("2.11") => old ++ List("-Ywarn-unused", "-Ywarn-unused-import")
case _ => old ++ List("-Ywarn-unused", "-Ywarn-unused-import", "-YdisableFlatCpCaching")
}
},
// mimaPreviousArtifacts := Set(), // Some(organization.value %% moduleName.value % "1.0.0"),
publishArtifact in Compile := true, publishArtifact in Compile := true,
publishArtifact in Test := false, publishArtifact in Test := false,
parallelExecution in Test := false, parallelExecution in Test := false
commands += Command.command("scalafmtCheck") { state =>
sys.process.Process("git diff --name-only --exit-code").! match {
case 0 => // ok
case x => sys.error("git diff detected! Did you compile before committing?")
}
state
}
) )
lazy val lmRoot = (project in file(".")) lazy val lmRoot = (project in file("."))
.aggregate(lm) .aggregate(lm)
.disablePlugins(com.typesafe.sbt.SbtScalariform)
.settings( .settings(
inThisBuild( inThisBuild(
Seq( Seq(
@ -40,6 +40,9 @@ lazy val lmRoot = (project in file("."))
scmInfo := Some(ScmInfo(url("https://github.com/sbt/librarymanagement"), scmInfo := Some(ScmInfo(url("https://github.com/sbt/librarymanagement"),
"git@github.com:sbt/librarymanagement.git")), "git@github.com:sbt/librarymanagement.git")),
bintrayPackage := "librarymanagement", bintrayPackage := "librarymanagement",
scalafmtOnCompile := true,
// scalafmtVersion 1.0.0-RC3 has regression
scalafmtVersion := "0.6.8",
git.baseVersion := baseVersion git.baseVersion := baseVersion
)), )),
commonSettings, commonSettings,
@ -52,7 +55,6 @@ lazy val lmRoot = (project in file("."))
) )
lazy val lm = (project in file("librarymanagement")) lazy val lm = (project in file("librarymanagement"))
.disablePlugins(com.typesafe.sbt.SbtScalariform)
.settings( .settings(
commonSettings, commonSettings,
name := "librarymanagement", name := "librarymanagement",
@ -71,7 +73,7 @@ lazy val lm = (project in file("librarymanagement"))
streams.value, streams.value,
(compile in Compile).value)) (compile in Compile).value))
.taskValue, .taskValue,
mimaBinaryIssueFilters ++= Seq(), // mimaBinaryIssueFilters ++= Seq(),
contrabandFormatsForType in generateContrabands in Compile := DatatypeConfig.getFormats, contrabandFormatsForType in generateContrabands in Compile := DatatypeConfig.getFormats,
// WORKAROUND sbt/sbt#2205 include managed sources in packageSrc // WORKAROUND sbt/sbt#2205 include managed sources in packageSrc
mappings in (Compile, packageSrc) ++= { mappings in (Compile, packageSrc) ++= {

View File

@ -3,4 +3,4 @@ package sbt.internal.librarymanagement
private[sbt] object IvyUtil { private[sbt] object IvyUtil {
def separate[A, B](l: Seq[Either[A, B]]): (Seq[A], Seq[B]) = def separate[A, B](l: Seq[Either[A, B]]): (Seq[A], Seq[B]) =
(l.flatMap(_.left.toOption), l.flatMap(_.right.toOption)) (l.flatMap(_.left.toOption), l.flatMap(_.right.toOption))
} }

View File

@ -1,66 +0,0 @@
import org.scalafmt.bootstrap.ScalafmtBootstrap
import org.scalafmt.sbt.ScalafmtPlugin
import sbt._
import sbt.Keys._
import sbt.inc.Analysis
// Taken from https://github.com/akka/alpakka/blob/master/project/AutomateScalafmtPlugin.scala
object AutomateScalafmtPlugin extends AutoPlugin {
object autoImport {
def automateScalafmtFor(configurations: Configuration*): Seq[Setting[_]] =
configurations.flatMap { c =>
inConfig(c)(
Seq(
compileInputs.in(compile) := {
scalafmtInc.value
compileInputs.in(compile).value
},
sourceDirectories.in(scalafmtInc) := Seq(scalaSource.value),
scalafmtInc := {
val cache = streams.value.cacheDirectory / "scalafmt"
val include = includeFilter.in(scalafmtInc).value
val exclude = excludeFilter.in(scalafmtInc).value
val sources =
sourceDirectories
.in(scalafmtInc)
.value
.descendantsExcept(include, exclude)
.get
.toSet
def format(handler: Set[File] => Unit, msg: String) = {
def update(handler: Set[File] => Unit, msg: String)(in: ChangeReport[File],
out: ChangeReport[File]) = {
val label = Reference.display(thisProjectRef.value)
val files = in.modified -- in.removed
Analysis
.counted("Scala source", "", "s", files.size)
.foreach(count => streams.value.log.info(s"$msg $count in $label ..."))
handler(files)
files
}
FileFunction.cached(cache)(FilesInfo.hash, FilesInfo.exists)(update(handler, msg))(
sources
)
}
def formattingHandler(files: Set[File]) =
if (files.nonEmpty) {
val filesArg = files.map(_.getAbsolutePath).mkString(",")
ScalafmtBootstrap.main(List("--quiet", "-i", "-f", filesArg))
}
format(formattingHandler, "Formatting")
format(_ => (), "Reformatted") // Recalculate the cache
}
)
)
}
}
private val scalafmtInc = taskKey[Unit]("Incrementally format modified sources")
override def requires = ScalafmtPlugin
override def trigger = allRequirements
override def projectSettings =
(includeFilter.in(scalafmtInc) := "*.scala") +: autoImport.automateScalafmtFor(Compile, Test)
}

View File

@ -2,8 +2,8 @@ import sbt._
import Keys._ import Keys._
object Dependencies { object Dependencies {
val scala211 = "2.11.8" val scala211 = "2.11.11"
val scala212 = "2.12.1" val scala212 = "2.12.2"
private val ioVersion = "1.0.0-M11" private val ioVersion = "1.0.0-M11"
private val utilVersion = "1.0.0-M23" private val utilVersion = "1.0.0-M23"
@ -34,7 +34,7 @@ object Dependencies {
c: Option[Configuration] = None) = c: Option[Configuration] = None) =
path match { path match {
case Some(f) => 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) % _) ProjectRef(file(f), projectName) % _)
case None => p settings (libraryDependencies += c.fold(m)(m % _)) case None => p settings (libraryDependencies += c.fold(m)(m % _))
} }

View File

@ -3,21 +3,23 @@ import Keys._
import sbt.IO import sbt.IO
import java.io.File import java.io.File
import xsbti.compile.CompileAnalysis
object Util { object Util {
def versionLine(version: String): String = "version=" + version def versionLine(version: String): String = "version=" + version
def containsVersion(propFile: File, version: String): Boolean = def containsVersion(propFile: File, version: String): Boolean =
IO.read(propFile).contains(versionLine(version)) IO.read(propFile).contains(versionLine(version))
def lastCompilationTime(analysis: sbt.inc.Analysis): Long = { def lastCompilationTime(analysis0: CompileAnalysis): Long = {
val analysis = analysis0 match { case a: sbt.internal.inc.Analysis => a }
val lastCompilation = analysis.compilations.allCompilations.lastOption val lastCompilation = analysis.compilations.allCompilations.lastOption
lastCompilation.map(_.startTime) getOrElse 0L lastCompilation.map(_.getStartTime) getOrElse 0L
} }
def generateVersionFile(version: String, def generateVersionFile(version: String,
dir: File, dir: File,
s: TaskStreams, s: TaskStreams,
analysis: sbt.inc.Analysis): Seq[File] = { analysis: CompileAnalysis): Seq[File] = {
import java.util.{ Date, TimeZone } import java.util.{ Date, TimeZone }
val formatter = new java.text.SimpleDateFormat("yyyyMMdd'T'HHmmss") val formatter = new java.text.SimpleDateFormat("yyyyMMdd'T'HHmmss")
formatter.setTimeZone(TimeZone.getTimeZone("GMT")) formatter.setTimeZone(TimeZone.getTimeZone("GMT"))

View File

@ -1 +1 @@
sbt.version=0.13.15 sbt.version=1.0.0-M6

View File

@ -1,7 +1,6 @@
addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.2") addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.3")
addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.3") addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M5")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.3.0-M4") addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.4.0")
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0") addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.3")
addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.6.8")
scalacOptions += "-language:postfixOps" scalacOptions += "-language:postfixOps"