Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI User committed Dec 5, 2019
2 parents 55cfabe + 409714c commit 1248cbc
Show file tree
Hide file tree
Showing 24 changed files with 319 additions and 102 deletions.
13 changes: 13 additions & 0 deletions .bettercodehub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
component_depth: 15
languages:
- name: scala
production:
include:
- /src/main/scala/.*
exclude:
- /src/main/scala/org/scalatest/.*
test:
include:
- /src/sbt-test/.*
exclude:
- /src/main/scala/.*
21 changes: 21 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version = "2.0.0-RC6"

# change to "always" after support for SBT 0.13 is dropped
trailingCommas = never

rewrite.rules = [
AvoidInfix
SortModifiers
PreferCurlyFors
]

# Reorder modifiers according to:
# https://docs.scala-lang.org/style/declarations.html#modifiers
rewrite.sortModifiers.order = [
"override"
"private", "protected"
"implicit"
"final", "sealed"
"abstract"
"lazy"
]
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ language: scala
# Ubuntu Trusty (https://docs.travis-ci.com/user/reference/trusty/)
dist: trusty

# https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html#running-versus-compiling
jdk: openjdk8

jobs:
include:
- name: test
- stage: test
if: (NOT branch =~ /^release\/.*$/)
# When running scripted tests targeting multiple SBT versions, we must first publish locally for all SBT versions
script: sbt "^ publishLocal" "^ scripted"
- name: release
script: sbt "^ publishLocal" "scripted"
- stage: release
if: (branch =~ /^release\/.*$/)
env:
- BINTRAY_USER=daniel-shuy
Expand Down
67 changes: 38 additions & 29 deletions README.md

Large diffs are not rendered by default.

30 changes: 26 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,37 @@ organization := "com.github.daniel-shuy"

name := "sbt-scripted-scalatest"

licenses := Seq("Apache License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
licenses := Seq(
"Apache License, Version 2.0" -> url(
"http://www.apache.org/licenses/LICENSE-2.0.txt"
)
)

homepage := Some(
url("https://github.com/daniel-shuy/scripted-scalatest-sbt-plugin")
)

homepage := Some(url("https://github.com/daniel-shuy/scripted-scalatest-sbt-plugin"))
scmInfo := Some(
ScmInfo(
url("https://github.com/daniel-shuy/scripted-scalatest-sbt-plugin"),
"[email protected]:daniel-shuy/scripted-scalatest-sbt-plugin.git"
)
)

developers := List(
Developer(
"daniel-shuy",
"Daniel Shuy",
"[email protected]",
url("https://github.com/daniel-shuy")
)
)

crossSbtVersions := Seq(
"0.13.17",
"1.2.6"
"1.3.3"
)

libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.0"
"org.scalatest" %% "scalatest" % "3.1.0"
)
2 changes: 1 addition & 1 deletion project/bintray.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.5")
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.2.6
sbt.version = 1.3.3
2 changes: 1 addition & 1 deletion project/release.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.11")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.12")
9 changes: 8 additions & 1 deletion publish.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ publishMavenStyle := false

bintrayRepository := "sbt-plugins"

bintrayPackageLabels := Seq("sbt", "sbt-plugin", "sbt-test", "scripted", "scripted-plugin", "scalatest")
bintrayPackageLabels := Seq(
"sbt",
"sbt-plugin",
"sbt-test",
"scripted",
"scripted-plugin",
"scalatest"
)

bintrayReleaseOnPublish := false
3 changes: 2 additions & 1 deletion release.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import ReleaseTransformations._

releaseIgnoreUntrackedFiles := true

// skip Travis CI build
releaseCommitMessage := s"[ci skip] ${releaseCommitMessage.value}"

releaseProcess := Seq[ReleaseStep](
Expand All @@ -11,7 +12,7 @@ releaseProcess := Seq[ReleaseStep](
releaseStepCommandAndRemaining("^ test"),
// When running scripted tests targeting multiple SBT versions, we must first publish locally for all SBT versions
releaseStepCommandAndRemaining("^ publishLocal"),
releaseStepCommandAndRemaining("^ scripted"),
releaseStepInputTask(scripted),
setReleaseVersion,
commitReleaseVersion,
// don't tag, leave it to git flow
Expand Down
19 changes: 19 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": [
"config:base"
],
"ignoreDeps": [
"org.scalatest:scalatest"
],
"rebaseStalePrs": true,
"automerge": true,
"major": {
"automerge": false
},
"packageRules": [{
"packageNames": [
"org.scalameta:sbt-scalafmt"
],
"automerge": false
}]
}
5 changes: 3 additions & 2 deletions scripted.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
enablePlugins(SbtPlugin)
scriptedLaunchOpts := { scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
}
scriptedBufferLog := false
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
package com.github.daniel.shuy.sbt.scripted.scalatest

import org.scalatest.Suite
import org.scalatest.{ScriptedScalaTestSuite, Suite}
import sbt._
import sbt.Keys.streams

object SbtScriptedScalaTest extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements

sealed abstract class ScriptedTestStacks(val shortstacks: Boolean, val fullstacks: Boolean)
sealed abstract class ScriptedTestStacks(
val shortstacks: Boolean,
val fullstacks: Boolean
)
case object NoStacks extends ScriptedTestStacks(false, false)
case object ShortStacks extends ScriptedTestStacks(true, false)
case object FullStacks extends ScriptedTestStacks(true, true)

object autoImport {
lazy val scriptedScalaTestDurations: SettingKey[Boolean] = SettingKey("scripted-scalatest-durations", "If false, will not display durations of tests.")
lazy val scriptedScalaTestStacks: SettingKey[ScriptedTestStacks] = SettingKey("scripted-scalatest-stacks", "Length of stack traces to print.")
lazy val scriptedScalaTestStats: SettingKey[Boolean] = SettingKey("scripted-scalatest-stats", "If false, will not display various statistics of tests.")
lazy val scriptedScalaTestSpec: TaskKey[Option[Suite with ScriptedScalaTestSuiteMixin]] = TaskKey("scripted-scalatest-spec", "The ScalaTest Spec.")
lazy val scriptedScalaTest: TaskKey[Unit] = TaskKey("scripted-scalatest", "Executes all ScalaTest tests for SBT plugin.")
lazy val scriptedScalaTestDurations: SettingKey[Boolean] = SettingKey(
"scripted-scalatest-durations",
"If false, will not display durations of tests."
)
lazy val scriptedScalaTestStacks: SettingKey[ScriptedTestStacks] =
SettingKey(
"scripted-scalatest-stacks",
"Length of stack traces to print."
)
lazy val scriptedScalaTestStats: SettingKey[Boolean] = SettingKey(
"scripted-scalatest-stats",
"If false, will not display various statistics of tests."
)
lazy val scriptedScalaTestSpec
: TaskKey[Option[Suite with ScriptedScalaTestSuiteMixin]] =
TaskKey("scripted-scalatest-spec", "The ScalaTest Spec.")
lazy val scriptedScalaTest: TaskKey[Unit] = TaskKey(
"scripted-scalatest",
"Executes all ScalaTest tests for SBT plugin."
)
}
import autoImport._

Expand All @@ -29,26 +47,32 @@ object SbtScriptedScalaTest extends AutoPlugin {
scriptedScalaTestDurations := true,
scriptedScalaTestStacks := NoStacks,
scriptedScalaTestStats := true,

scriptedScalaTestSpec := None,

scriptedScalaTest := {
// do nothing if not configured
scriptedScalaTestSpec.value match {
case Some(suite) =>
val stacks = scriptedScalaTestStacks.value
val status = suite.executeScripted(
durations = scriptedScalaTestDurations.value,
shortstacks = stacks.shortstacks,
fullstacks = stacks.fullstacks,
stats = scriptedScalaTestStats.value
case Some(suite) => executeScriptedTestsTask(suite)
case None =>
logger.value.warn(
s"${scriptedScalaTestSpec.key.label} not configured, no tests will be run..."
)
status.waitUntilCompleted()
if (!status.succeeds()) {
sys.error(s"Scripted ScalaTest suite failed!")
}
case None => logger.value.warn(s"${scriptedScalaTestSpec.key.label} not configured, no tests will be run...")
}
}
)

private[this] def executeScriptedTestsTask(
suite: ScriptedScalaTestSuite
): Unit = Def.task {
val stacks = scriptedScalaTestStacks.value
val status = suite.executeScripted(
durations = scriptedScalaTestDurations.value,
shortstacks = stacks.shortstacks,
fullstacks = stacks.fullstacks,
stats = scriptedScalaTestStats.value
)
status.waitUntilCompleted()
if (!status.succeeds()) {
sys.error("Scripted ScalaTest suite failed!")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package com.github.daniel.shuy.sbt.scripted.scalatest
import org.scalatest._
import sbt.{Keys, Project, State}

trait ScriptedScalaTestSuiteMixin extends ScriptedScalaTestSuite with BeforeAndAfterEach {
trait ScriptedScalaTestSuiteMixin
extends ScriptedScalaTestSuite
with BeforeAndAfterEach {
this: Suite =>

val sbtState: State
Expand Down
Loading

0 comments on commit 1248cbc

Please sign in to comment.