From 6f5a42d4501d7a63aba14f7b5c5083ec7bb5fb5e Mon Sep 17 00:00:00 2001 From: Oscar Boykin Date: Mon, 1 Feb 2016 14:47:41 -1000 Subject: [PATCH] Update the build --- build.sbt | 202 ++++++++++++++++++++++++++++++++++++++++++++ project/Build.scala | 188 ----------------------------------------- project/plugins.sbt | 15 ++-- sbt | 2 +- 4 files changed, 209 insertions(+), 198 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 000000000..34723fef3 --- /dev/null +++ b/build.sbt @@ -0,0 +1,202 @@ +import ReleaseTransformations._ +import algebird._ +import com.typesafe.sbt.SbtScalariform._ +import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact +import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings +import pl.project13.scala.sbt.JmhPlugin +import scalariform.formatter.preferences._ + +val paradiseVersion = "2.0.1" +val quasiquotesVersion = "2.0.1" +val bijectionVersion = "0.9.0" +val utilVersion = "6.20.0" + +def scalaBinaryVersion(scalaVersion: String) = scalaVersion match { + case version if version startsWith "2.10" => "2.10" + case version if version startsWith "2.11" => "2.11" + case version if version startsWith "2.12" => "2.12" + case _ => sys.error("unknown error") +} + +def isScala210x(scalaVersion: String) = scalaBinaryVersion(scalaVersion) == "2.10" + +val sharedSettings = Project.defaultSettings ++ scalariformSettings ++ Seq( + organization := "com.twitter", + scalaVersion := "2.10.5", + crossScalaVersions := Seq("2.10.5", "2.11.7"), + ScalariformKeys.preferences := formattingPreferences, + + resolvers ++= Seq( + "snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", + "releases" at "http://oss.sonatype.org/content/repositories/releases" + ), + + parallelExecution in Test := true, + + javacOptions ++= Seq("-target", "1.6", "-source", "1.6"), + + scalacOptions ++= Seq("-unchecked", "-deprecation", "-optimize", "-Xlint", "-language:implicitConversions", "-language:higherKinds", "-language:existentials"), + + scalacOptions <++= (scalaVersion) map { sv => + if (sv startsWith "2.10") + Seq("-Xdivergence211") + else + Seq() + }, + + javacOptions ++= Seq("-target", "1.6", "-source", "1.6"), + + libraryDependencies += "junit" % "junit" % "4.11" % "test", + + // Publishing options: + releaseCrossBuild := true, + releasePublishArtifactsAction := PgpKeys.publishSigned.value, + releaseVersionBump := sbtrelease.Version.Bump.Minor, // need to tweak based on mima results + publishMavenStyle := true, + publishArtifact in Test := false, + pomIncludeRepository := { x => false }, + + releaseProcess := Seq[ReleaseStep]( + checkSnapshotDependencies, + inquireVersions, + runClean, + runTest, + setReleaseVersion, + commitReleaseVersion, + tagRelease, + publishArtifacts, + setNextVersion, + commitNextVersion, + ReleaseStep(action = Command.process("sonatypeReleaseAll", _)), + pushChanges), + + + publishTo <<= version { v => + Some( + if (v.trim.endsWith("SNAPSHOT")) + Opts.resolver.sonatypeSnapshots + else + Opts.resolver.sonatypeStaging + ) + }, + + pomExtra := ( + https://github.com/twitter/algebird + + + Apache 2 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + A business-friendly OSS license + + + + git@github.com:twitter/algebird.git + scm:git:git@github.com:twitter/algebird.git + + + + oscar + Oscar Boykin + http://twitter.com/posco + + + sritchie + Sam Ritchie + http://twitter.com/sritchie + + ) +) ++ mimaDefaultSettings + + +lazy val formattingPreferences = { + import scalariform.formatter.preferences._ + FormattingPreferences(). + setPreference(AlignParameters, false). + setPreference(PreserveSpaceBeforeArguments, true) +} + +/** + * This returns the youngest jar we released that is compatible with + * the current. + */ +val unreleasedModules = Set[String]() + +def youngestForwardCompatible(subProj: String) = + Some(subProj) + .filterNot(unreleasedModules.contains(_)) + .map { s => "com.twitter" % ("algebird-" + s + "_2.10") % "0.11.0" } + +lazy val algebird = Project( + id = "algebird", + base = file("."), + settings = sharedSettings ++ DocGen.publishSettings + ).settings( + test := { }, + publish := { }, // skip publishing for this root project. + publishLocal := { } +).aggregate( + algebirdTest, + algebirdCore, + algebirdUtil, + algebirdBijection, + algebirdBenchmark, + algebirdSpark +) + +def module(name: String) = { + val id = "algebird-%s".format(name) + Project(id = id, base = file(id), settings = sharedSettings ++ Seq( + Keys.name := id, + previousArtifact := youngestForwardCompatible(name)) + ) +} + +lazy val algebirdCore = module("core").settings( + test := { }, // All tests reside in algebirdTest + initialCommands := """ + import com.twitter.algebird._ + """.stripMargin('|'), + libraryDependencies <++= (scalaVersion) { scalaVersion => + Seq("com.googlecode.javaewah" % "JavaEWAH" % "0.6.6", + "org.scala-lang" % "scala-reflect" % scalaVersion) ++ { + if (isScala210x(scalaVersion)) + Seq("org.scalamacros" %% "quasiquotes" % quasiquotesVersion) + else + Seq() + } + }, + sourceGenerators in Compile <+= sourceManaged in Compile map { outDir: File => + GenTupleAggregators.gen(outDir) + }, addCompilerPlugin("org.scalamacros" % "paradise" % paradiseVersion cross CrossVersion.full) +) + +lazy val algebirdTest = module("test").settings( + testOptions in Test ++= Seq(Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "4")), + libraryDependencies <++= (scalaVersion) { scalaVersion => + Seq("org.scalacheck" %% "scalacheck" % "1.12.5", + "org.scalatest" %% "scalatest" % "2.2.4") ++ { + if (isScala210x(scalaVersion)) + Seq("org.scalamacros" %% "quasiquotes" % quasiquotesVersion) + else + Seq() + } + }, addCompilerPlugin("org.scalamacros" % "paradise" % paradiseVersion cross CrossVersion.full) +).dependsOn(algebirdCore) + +lazy val algebirdBenchmark = module("benchmark").settings(JmhPlugin.projectSettings:_*).settings( + libraryDependencies ++= Seq("com.twitter" %% "bijection-core" % bijectionVersion) +).dependsOn(algebirdCore, algebirdUtil, algebirdTest % "test->compile").enablePlugins(JmhPlugin) + +lazy val algebirdUtil = module("util").settings( + libraryDependencies += "com.twitter" %% "util-core" % utilVersion +).dependsOn(algebirdCore, algebirdTest % "test->test") + +lazy val algebirdBijection = module("bijection").settings( + libraryDependencies += "com.twitter" %% "bijection-core" % bijectionVersion +).dependsOn(algebirdCore, algebirdTest % "test->test") + +lazy val algebirdSpark = module("spark").settings( + libraryDependencies += "org.apache.spark" %% "spark-core" % "1.3.0" % "provided" +).dependsOn(algebirdCore, algebirdTest % "test->test") + diff --git a/project/Build.scala b/project/Build.scala deleted file mode 100644 index 2c09c362b..000000000 --- a/project/Build.scala +++ /dev/null @@ -1,188 +0,0 @@ -package algebird - -import sbt._ -import Keys._ -import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings -import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact -import scalariform.formatter.preferences._ -import com.typesafe.sbt.SbtScalariform._ -import pl.project13.scala.sbt.JmhPlugin - -object AlgebirdBuild extends Build { - - val paradiseVersion = "2.0.1" - val quasiquotesVersion = "2.0.1" - - def scalaBinaryVersion(scalaVersion: String) = scalaVersion match { - case version if version startsWith "2.10" => "2.10" - case version if version startsWith "2.11" => "2.11" - case _ => sys.error("unknown error") - } - def isScala210x(scalaVersion: String) = scalaBinaryVersion(scalaVersion) == "2.10" - - val sharedSettings = Project.defaultSettings ++ scalariformSettings ++ Seq( - organization := "com.twitter", - scalaVersion := "2.10.5", - crossScalaVersions := Seq("2.10.5", "2.11.7"), - ScalariformKeys.preferences := formattingPreferences, - - resolvers ++= Seq( - "snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", - "releases" at "http://oss.sonatype.org/content/repositories/releases" - ), - - parallelExecution in Test := true, - - javacOptions ++= Seq("-target", "1.6", "-source", "1.6"), - - scalacOptions ++= Seq("-unchecked", "-deprecation", "-optimize", "-Xlint", "-language:implicitConversions", "-language:higherKinds", "-language:existentials"), - - scalacOptions <++= (scalaVersion) map { sv => - if (sv startsWith "2.10") - Seq("-Xdivergence211") - else - Seq() - }, - - javacOptions ++= Seq("-target", "1.6", "-source", "1.6"), - - libraryDependencies += "junit" % "junit" % "4.11" % "test", - - // Publishing options: - publishMavenStyle := true, - - publishArtifact in Test := false, - - pomIncludeRepository := { x => false }, - - publishTo <<= version { v => - Some( - if (v.trim.endsWith("SNAPSHOT")) - Opts.resolver.sonatypeSnapshots - else - Opts.resolver.sonatypeStaging - ) - }, - - pomExtra := ( - https://github.com/twitter/algebird - - - Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - A business-friendly OSS license - - - - git@github.com:twitter/algebird.git - scm:git:git@github.com:twitter/algebird.git - - - - oscar - Oscar Boykin - http://twitter.com/posco - - - sritchie - Sam Ritchie - http://twitter.com/sritchie - - ) - ) ++ mimaDefaultSettings - - - lazy val formattingPreferences = { - import scalariform.formatter.preferences._ - FormattingPreferences(). - setPreference(AlignParameters, false). - setPreference(PreserveSpaceBeforeArguments, true) - } - - /** - * This returns the youngest jar we released that is compatible with - * the current. - */ - val unreleasedModules = Set[String]() - - def youngestForwardCompatible(subProj: String) = - Some(subProj) - .filterNot(unreleasedModules.contains(_)) - .map { s => "com.twitter" % ("algebird-" + s + "_2.10") % "0.11.0" } - - lazy val algebird = Project( - id = "algebird", - base = file("."), - settings = sharedSettings ++ DocGen.publishSettings - ).settings( - test := { }, - publish := { }, // skip publishing for this root project. - publishLocal := { } - ).aggregate( - algebirdTest, - algebirdCore, - algebirdUtil, - algebirdBijection, - algebirdBenchmark, - algebirdSpark - ) - - def module(name: String) = { - val id = "algebird-%s".format(name) - Project(id = id, base = file(id), settings = sharedSettings ++ Seq( - Keys.name := id, - previousArtifact := youngestForwardCompatible(name)) - ) - } - - lazy val algebirdCore = module("core").settings( - test := { }, // All tests reside in algebirdTest - initialCommands := """ - import com.twitter.algebird._ - """.stripMargin('|'), - libraryDependencies <++= (scalaVersion) { scalaVersion => - Seq("com.googlecode.javaewah" % "JavaEWAH" % "0.6.6", - "org.scala-lang" % "scala-reflect" % scalaVersion) ++ { - if (isScala210x(scalaVersion)) - Seq("org.scalamacros" %% "quasiquotes" % quasiquotesVersion) - else - Seq() - } - }, - sourceGenerators in Compile <+= sourceManaged in Compile map { outDir: File => - GenTupleAggregators.gen(outDir) - }, addCompilerPlugin("org.scalamacros" % "paradise" % paradiseVersion cross CrossVersion.full) - ) - - lazy val algebirdTest = module("test").settings( - testOptions in Test ++= Seq(Tests.Argument(TestFrameworks.ScalaCheck, "-verbosity", "4")), - libraryDependencies <++= (scalaVersion) { scalaVersion => - Seq("org.scalacheck" %% "scalacheck" % "1.12.5", - "org.scalatest" %% "scalatest" % "2.2.4") ++ { - if (isScala210x(scalaVersion)) - Seq("org.scalamacros" %% "quasiquotes" % quasiquotesVersion) - else - Seq() - } - }, addCompilerPlugin("org.scalamacros" % "paradise" % paradiseVersion cross CrossVersion.full) - ).dependsOn(algebirdCore) - - lazy val algebirdBenchmark = module("benchmark").settings(JmhPlugin.projectSettings:_*).settings( - libraryDependencies ++= Seq("com.twitter" %% "bijection-core" % "0.8.0") - ).dependsOn(algebirdCore, algebirdUtil, algebirdTest % "test->compile").enablePlugins(JmhPlugin) - - lazy val algebirdUtil = module("util").settings( - libraryDependencies += "com.twitter" %% "util-core" % "6.20.0" - ).dependsOn(algebirdCore, algebirdTest % "test->test") - - lazy val algebirdBijection = module("bijection").settings( - libraryDependencies += "com.twitter" %% "bijection-core" % "0.8.0" - ).dependsOn(algebirdCore, algebirdTest % "test->test") - - lazy val algebirdSpark = module("spark").settings( - libraryDependencies += "org.apache.spark" %% "spark-core" % "1.3.0" % "provided" - ).dependsOn(algebirdCore, algebirdTest % "test->test") -} - - diff --git a/project/plugins.sbt b/project/plugins.sbt index 3a6e85068..d4383df3c 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,18 +1,15 @@ resolvers ++= Seq( "jgit-repo" at "http://download.eclipse.org/jgit/maven", - "sonatype-releases" at "http://oss.sonatype.org/content/repositories/releases", Resolver.url("bintray-sbt-plugin-releases", url("http://dl.bintray.com/content/sbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns) ) +addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.0") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.8") addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.3") - -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.6") - addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") - -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.0.4") - addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.0.0.BETA1") - -addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.2") \ No newline at end of file +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.0.4") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.0") +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.2") diff --git a/sbt b/sbt index d894a1520..713c48653 100755 --- a/sbt +++ b/sbt @@ -4,7 +4,7 @@ # Author: Paul Phillips # todo - make this dynamic -declare -r sbt_release_version="0.13.8" +declare -r sbt_release_version="0.13.9" declare -r sbt_unreleased_version="0.13.9-M1" declare -r buildProps="project/build.properties"