From abb97eb5acea743caba7000f722ba73dba9142ae Mon Sep 17 00:00:00 2001 From: "Kai(luo) Wang" Date: Wed, 3 Apr 2019 07:54:47 -0400 Subject: [PATCH] replace sbt-travis with in house code since it no longer parse our travis file using a different scala setting (#2771) --- build.sbt | 24 +++++++++++++++++++++++- project/build.sbt | 1 + project/plugins.sbt | 1 - 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 project/build.sbt diff --git a/build.sbt b/build.sbt index c11b302d9c..af2183424c 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,9 @@ +import java.time.LocalDateTime + import microsites._ import ReleaseTransformations._ +import sbt.io.Using + import scala.xml.transform.{RewriteRule, RuleTransformer} import sbtcrossproject.CrossProject import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} @@ -18,7 +22,24 @@ lazy val scoverageSettings = Seq( organization in ThisBuild := "org.typelevel" +val isTravisBuild = settingKey[Boolean]("Flag indicating whether the current build is running under Travis") +val crossScalaVersionsFromTravis = settingKey[Seq[String]]("Scala versions set in .travis.yml as scala_version_XXX") +isTravisBuild in Global := sys.env.get("TRAVIS").isDefined + +crossScalaVersionsFromTravis in Global := { + val manifest = (baseDirectory in ThisBuild).value / ".travis.yml" + import collection.JavaConverters._ + Using.fileInputStream(manifest) { fis => + List(new org.yaml.snakeyaml.Yaml().load(fis)) + .collect { case map: java.util.Map[_, _] => map.asScala.toList } + .flatMap(_.collect { + case (k: String, v: String) if k.contains("scala_version_") => v + }) + } +} + lazy val commonSettings = Seq( + crossScalaVersions := (crossScalaVersionsFromTravis in Global).value, scalacOptions ++= commonScalacOptions(scalaVersion.value), Compile / unmanagedSourceDirectories ++= { val bd = baseDirectory.value @@ -610,6 +631,7 @@ lazy val binCompatTest = project .disablePlugins(CoursierPlugin) .settings(noPublishSettings) .settings( + crossScalaVersions := (crossScalaVersionsFromTravis in Global).value, addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.9"), libraryDependencies ++= List( { @@ -743,7 +765,7 @@ addCommandAlias("validateKernelJS", "kernelLawsJS/test") addCommandAlias("validateFreeJS", "freeJS/test") //separated due to memory constraint on travis addCommandAlias("validate", ";clean;validateJS;validateKernelJS;validateFreeJS;validateJVM") -addCommandAlias("prePR", ";fmt;++2.11.12;validateBC") +addCommandAlias("prePR", ";fmt;++2.11.12 mimaReportBinaryIssues") //////////////////////////////////////////////////////////////////////////////////////////////////// // Base Build Settings - Should not need to edit below this line. diff --git a/project/build.sbt b/project/build.sbt new file mode 100644 index 0000000000..11c22d8f31 --- /dev/null +++ b/project/build.sbt @@ -0,0 +1 @@ +libraryDependencies += "org.yaml" % "snakeyaml" % "1.24" diff --git a/project/plugins.sbt b/project/plugins.sbt index 3db75ca02d..8547996e97 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -10,7 +10,6 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0") addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.8.0") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.0") addSbtPlugin("com.47deg" % "sbt-microsites" % "0.7.20") -addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.2.0") addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.2") addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.10") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")