From b6324a4c14952771b966854037cd3a81b6e5f985 Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 1 May 2018 11:23:11 +0200 Subject: [PATCH] Upgrade to sbt 0.13.17 Published using: ``` sbt 'set version := "2.1.0"' \ 'set pgpSigningKey := Some(new java.math.BigInteger("C03EF1D7D692BCFF", 16).longValue)' \ "set pgpPassphrase := Some(Array.empty)" \ 'set useGpg := true' \ publishSigned ``` and ditto for `sbt 'set version := "2.1.1"' ...`. --- build.sbt | 127 ++++++++++++++++++++++++++++++++ project/build.properties | 2 +- project/build.scala | 155 --------------------------------------- project/plugins.sbt | 2 +- 4 files changed, 129 insertions(+), 157 deletions(-) create mode 100644 build.sbt delete mode 100644 project/build.scala diff --git a/build.sbt b/build.sbt new file mode 100644 index 00000000..515eff1e --- /dev/null +++ b/build.sbt @@ -0,0 +1,127 @@ +lazy val sharedSettings = Seq( + scalaVersion := "2.12.6", + scalaHome := Option(System.getProperty("paradise.scala.home")).map(file(_)), + scalacOptions ++= Seq("-deprecation", "-feature"), + + version := "2.1.0-SNAPSHOT", + crossVersion := CrossVersion.full, + organization := "org.scalamacros", + description := "Empowers production Scala compiler with latest macro developments", + + resolvers += Resolver.sonatypeRepo("snapshots"), + resolvers += Resolver.sonatypeRepo("releases"), + resolvers += "Sonatype staging" at "https://oss.sonatype.org/content/repositories/staging/", + + parallelExecution in Test := false, // hello, reflection sync!! + logBuffered := false +) + +def sonaCredentials: Option[Credentials] = + for { + sonaUser <- Option(System.getenv("SONA_USER")) + sonaPass <- Option(System.getenv("SONA_PASS")) + } yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org",sonaUser, sonaPass) + +lazy val plugin = Project( + id = "paradise", + base = file("plugin") +) settings ( + sharedSettings : _* +) settings ( + resourceDirectory in Compile := baseDirectory.value / "src" / "main" / "scala" / "org" / "scalamacros" / "paradise" / "embedded", + + libraryDependencies += "org.scala-lang" % "scala-library" % scalaVersion.value, + libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value, + libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value, + + publishMavenStyle := true, + publishArtifact in Test := false, + + publishTo := Some { + val nexus = "https://oss.sonatype.org/" + if (version.value.trim.endsWith("SNAPSHOT")) "snapshots" at nexus + "content/repositories/snapshots" + else "releases" at nexus + "service/local/staging/deploy/maven2" + }, + + credentials ++= sonaCredentials.toSeq, + pomIncludeRepository := { x => false }, + pomExtra := ( + https://github.com/scalamacros/paradise + 2012 + + + BSD-like + http://www.scala-lang.org/downloads/license.html + repo + + + + git://github.com/scalamacros/paradise.git + scm:git:git://github.com/scalamacros/paradise.git + + + GitHub + https://github.com/scalamacros/paradise/issues + + + + xeno-by + Eugene Burmako + http://xeno.by + + + ) +) + +lazy val usePluginSettings = Seq( + scalacOptions in Compile ++= { + val jar = (Keys.`package` in (plugin, Compile)).value + System.setProperty("sbt.paths.plugin.jar", jar.getAbsolutePath) + + val addPlugin = "-Xplugin:" + jar.getAbsolutePath + // Thanks Jason for this cool idea (taken from https://github.com/retronym/boxer) + // add plugin timestamp to compiler options to trigger recompile of + // main after editing the plugin. (Otherwise a 'clean' is needed.) + val dummy = "-Jdummy=" + jar.lastModified + Seq(addPlugin, dummy) + } +) + +lazy val sandbox = Project( + id = "sandbox", + base = file("sandbox") +) settings ( + sharedSettings ++ usePluginSettings: _* +) settings ( + libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value, + publishArtifact in Compile := false +) + +lazy val tests = Project( + id = "tests", + base = file("tests") +) settings ( + sharedSettings ++ usePluginSettings: _* +) settings ( + libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value, + libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value, + libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test", + + scalacOptions += "-Ywarn-unused-import", + scalacOptions += "-Xfatal-warnings", + + publishArtifact in Compile := false, + + unmanagedSourceDirectories in Test := { + // TODO: I haven't yet ported negative tests to SBT, so for now I'm excluding them + val (anns :: Nil, others) = (scalaSource in Test).value.listFiles.toList.partition(_.getName == "annotations") + val (negAnns, otherAnns) = anns.listFiles.toList.partition(_.getName == "neg") + System.setProperty("sbt.paths.tests.scaladoc", anns.listFiles.toList.filter(_.getName == "scaladoc").head.getAbsolutePath) + otherAnns ++ others + }, + fullClasspath in Test := { + val testcp = (fullClasspath in Test).value.files.map(_.getAbsolutePath).mkString(java.io.File.pathSeparatorChar.toString) + sys.props("sbt.paths.tests.classpath") = testcp + (fullClasspath in Test).value + } +) diff --git a/project/build.properties b/project/build.properties index a6e117b6..133a8f19 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.8 +sbt.version=0.13.17 diff --git a/project/build.scala b/project/build.scala deleted file mode 100644 index df43acac..00000000 --- a/project/build.scala +++ /dev/null @@ -1,155 +0,0 @@ -import sbt._ -import Keys._ - -object build extends Build { - lazy val sharedSettings = Defaults.defaultSettings ++ Seq( - scalaVersion := "2.12.6", - crossVersion := CrossVersion.full, - version := "2.1.0-SNAPSHOT", - organization := "org.scalamacros", - description := "Empowers production Scala compiler with latest macro developments", - resolvers += Resolver.sonatypeRepo("snapshots"), - resolvers += Resolver.sonatypeRepo("releases"), - resolvers += "Sonatype staging" at "https://oss.sonatype.org/content/repositories/staging/", - publishMavenStyle := true, - publishArtifact in Test := false, - scalacOptions ++= Seq("-deprecation", "-feature"), - parallelExecution in Test := false, // hello, reflection sync!! - logBuffered := false, - scalaHome := { - val scalaHome = System.getProperty("paradise.scala.home") - if (scalaHome != null) { - println(s"Going for custom scala home at $scalaHome") - Some(file(scalaHome)) - } else None - } - ) - - def loadCredentials(): List[Credentials] = { - val mavenSettingsFile = System.getProperty("maven.settings.file") - if (mavenSettingsFile != null) { - println("Loading Sonatype credentials from " + mavenSettingsFile) - try { - import scala.xml._ - val settings = XML.loadFile(mavenSettingsFile) - def readServerConfig(key: String) = (settings \\ "settings" \\ "servers" \\ "server" \\ key).head.text - List(Credentials( - "Sonatype Nexus Repository Manager", - "oss.sonatype.org", - readServerConfig("username"), - readServerConfig("password") - )) - } catch { - case ex: Exception => - println("Failed to load Maven settings from " + mavenSettingsFile + ": " + ex) - Nil - } - } else { - // println("Sonatype credentials cannot be loaded: -Dmaven.settings.file is not specified.") - Nil - } - } - - lazy val plugin = Project( - id = "paradise", - base = file("plugin") - ) settings ( - sharedSettings : _* - ) settings ( - resourceDirectory in Compile <<= baseDirectory(_ / "src" / "main" / "scala" / "org" / "scalamacros" / "paradise" / "embedded"), - libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-library" % _), - libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _), - libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-compiler" % _), - // TODO: how to I make this recursion work? - // run <<= run in Compile in sandbox, - // test <<= test in Test in tests - publishMavenStyle := true, - publishArtifact in Test := false, - publishTo <<= version { v: String => - val nexus = "https://oss.sonatype.org/" - if (v.trim.endsWith("SNAPSHOT")) - Some("snapshots" at nexus + "content/repositories/snapshots") - else - Some("releases" at nexus + "service/local/staging/deploy/maven2") - }, - pomIncludeRepository := { x => false }, - pomExtra := ( - https://github.com/scalamacros/paradise - 2012 - - - BSD-like - http://www.scala-lang.org/downloads/license.html - repo - - - - git://github.com/scalamacros/paradise.git - scm:git:git://github.com/scalamacros/paradise.git - - - GitHub - https://github.com/scalamacros/paradise/issues - - - - xeno-by - Eugene Burmako - http://xeno.by - - - ), - credentials ++= loadCredentials() - ) - - lazy val usePluginSettings = Seq( - scalacOptions in Compile <++= (Keys.`package` in (plugin, Compile)) map { (jar: File) => - System.setProperty("sbt.paths.plugin.jar", jar.getAbsolutePath) - val addPlugin = "-Xplugin:" + jar.getAbsolutePath - // Thanks Jason for this cool idea (taken from https://github.com/retronym/boxer) - // add plugin timestamp to compiler options to trigger recompile of - // main after editing the plugin. (Otherwise a 'clean' is needed.) - val dummy = "-Jdummy=" + jar.lastModified - Seq(addPlugin, dummy) - } - ) - - lazy val sandbox = Project( - id = "sandbox", - base = file("sandbox") - ) settings ( - sharedSettings ++ usePluginSettings: _* - ) settings ( - libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _), - publishArtifact in Compile := false - ) - - lazy val tests = Project( - id = "tests", - base = file("tests") - ) settings ( - sharedSettings ++ usePluginSettings: _* - ) settings ( - libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-reflect" % _), - libraryDependencies <+= (scalaVersion)("org.scala-lang" % "scala-compiler" % _), - libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test", - scalacOptions += "-Ywarn-unused-import", - scalacOptions += "-Xfatal-warnings", - publishArtifact in Compile := false, - unmanagedSourceDirectories in Test <<= (scalaSource in Test) { (root: File) => - // TODO: I haven't yet ported negative tests to SBT, so for now I'm excluding them - val (anns :: Nil, others) = root.listFiles.toList.partition(_.getName == "annotations") - val (negAnns, otherAnns) = anns.listFiles.toList.partition(_.getName == "neg") - System.setProperty("sbt.paths.tests.scaladoc", anns.listFiles.toList.filter(_.getName == "scaladoc").head.getAbsolutePath) - otherAnns ++ others - }, - fullClasspath in Test := { - val testcp = (fullClasspath in Test).value.files.map(_.getAbsolutePath).mkString(java.io.File.pathSeparatorChar.toString) - sys.props("sbt.paths.tests.classpath") = testcp - (fullClasspath in Test).value - }, - scalacOptions ++= Seq() - // scalacOptions ++= Seq("-Xprint:typer") - // scalacOptions ++= Seq("-Xlog-implicits") - ) -} diff --git a/project/plugins.sbt b/project/plugins.sbt index 9cf23fb8..2efcc4b6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")