diff --git a/project/giter8.sbt b/project/giter8.sbt index 8c18342..c28a82c 100644 --- a/project/giter8.sbt +++ b/project/giter8.sbt @@ -1 +1 @@ -addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.7.2") +addSbtPlugin("org.foundweekends.giter8" %% "sbt-giter8" % "0.9.0") diff --git a/src/main/g8/build.sbt b/src/main/g8/build.sbt index bdc3f94..fe8036b 100644 --- a/src/main/g8/build.sbt +++ b/src/main/g8/build.sbt @@ -2,6 +2,7 @@ import sbt._ import Settings._ scalaVersion in ThisBuild := scalaVersionUsed +scalafmtVersion in ThisBuild := scalaFmtVersionUsed lazy val root = project.root .setName("$name$") @@ -42,3 +43,6 @@ lazy val second = project.from("second") .compileAndTestDependsOn(common) .settings(mainClass in (Compile, run) := Some("$package$.second.Second")) .settings(mainClass in assembly := Some("$package$.second.Second")) + + +addCommandAlias("fullTest", ";test;it:test;scalastyle") diff --git a/src/main/g8/project/Dependencies.scala b/src/main/g8/project/Dependencies.scala index c4b7e8b..5912498 100644 --- a/src/main/g8/project/Dependencies.scala +++ b/src/main/g8/project/Dependencies.scala @@ -7,6 +7,8 @@ object Dependencies { // scala version val scalaVersion = "2.12.3" + val scalaFmtVersion = "1.2.0" + val monixVersion = "2.3.0" val specs2Version = "3.8.9" @@ -17,7 +19,7 @@ object Dependencies { Resolver.bintrayRepo("cakesolutions", "maven") ) - val scalaConfig = "com.typesafe" % "config" % "1.3.1" + val scalaConfig = "com.typesafe" % "config" % "1.3.1" val pureConfig = "com.github.pureconfig" %% "pureconfig" % "0.8.0" // async @@ -28,7 +30,7 @@ object Dependencies { val cats = "org.typelevel" %% "cats" % "0.9.0" // logging - val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % "3.5.0" + val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % "3.7.2" val logback = "ch.qos.logback" % "logback-classic" % "1.2.3" // testing @@ -42,6 +44,8 @@ trait Dependencies { val scalaVersionUsed = scalaVersion + val scalaFmtVersionUsed = scalaFmtVersion + // resolvers val commonResolvers = resolvers diff --git a/src/main/g8/project/Settings.scala b/src/main/g8/project/Settings.scala index 32c7ec1..26d84d6 100644 --- a/src/main/g8/project/Settings.scala +++ b/src/main/g8/project/Settings.scala @@ -80,12 +80,10 @@ object Settings extends Dependencies { resolvers ++= commonResolvers, libraryDependencies ++= mainDeps, - libraryDependencies ++= testDeps map (_ % Test), scalafmtOnCompile in Compile := true, scalastyleFailOnError := true, - scalastyleFailOnError in Test := false, wartremoverWarnings in (Compile, compile) ++= Warts.allBut( Wart.Any, @@ -107,6 +105,8 @@ object Settings extends Dependencies { .settings(inConfig(config)(Defaults.testSettings): _*) .settings(inConfig(config)(scalafmtSettings)) .settings(scalafmtOnCompile in config := true) + .settings(scalastyleConfig in config := baseDirectory.value / "scalastyle-test-config.xml") + .settings(scalastyleFailOnError in config := false) .settings(fork in config := requiresFork) .settings(testFrameworks := Seq(Specs2)) .settings(libraryDependencies ++= testDeps map (_ % config.name)) diff --git a/src/main/g8/project/build.properties b/src/main/g8/project/build.properties index c091b86..9abea12 100644 --- a/src/main/g8/project/build.properties +++ b/src/main/g8/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.16 +sbt.version=1.0.3 diff --git a/src/main/g8/project/plugins.sbt b/src/main/g8/project/plugins.sbt index 7b41a1a..2bc2151 100644 --- a/src/main/g8/project/plugins.sbt +++ b/src/main/g8/project/plugins.sbt @@ -1,21 +1,17 @@ addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5") -addSbtPlugin("com.github.tkawachi" % "sbt-lock" % "0.3.0") +addSbtPlugin("com.github.tkawachi" % "sbt-lock" % "0.4.0") -addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.10") +addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.12") -addSbtPlugin("com.lucidchart" % "sbt-scalafmt-coursier" % "1.10") +addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.8.5") +addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.0") -addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC3") +addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.2.0") -addSbtPlugin("io.spray" % "sbt-revolver" % "0.8.0") +addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") -addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.1.1") - -addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.9.0") - -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") libraryDependencies += "org.slf4j" % "slf4j-nop" % "1.7.25" diff --git a/src/main/g8/scalastyle-test-config.xml b/src/main/g8/scalastyle-test-config.xml new file mode 100644 index 0000000..c69c0d3 --- /dev/null +++ b/src/main/g8/scalastyle-test-config.xml @@ -0,0 +1,99 @@ + + $name$ test style + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/g8/scripts/sbt b/src/main/g8/scripts/sbt index 1891321..ffd29c5 100755 --- a/src/main/g8/scripts/sbt +++ b/src/main/g8/scripts/sbt @@ -5,10 +5,11 @@ set -o pipefail -declare -r sbt_release_version="0.13.15" -declare -r sbt_unreleased_version="0.13.15" +declare -r sbt_release_version="0.13.16" +declare -r sbt_unreleased_version="0.13.16" -declare -r latest_212="2.12.1" +declare -r latest_213="2.13.0-M2" +declare -r latest_212="2.12.4" declare -r latest_211="2.11.11" declare -r latest_210="2.10.6" declare -r latest_29="2.9.3" @@ -27,7 +28,7 @@ declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory declare sbt_jar sbt_dir sbt_create sbt_version sbt_script sbt_new declare sbt_explicit_version declare verbose noshare batch trace_level -declare sbt_saved_stty debugUs +declare debugUs declare java_cmd="java" declare sbt_launch_dir="$HOME/.sbt/launchers" @@ -43,19 +44,21 @@ echoerr () { echo >&2 "$@"; } vlog () { [[ -n "$verbose" ]] && echoerr "$@"; } die () { echo "Aborting: $@" ; exit 1; } -# restore stty settings (echo in particular) -onSbtRunnerExit() { - [[ -n "$sbt_saved_stty" ]] || return - vlog "" - vlog "restoring stty: $sbt_saved_stty" - stty "$sbt_saved_stty" - unset sbt_saved_stty -} +setTrapExit () { + # save stty and trap exit, to ensure echo is re-enabled if we are interrupted. + export SBT_STTY="$(stty -g 2>/dev/null)" + + # restore stty settings (echo in particular) + onSbtRunnerExit() { + [ -t 0 ] || return + vlog "" + vlog "restoring stty: $SBT_STTY" + stty "$SBT_STTY" + } -# save stty and trap exit, to ensure echo is re-enabled if we are interrupted. -trap onSbtRunnerExit EXIT -sbt_saved_stty="$(stty -g 2>/dev/null)" -vlog "Saved stty: $sbt_saved_stty" + vlog "saving stty: $SBT_STTY" + trap onSbtRunnerExit EXIT +} # this seems to cover the bases on OSX, and someone will # have to tell me about the others. @@ -228,8 +231,13 @@ execRunner () { vlog "" } - [[ -n "$batch" ]] && exec use the scala build at the specified directory -scala-version use the specified version of scala -binary-version use the specified scala version when searching for dependencies @@ -399,7 +408,8 @@ process_args () { -210) setScalaVersion "$latest_210" && shift ;; -211) setScalaVersion "$latest_211" && shift ;; -212) setScalaVersion "$latest_212" && shift ;; - new) sbt_new=true && sbt_explicit_version="$sbt_release_version" && addResidual "$1" && shift ;; + -213) setScalaVersion "$latest_213" && shift ;; + new) sbt_new=true && : ${sbt_explicit_version:=$sbt_release_version} && addResidual "$1" && shift ;; *) addResidual "$1" && shift ;; esac done