Skip to content

Commit

Permalink
Merge pull request #181 from ennru/travis-stages
Browse files Browse the repository at this point in the history
  • Loading branch information
ignasi35 committed May 20, 2020
2 parents 3069882 + 2e3ed78 commit 86ddb28
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 29 deletions.
19 changes: 17 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
version: ~> 1.0

language: scala

scala:
- 2.12.10
- 2.13.1
- 2.12.11
- 2.13.2

git:
depth: false # Avoid sbt-dynver not seeing the tag
Expand All @@ -22,6 +24,19 @@ script:
- pushd samples/compile-timeDI/ && sbt ++$TRAVIS_SCALA_VERSION test && popd
- pushd samples/runtimeDI/ && sbt ++$TRAVIS_SCALA_VERSION test && popd

jobs:
include:
- stage: deploy
name: "TEMP Publish artifacts to Bintray"
script: sbt +mimaReportBinaryIssues
scala: 2.13.2
env: TRAVIS_JDK=11

stages:
- name: test
- name: deploy
if: ((branch = master AND type = push) OR (tag IS present)) AND NOT fork

cache:
directories:
- $HOME/.coursier/cache
Expand Down
44 changes: 18 additions & 26 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import com.typesafe.sbt.SbtScalariform._
import com.typesafe.tools.mima.plugin.MimaPlugin._
import interplay.ScalaVersions
import scalariform.formatter.preferences._

ThisBuild / dynverVTagPrefix := false

lazy val commonSettings = mimaDefaultSettings ++ Seq(
// scalaVersion needs to be kept in sync with travis-ci
scalaVersion := ScalaVersions.scala213,
crossScalaVersions := Seq(ScalaVersions.scala212, ScalaVersions.scala213),
lazy val commonSettings = Seq(
scalaVersion := Dependencies.Scala213,
crossScalaVersions := Dependencies.ScalaVersions,
scalariformAutoformat := true,
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(SpacesAroundMultiImports, true)
Expand All @@ -35,49 +32,44 @@ lazy val commonSettings = mimaDefaultSettings ++ Seq(
"-Xlint:unchecked",
"-Xlint:deprecation"
),

mimaBinaryIssueFilters ++= Seq(
)
)

// needs to be kept in sync with travis-ci
val PlayVersion = playVersion(sys.env.getOrElse("PLAY_VERSION", "2.8.0"))

// Version used to check binary compatibility
val mimaPreviousArtifactsVersion = "7.0.1"

lazy val `play-mailer` = (project in file("play-mailer"))
.enablePlugins(PlayLibrary)
.enablePlugins(Common)
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"javax.inject" % "javax.inject" % "1",
"com.typesafe" % "config" % "1.4.0",
"org.slf4j" % "slf4j-api" % "1.7.30",
"org.apache.commons" % "commons-email" % "1.5",
"com.typesafe.play" %% "play" % PlayVersion % Test,
"com.typesafe.play" %% "play-specs2" % PlayVersion % Test
"com.typesafe.play" %% "play" % Dependencies.PlayVersion % Test,
"com.typesafe.play" %% "play-specs2" % Dependencies.PlayVersion % Test
),
mimaPreviousArtifacts := Set("com.typesafe.play" %% "play-mailer" % mimaPreviousArtifactsVersion)
mimaPreviousArtifacts := Set("com.typesafe.play" %% "play-mailer" % previousStableVersion.value
.getOrElse(throw new Error("Unable to determine previous version")))
)

lazy val `play-mailer-guice` = (project in file("play-mailer-guice"))
.enablePlugins(PlayLibrary)
.enablePlugins(Common)
.settings(commonSettings)
.dependsOn(`play-mailer`)
.settings(
libraryDependencies ++= Seq(
"com.google.inject" % "guice" % "4.2.2",
"com.typesafe.play" %% "play" % PlayVersion % Test,
"com.typesafe.play" %% "play-specs2" % PlayVersion % Test
"com.typesafe.play" %% "play" % Dependencies.PlayVersion % Test,
"com.typesafe.play" %% "play-specs2" % Dependencies.PlayVersion % Test
),
mimaPreviousArtifacts := Set("com.typesafe.play" %% "play-mailer-guice" % mimaPreviousArtifactsVersion)
mimaPreviousArtifacts := Set("com.typesafe.play" %% "play-mailer-guice" % previousStableVersion.value
.getOrElse(throw new Error("Unable to determine previous version")))
)

lazy val `play-mailer-root` = (project in file("."))
.enablePlugins(PlayRootProject, PlayReleaseBase)
.disablePlugins(MimaPlugin)
.settings(commonSettings)
.settings(mimaFailOnNoPrevious := false)
.settings(
crossScalaVersions := Nil,
publish / skip := true
)
.aggregate(`play-mailer`, `play-mailer-guice`)

playBuildRepoName in ThisBuild := "play-mailer"
30 changes: 30 additions & 0 deletions project/Common.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import sbt.Keys._
import sbt._
import sbt.plugins.JvmPlugin

object Common extends AutoPlugin {
override def trigger = allRequirements

override def requires = JvmPlugin

val repoName = "play-mailer"

override def globalSettings =
Seq(
organization := "com.typesafe.play",
organizationName := "Lightbend Inc.",
organizationHomepage := Some(url("https://www.lightbend.com/")),
homepage := Some(url(s"https://github.com/playframework/${repoName}")),
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")),

scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked", "-encoding", "utf8"),
javacOptions ++= Seq("-encoding", "UTF-8", "-Xlint:-options"),

scmInfo := Some(ScmInfo(url(s"https://github.com/playframework/${repoName}"), s"scm:git:[email protected]:playframework/${repoName}.git")),
developers += Developer("contributors",
"Contributors",
"https://gitter.im/playframework/contributors",
url("https://github.com/playframework")),

description := "Play mailer plugin")
}
10 changes: 10 additions & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sbt._

object Dependencies {
// scalaVersion needs to be kept in sync with travis-ci
val Scala212 = "2.12.11"
val Scala213 = "2.13.2"
val ScalaVersions = Seq(Scala212, Scala213)

val PlayVersion = sys.props.getOrElse("play.version", sys.env.getOrElse("PLAY_VERSION", "2.8.0"))
}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("com.typesafe.play" % "interplay" % sys.props.getOrElse("interplay.version", "2.1.4"))
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1")

addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3")
Expand Down

0 comments on commit 86ddb28

Please sign in to comment.