Skip to content

Commit

Permalink
Merge pull request #252 from barkhorn/newbuilds
Browse files Browse the repository at this point in the history
Newbuilds
  • Loading branch information
barkhorn authored Dec 23, 2018
2 parents 28ac787 + 579cf42 commit fc719ff
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 90 deletions.
105 changes: 19 additions & 86 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
import sbtcrossproject.crossProject
import sbtcrossproject.CrossPlugin.autoImport.crossProject

scalaVersion in ThisBuild := "2.11.12"
crossScalaVersions in ThisBuild := Seq("2.10.7", "2.11.12", "2.12.6", "2.13.0-M3")
scalaJSUseRhino in ThisBuild := true
organization in ThisBuild := "org.scalamock"
licenses in ThisBuild := Seq("MIT" -> url("https://opensource.org/licenses/MIT"))
scmInfo in ThisBuild := Some(
ScmInfo(url("https://github.com/paulbutcher/ScalaMock"), "scm:git:[email protected]:paulbutcher/ScalaMock.git")
)
developers in ThisBuild := List(
Developer("paulbutcher", "Paul Butcher", "", url("http://paulbutcher.com/")),
Developer("barkhorn", "Philipp Meyerhoefer", "", url("https://github.com/barkhorn"))
)
homepage in ThisBuild := Some(url("http://scalamock.org/"))

lazy val scalatest = "org.scalatest" %% "scalatest" % "3.0.5-M1"
lazy val specs2 = Def.setting {
val v = CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 10)) =>
"3.9.1" // specs2 4.x does not support Scala 2.10
case _ =>
"4.0.2"
case Some((2, 10)) => "3.9.1" // specs2 4.x does not support Scala 2.10
case _ => "4.0.2"
}
"org.specs2" %% "specs2-core" % v
}
lazy val quasiquotes = libraryDependencies ++= {

lazy val withQuasiquotes = libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 10)) =>
Seq(compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
Expand All @@ -46,91 +35,35 @@ val commonSettings = Defaults.coreDefaultSettings ++ Seq(
"-target:jvm-" + (if (scalaVersion.value < "2.11") "1.7" else "1.8"))
)

lazy val examples = crossProject(JSPlatform, JVMPlatform) in file("examples") settings(
commonSettings,
name := "ScalaMock Examples",
skip in publish := true,
libraryDependencies ++= Seq(
scalatest % Test,
specs2.value % Test
)
) dependsOn scalamock

lazy val `examples-js` = examples.js

lazy val `examples-jvm` = examples.jvm

lazy val scalamock = crossProject(JSPlatform, JVMPlatform) in file(".") settings(
commonSettings,
publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
),
quasiquotes,
name := "scalamock",
publishArtifact in (Compile, packageBin) := true,
publishArtifact in (Compile, packageDoc) := true,
publishArtifact in (Compile, packageSrc) := true,
publishArtifact in Test := false,
scalacOptions in (Compile, doc) ++= Opts.doc.title("ScalaMock") ++ Opts.doc.version(version.value) ++ Seq("-doc-root-content", "rootdoc.txt", "-version"),
pomIncludeRepository := { _ => false },
scalacOptions in (Compile, doc) ++= Opts.doc.title("ScalaMock") ++
Opts.doc.version(version.value) ++ Seq("-doc-root-content", "rootdoc.txt", "-version"),
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
scalatest % Optional,
specs2.value % Optional
)
),
withQuasiquotes
)

lazy val `scalamock-js` = scalamock.js

lazy val `scalamock-jvm` = scalamock.jvm

releaseCrossBuild := true
releaseProcess := {
import ReleaseTransformations._
Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommand("publishSigned")
lazy val examples = crossProject(JSPlatform, JVMPlatform) in file("examples") settings(
commonSettings,
name := "ScalaMock Examples",
skip in publish := true,
libraryDependencies ++= Seq(
scalatest % Test,
specs2.value % Test
)
}
) dependsOn scalamock

credentials ++= (
for {
u <- Option(System.getenv().get("SONATYPE_USERNAME"))
p <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", u, p)
).toSeq

{
val f = Path.userHome / ".sbt" / ".gpgsettings"
if (f.exists) {
println(s"pgp settings loaded from $f")
val pphrase :: hexkey :: _ = IO.readLines(f)
usePgpKeyHex(hexkey)
Seq(
pgpPassphrase := Some(pphrase.toCharArray),
useGpg := true
)
} else {
println(s"$f does not exist - pgp settings empty")
Seq.empty[Def.Setting[_]]
}
}

version in ThisBuild := {
val Snapshot = """(\d+)\.(\d+)\.(\d+)-\d+.*?""".r
git.gitDescribedVersion.value.getOrElse("0.0.0-1")match {
case Snapshot(maj, min, _) => s"$maj.${min.toInt + 1}.0-SNAPSHOT"
case v => v
}
}

isSnapshot in ThisBuild := version.value.endsWith("-SNAPSHOT")
lazy val `examples-js` = examples.js
lazy val `examples-jvm` = examples.jvm
9 changes: 5 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
//addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0-M2")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.7")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3")
37 changes: 37 additions & 0 deletions publishing.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
organization in ThisBuild := "org.scalamock"
licenses in ThisBuild := Seq("MIT" -> url("https://opensource.org/licenses/MIT"))
scmInfo in ThisBuild := Some(
ScmInfo(url("https://github.com/paulbutcher/ScalaMock"), "scm:git:[email protected]:paulbutcher/ScalaMock.git")
)
developers in ThisBuild := List(
Developer("paulbutcher", "Paul Butcher", "", url("http://paulbutcher.com/")),
Developer("barkhorn", "Philipp Meyerhoefer", "", url("https://github.com/barkhorn"))
)
homepage in ThisBuild := Some(url("http://scalamock.org/"))
pomIncludeRepository in ThisBuild := { _ => false }

version in ThisBuild := {
val Snapshot = """(\d+)\.(\d+)\.(\d+)-\d+.*?""".r
git.gitDescribedVersion.value.getOrElse("0.0.0-1")match {
case Snapshot(maj, min, _) => s"$maj.${min.toInt + 1}.0-SNAPSHOT"
case v => v
}
}

isSnapshot in ThisBuild := version.value.endsWith("-SNAPSHOT")

publishTo in ThisBuild := Some(
if (isSnapshot.value) Opts.resolver.sonatypeSnapshots else Opts.resolver.sonatypeStaging
)
publishConfiguration in ThisBuild := publishConfiguration.value.withOverwrite(true)
publishLocalConfiguration in ThisBuild := publishLocalConfiguration.value.withOverwrite(true)

addCommandAlias("ci-all", ";+clean ;+compile ;+test ;+package")
addCommandAlias("release", ";+publishSigned ;sonatypeReleaseAll")

credentials ++= (
for {
u <- Option(System.getenv().get("SONATYPE_USERNAME"))
p <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", u, p)
).toSeq

0 comments on commit fc719ff

Please sign in to comment.