package tests

import org.scalatest.{FlatSpec, Matchers}

class SleepInTest extends FlatSpec with Matchers {
  behavior of "SleepIn"

  it should "sleepIn when it is not a weekday and it is not a vacation" in {
    SleepInSolution.sleepIn(weekday = false, vacation = false) shouldBe true
  }

  it should "not sleepIn when it is a weekday and it is not a vacation" in {
    SleepInSolution.sleepIn(weekday = true, vacation = false) shouldBe false
  }

  it should "sleepIn when it is not a weekday and it is a vacation" in {
    SleepInSolution.sleepIn(weekday = false, vacation = true) shouldBe true
  }
}

package tests

import org.scalatest.{FlatSpec, Matchers}

//let's keep this single test in tests as it is an example fot SbtRunner test-task
class SleepInTest extends FlatSpec with Matchers {
  behavior of "SleepIn"

  it should "sleepIn when it is not a weekday and it is not a vacation" in {
    SleepInSolution.sleepIn(weekday = false, vacation = false) shouldBe true
  }

  it should "not sleepIn when it is a weekday and it is not a vacation" in {
    SleepInSolution.sleepIn(weekday = true, vacation = false) shouldBe false
  }

  it should "sleepIn when it is not a weekday and it is a vacation" in {
    SleepInSolution.sleepIn(weekday = false, vacation = true) shouldBe true
  }
}

Add more different tests: TestForTest - comment


import sbt._
import sbt.Keys._
import android.Keys._
import android.Plugin._

object Build extends android.AutoBuild
{
	lazy val main = Project( "toolbelt", file( "." ) )
		.settings( buildAar: _* )
		.settings(
			libraryDependencies ++= Seq(
				"org.scala-lang" % "scala-reflect" % scalaVersion.value,
				"com.android.support" % "support-v4" % "20.0.0",
				"com.github.japgolly.android" % "svg-android" % "2.0.6"
			),
			name := "Toolbelt",
			organization := "com.taig.android",
			scalaVersion := "2.11.2",
			scalacOptions ++= Seq(
				"-deprecation",
				"-feature",
				"-language:dynamics",
				"-language:implicitConversions",
				"-language:reflectiveCalls"
			),
			version := "0.1.0-BETA",
			libraryProject in Android := true,
			minSdkVersion in Android := "10",
			targetSdkVersion in Android := "21"
		)
}

import sbt._
import sbt.Keys._
import android.Keys._
import android.Plugin._

object Build extends android.AutoBuild
{
	lazy val main = Project( "toolbelt", file( "." ) )
		.settings( buildAar: _* )
		.settings(
			libraryDependencies ++= Seq(
				"org.scala-lang" % "scala-reflect" % scalaVersion.value,
				"com.android.support" % "support-v4" % "20.0.0",
				"com.github.japgolly.android" % "svg-android" % "2.0.6"
			),
			name := "Toolbelt",
			organization := "com.taig.android",
			scalaVersion := "2.11.2",
			scalacOptions ++= Seq(
				"-deprecation",
				"-feature",
				"-language:dynamics",
				"-language:implicitConversions",
				"-language:reflectiveCalls"
			),
			version := "0.1.1-BETA",
			libraryProject in Android := true,
			minSdkVersion in Android := "10",
			targetSdkVersion in Android := "21"
		)
}

Set project version to 0.1.1-BETA

Set project version to 0.1.1-BETA


addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.1")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.8.0")

Add Sbt OSGi to allow Slogging to be used from within an OSGi container. In order to pass tests with JDK 1.7, attempting to reduce the version of Sbt OSGi.


resolvers ++= Resolver.sonatypeOssRepos("snapshots")
resolvers ++= Seq(
  Classpaths.typesafeReleases,
  Classpaths.sbtPluginReleases,
  "jgit-repo" at "https://download.eclipse.org/jgit/maven"
)

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.3.4")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "3.0.5")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1")

resolvers ++= Resolver.sonatypeOssRepos("snapshots")
resolvers ++= Seq(
  Classpaths.typesafeReleases,
  Classpaths.sbtPluginReleases,
  "jgit-repo" at "https://download.eclipse.org/jgit/maven"
)

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.3.4")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "3.0.6")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1")

Update sbt-wartremover, wartremover to 3.0.6


addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "2.0.0")
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.1.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")

addSbtPlugin("com.etsy" % "sbt-checkstyle-plugin" % "3.1.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("com.eed3si9n" % "sbt-nocomma" % "0.1.0")

addSbtPlugin("com.github.sbt" % "sbt-findbugs" % "2.0.0")
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.1.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0-M2")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.3")
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")

addSbtPlugin("com.etsy" % "sbt-checkstyle-plugin" % "3.1.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("com.eed3si9n" % "sbt-nocomma" % "0.1.0")

Update to the latest sbt-pgp

Update to the latest sbt-pgp


resolvers += Resolver.bintrayIvyRepo("gatling", "sbt-plugins")
resolvers += Resolver.jcenterRepo

addSbtPlugin("io.gatling"         % "gatling-build-plugin"  % "2.5.1")
addSbtPlugin("com.typesafe.sbt"   % "sbt-native-packager"   % "1.3.11")
addSbtPlugin("pl.project13.scala" % "sbt-jmh"               % "0.3.3")
addSbtPlugin("net.aichler"        % "sbt-jupiter-interface" % "0.7.0")
addSbtPlugin("com.typesafe.sbt"   % "sbt-site"              % "1.3.2")
addSbtPlugin("org.wartremover"    % "sbt-wartremover"       % "2.4.5")
addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"          % "0.9.15")

resolvers += Resolver.bintrayIvyRepo("gatling", "sbt-plugins")
resolvers += Resolver.jcenterRepo

addSbtPlugin("io.gatling"         % "gatling-build-plugin"  % "2.5.2")
addSbtPlugin("com.typesafe.sbt"   % "sbt-native-packager"   % "1.3.11")
addSbtPlugin("pl.project13.scala" % "sbt-jmh"               % "0.3.3")
addSbtPlugin("net.aichler"        % "sbt-jupiter-interface" % "0.7.0")
addSbtPlugin("com.typesafe.sbt"   % "sbt-site"              % "1.3.2")
addSbtPlugin("org.wartremover"    % "sbt-wartremover"       % "2.4.5")
addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"          % "0.9.15")

Upgrade gatling-build-plugin 2.5.2, let compile with Java9+ and retain Java8 compatibility


resolvers ++= Seq(
  Classpaths.typesafeReleases,
  Classpaths.sbtPluginReleases
)

addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.12")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")

addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2")

resolvers ++= Seq(
  Classpaths.typesafeReleases,
  Classpaths.sbtPluginReleases
)

addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.12")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")

addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2")

Fix build - rollback to old version of pgp


// Copyright (c) 2013-2020 Rob Norris and Contributors
// This software is licensed under the MIT License (MIT).
// For more information see LICENSE or https://opensource.org/licenses/MIT

package doobie.munit

import cats.effect.{ ContextShift, IO }
import doobie.syntax.string._
import doobie.util.transactor.Transactor
import munit._
import scala.concurrent.ExecutionContext

trait CheckerChecks[M[_]] extends FunSuite with Checker[M] {

  implicit def contextShift: ContextShift[M]

  lazy val transactor = Transactor.fromDriverManager[M](
    "org.h2.Driver",
    "jdbc:h2:mem:queryspec;DB_CLOSE_DELAY=-1",
    "sa", ""
  )

  test("trivial") { check(sql"select 1".query[Int]) }

}

class IOCheckerCheck extends CheckerChecks[IO] with IOChecker {
  def contextShift: ContextShift[IO] =
    IO.contextShift(ExecutionContext.global)
}

// Copyright (c) 2013-2020 Rob Norris and Contributors
// This software is licensed under the MIT License (MIT).
// For more information see LICENSE or https://opensource.org/licenses/MIT

package doobie.munit

import cats.effect.{ ContextShift, IO }
import doobie.syntax.string._
import doobie.util.transactor.Transactor
import munit._
import scala.concurrent.ExecutionContext

trait CheckerChecks[M[_]] extends FunSuite with Checker[M] {

  implicit def contextShift: ContextShift[M]

  lazy val transactor = Transactor.fromDriverManager[M](
    "org.h2.Driver",
    "jdbc:h2:mem:queryspec;DB_CLOSE_DELAY=-1",
    "sa", ""
  )

  test("trivial") { check(sql"select 1".query[Int]) }

  test("fail".fail) { check(sql"select 1".query[String]) }

  final case class Foo[F[_]](x: Int)

  test ("trivial case-class"){ check(sql"select 1".query[Foo[cats.Id]]) }

}

class IOCheckerCheck extends CheckerChecks[IO] with IOChecker {
  def contextShift: ContextShift[IO] =
    IO.contextShift(ExecutionContext.global)
}

Add failing assertion and conform with specs2 tests


package eu.timepit.refined

import shapeless.tag
import shapeless.tag.@@

import scala.language.experimental.macros

object refine {
  def apply[P] = new Refinery[P]

  class Refinery[P] {
    def apply[T](t: T)(implicit p: Predicate[P, T]): Either[String, T @@ P] =
      p.validated(t) match {
        case Some(s) => Left(s)
        case None => Right(tag[P](t))
      }
  }
}

object refineLit {
  def apply[P] = new Refinery[P]

  class Refinery[P] {
    def apply[T](t: T)(implicit p: Predicate[P, T]): T @@ P = macro internal.refineLitImpl[P, T]
  }
}

package eu.timepit.refined

import shapeless.tag
import shapeless.tag.@@

import scala.language.experimental.macros

object refine {
  def apply[P]: Refinery[P] = new Refinery[P]

  class Refinery[P] {
    def apply[T](t: T)(implicit p: Predicate[P, T]): Either[String, T @@ P] =
      p.validated(t) match {
        case Some(s) => Left(s)
        case None => Right(tag[P](t))
      }
  }
}

object refineLit {
  def apply[P]: Refinery[P] = new Refinery[P]

  class Refinery[P] {
    def apply[T](t: T)(implicit p: Predicate[P, T]): T @@ P = macro internal.refineLitImpl[P, T]
  }
}

Add type annotations to public methods

Add type annotations to public methods


val ls: List[Int] = null
/*start*/(ls.collect){ case x => x }/*end*/

//List[Int]

object ls {
  def collect[A](x: PartialFunction[Int, A]): A = null
}
/*start*/(ls.collect){ case x => x }/*end*/

//Int

Fix the test case from last commit, _really_ closing SCL-2763.


/*
 * Copyright 2014 Databricks
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.databricks.spark.csv.util

private[csv] object ParseModes {

  val PERMISSIVE_MODE = "PERMISSIVE"
  val DROP_MALFORMED_MODE = "DROPMALFORMED"
  val FAIL_FAST_MODE = "FAILFAST"

  val DEFAULT = PERMISSIVE_MODE

  def isValidMode(mode: String): Boolean = {
    mode.toUpperCase match {
      case PERMISSIVE_MODE | DROP_MALFORMED_MODE | FAIL_FAST_MODE => true
      case _ => false
    }
  }

  def isPermissiveMode(mode: String) = mode.toUpperCase == PERMISSIVE_MODE
  def isDropMalformedMode(mode: String) = mode.toUpperCase == DROP_MALFORMED_MODE
  def isFailFastMode(mode: String) = mode.toUpperCase == FAIL_FAST_MODE
}

/*
 * Copyright 2014 Databricks
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.databricks.spark.csv.util

private[csv] object ParseModes {

  val PERMISSIVE_MODE = "PERMISSIVE"
  val DROP_MALFORMED_MODE = "DROPMALFORMED"
  val FAIL_FAST_MODE = "FAILFAST"

  val DEFAULT = PERMISSIVE_MODE

  def isValidMode(mode: String): Boolean = {
    mode.toUpperCase match {
      case PERMISSIVE_MODE | DROP_MALFORMED_MODE | FAIL_FAST_MODE => true
      case _ => false
    }
  }

  def isDropMalformedMode(mode: String) = mode.toUpperCase == DROP_MALFORMED_MODE
  def isFailFastMode(mode: String) = mode.toUpperCase == FAIL_FAST_MODE
  def isPermissiveMode(mode: String) = if (isValidMode(mode))  {
    mode.toUpperCase == PERMISSIVE_MODE
  } else {
    true // We default to permissive is the mode string is not valid
  }
}

Use permissive for any invalid mode string


scalacOptions := Seq(
  "-deprecation"
)

// For MimeLoader plugin. Dogfooding and hoping it doesn't clash with
// our other sbt plugins.
libraryDependencies ++= List(
  "com.eed3si9n" %% "treehugger" % "0.4.4",
  "io.circe" %% "circe-generic" % "0.14.1",
  "org.http4s" %% "http4s-ember-client" % "0.23.8",
  "org.http4s" %% "http4s-circe" % "0.23.8",
)

scalacOptions := Seq(
  "-deprecation"
)

// For MimeLoader plugin. Dogfooding and hoping it doesn't clash with
// our other sbt plugins.
libraryDependencies ++= List(
  "com.eed3si9n" %% "treehugger" % "0.4.4",
  "io.circe" %% "circe-generic" % "0.14.1",
  "org.http4s" %% "http4s-ember-client" % "0.23.9",
  "org.http4s" %% "http4s-circe" % "0.23.9",
)

Update http4s-circe, http4s-ember-client to 0.23.9 in series/0.22


scalacOptions := Seq(
  "-deprecation"
)

// For MimeLoader plugin. Dogfooding and hoping it doesn't clash with
// our other sbt plugins.
libraryDependencies ++= List(
  "com.eed3si9n" %% "treehugger" % "0.4.4",
  "io.circe" %% "circe-generic" % "0.14.1",
  "org.http4s" %% "http4s-ember-client" % "0.22.0",
  "org.http4s" %% "http4s-circe" % "0.22.0",
)

scalacOptions := Seq(
  "-deprecation"
)

// For MimeLoader plugin. Dogfooding and hoping it doesn't clash with
// our other sbt plugins.
libraryDependencies ++= List(
  "com.eed3si9n" %% "treehugger" % "0.4.4",
  "io.circe" %% "circe-generic" % "0.14.1",
  "org.http4s" %% "http4s-ember-client" % "0.22.1",
  "org.http4s" %% "http4s-circe" % "0.22.1",
)

Update http4s-circe, http4s-ember-client to 0.22.1


package lila.report

import lila.user.User
import org.joda.time.DateTime

case class TempThreshold(score: Int, lastUsed: DateTime)

final class ModReportFilter {

  // mutable storage, because I cba to put it in DB
  private var modIdFilter = Map.empty[User.ID, Option[Room]]
  // mutable storage, because I also cba to put it in DB
  // Also, this value shouldn't be in the DB. If we ever move the other value to the
  // db we should move this to a cookie or something. I intend
  // for this to be a temporary cookie of some sort.
  private var modTempThreshold = Map.empty[User.ID, Option[TempThreshold]]

  def get(mod: User): Option[Room] = modIdFilter.get(mod.id).flatten

  def set(mod: User, filter: Option[Room]) =
    modIdFilter = modIdFilter + (mod.id -> filter)

  def getThreshold(mod: User): Option[Int] =
    modTempThreshold
      .get(mod.id)
      .flatten
      .filter(_.lastUsed isAfter DateTime.now.minusHours(1))
      .map(t => {
        modTempThreshold = modTempThreshold + (mod.id -> some(TempThreshold(t.score, DateTime.now)))
        t.score
      })

  def updateThreshold(mod: User, score: Option[Int]): Option[Int] =
    score.fold(getThreshold(mod))(score => {
      modTempThreshold = modTempThreshold + (mod.id -> some(TempThreshold(score, DateTime.now)))
      some(score)
    })
}

package lila.report

import lila.user.User
import com.github.blemale.scaffeine.Cache
import scala.concurrent.duration.FiniteDuration

case class TempThreshold(score: Int)

final class ModReportFilter {

  // mutable storage, because I cba to put it in DB
  private var modIdFilter = Map.empty[User.ID, Option[Room]]
  // mutable storage, because I also cba to put it in DB
  // Also, this value shouldn't be in the DB. If we ever move the other value to the
  // db we should move this to a cookie or something. I intend
  // for this to be a temporary cookie of some sort.
  private val modTempThreshold: Cache[User.ID, TempThreshold] = lila.memo.CacheApi.scaffeineNoScheduler
    .expireAfterAccess(FiniteDuration(1, "hour"))
    .build[User.ID, TempThreshold]()

  def get(mod: User): Option[Room] = modIdFilter.get(mod.id).flatten

  def set(mod: User, filter: Option[Room]) =
    modIdFilter = modIdFilter + (mod.id -> filter)

  def getThreshold(mod: User): Option[Int] =
    modTempThreshold
      .getIfPresent(mod.id)
      .map(_.score)

  def updateThreshold(mod: User, score: Option[Int]): Option[Int] =
    score.fold(getThreshold(mod))(score => {
      modTempThreshold.put(mod.id, TempThreshold(score))
      some(score)
    })
}

Use builtin cache object, instead of homegrown solution.

Much nicer code as a result.


package org.talkingpuffin.time

/**
 * Time formatter
 */
case class TimeFormatter(time: Long) {
  val days = time / 86400
  val hours = (time / 3600) - (days * 24)
  val minutes = (time / 60) - (days * 1440) - (hours * 60)
  val seconds = time % 60

  def colonSeparated: String = {
    val sb = new StringBuilder
    if (days > 0)                      sb.append(twoDigitNum(days))    .append(":")
    if (hours > 0    || sb.length > 0) sb.append(twoDigitNum(hours))   .append(":")
    if (minutes > 0  || sb.length > 0) sb.append(twoDigitNum(minutes)) .append(":")
    sb.append(twoDigitNum(seconds))
    sb.toString
  }

  def longForm: String = {
    val sb = new StringBuilder
    addPart(sb, days,    "d")
    addPart(sb, hours,   "h")
    addPart(sb, minutes, "m")
    addPart(sb, seconds, "s")

    def addPart(sb: StringBuilder, value: Long, name: String): Unit = {
      if (value > 0) {
        if (sb.length > 0) sb.append(' ')
        sb.append(value).append(' ').append(name)
      }
    }

    sb.toString
  }

  private def twoDigitNum(num: java.lang.Long) = String.format("%02d", num)

}

package org.talkingpuffin.time

/**
 * Time formatter
 */
case class TimeFormatter(time: Long) {
  val days = time / 86400
  val hours = (time / 3600) - (days * 24)
  val minutes = (time / 60) - (days * 1440) - (hours * 60)
  val seconds = time % 60

  def colonSeparated: String = {
    val sb = new StringBuilder
    if (days > 0)                      sb.append(twoDigitNum(days))    .append(":")
    if (hours > 0    || sb.length > 0) sb.append(twoDigitNum(hours))   .append(":")
    if (minutes > 0  || sb.length > 0) sb.append(twoDigitNum(minutes)) .append(":")
    sb.append(twoDigitNum(seconds))
    sb.toString
  }

  def longForm: String = {
    val sb = new StringBuilder
    addPart(sb, days,    "day")
    addPart(sb, hours,   "hour")
    addPart(sb, minutes, "min")
    addPart(sb, seconds, "sec")

    def addPart(sb: StringBuilder, value: Long, name: String): Unit = {
      if (value > 0) {
        if (sb.length > 0) sb.append(' ')
        sb.append(value).append(' ').append(name)
        if (value > 1) sb.append('s')
      }
    }

    sb.toString
  }

  private def twoDigitNum(num: java.lang.Long) = String.format("%02d", num)

}

Put the time formatting back the way it was (mins, secs, etc.)


ThisBuild / scalaVersion := "2.12.9"
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbIncludeInJar := true

lazy val root = (project in file("."))

ThisBuild / scalaVersion := "2.12.8"
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbIncludeInJar := true

lazy val root = (project in file("."))

Downgrade to 2.12.8 for project/semanticdb scripted test

Semanticdb hasn't been published for 2.12.9 yet.


/**
 * Copyright (C) 2011 Orbeon, Inc.
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the
 * GNU Lesser General Public License as published by the Free Software Foundation; either version
 * 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
 */
package org.orbeon.oxf.xforms.event.events

import org.orbeon.oxf.xforms.XFormsContainingDocument
import org.orbeon.oxf.xforms.event.{XFormsEventTarget, XFormsEvents, XFormsEvent}
import org.orbeon.saxon.om.NodeInfo

class XXFormsValueChanged(containingDocument: XFormsContainingDocument, targetObject: XFormsEventTarget,
                          val node: NodeInfo, val oldValue: String, val newValue: String)
    extends XFormsEvent(containingDocument, XFormsEvents.XXFORMS_VALUE_CHANGED, targetObject, true, true)

/**
 * Copyright (C) 2011 Orbeon, Inc.
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the
 * GNU Lesser General Public License as published by the Free Software Foundation; either version
 * 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 *
 * The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
 */
package org.orbeon.oxf.xforms.event.events

import org.orbeon.oxf.xforms.XFormsContainingDocument
import org.orbeon.oxf.xforms.event.{XFormsEventTarget, XFormsEvents, XFormsEvent}
import org.orbeon.saxon.om.{SingletonIterator, NodeInfo}
import org.orbeon.saxon.value.StringValue

class XXFormsValueChanged(containingDocument: XFormsContainingDocument, targetObject: XFormsEventTarget,
                          val node: NodeInfo, val oldValue: String, val newValue: String)
    extends XFormsEvent(containingDocument, XFormsEvents.XXFORMS_VALUE_CHANGED, targetObject, true, true) {

    override def getAttribute(name: String) = name match {
        case "node" ⇒ SingletonIterator.makeIterator(node)
        case "old-value" ⇒ SingletonIterator.makeIterator(StringValue.makeStringValue(oldValue))
        case "new-value" ⇒ SingletonIterator.makeIterator(StringValue.makeStringValue(newValue))
        case other ⇒ super.getAttribute(other)
    }
}

Add event context information for xxforms-value-changed


// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.0")

// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.1")

Upgrade Play from 2.1.0 to 2.1.1.

Upgrade Play from 2.1.0 to 2.1.1.


import play.PlayScala

scalaVersion := "2.10.4"

name := "play-silhouette-seed"

version := "1.0"

libraryDependencies ++= Seq(
  "com.mohiva" %% "play-silhouette" % "1.0",
  "org.webjars" %% "webjars-play" % "2.3.0",
  "org.webjars" % "bootstrap" % "3.1.1",
  "org.webjars" % "jquery" % "1.11.0",
  "net.codingwell" %% "scala-guice" % "4.0.0-beta4",
  "com.typesafe.play" %% "play-slick" % "0.7.0-M1",
  "mysql" % "mysql-connector-java" % "5.1.18",
  cache
)

lazy val root = (project in file(".")).enablePlugins(PlayScala)

import play.PlayScala

name := "play-silhouette-seed"

version := "1.0"

libraryDependencies ++= Seq(
  "com.mohiva" %% "play-silhouette" % "1.0",
  "org.webjars" %% "webjars-play" % "2.3.0",
  "org.webjars" % "bootstrap" % "3.1.1",
  "org.webjars" % "jquery" % "1.11.0",
  "net.codingwell" %% "scala-guice" % "4.0.0-beta4",
  "com.typesafe.play" %% "play-slick" % "0.8.0-M1",
  "mysql" % "mysql-connector-java" % "5.1.18",
  cache
)

lazy val root = (project in file(".")).enablePlugins(PlayScala)

Update play-slick to 0.8.0-M1 and scalaVersion to default (2.11)


/* Copyright 2009-2015 EPFL, Lausanne */

import leon.lang._

object MyMap {

  def map1(): Int = {
    val m = Map(1 -> 2, 2 -> 3, 3 -> 4)
    m(2)
  } ensuring(_ == 3)

  def map2(): Boolean = {
    val m1 = Map[Int, Int]()
    val m2 = Map.empty[Int, Int]
    m1 == m2
  }.holds

}

/* Copyright 2009-2015 EPFL, Lausanne */

import leon.lang._

object MyMap {

  def map1(): Int = {
    val m = Map(1 -> 2, 2 -> 3, 3 -> 4)
    m(2)
  } ensuring(_ == 3)

  // Empty maps are not well supported in CVC4, because of lack of quantifiers
  //def map2(): Boolean = {
  //  val m1 = Map[Int, Int]()
  //  val m2 = Map.empty[Int, Int]
  //  m1 == m2
  //}.holds

}

Remove test that was not really passing solver checks


sbtPlugin := true

name := "sbt-dotenv"
organization := "au.com.onegeek"

description := "An sbt plugin to load environment variables from .env into the JVM System Environment for local development. Assists with 'Twelve Factor App' development principle 3 'Store config in the environment'."

scalaVersion := "2.12.8"

libraryDependencies ++= Seq(
    "net.java.dev.jna" % "jna" % "5.5.0",
    "org.scalatest" %% "scalatest" % "3.1.2" % Test
)

enablePlugins(ScriptedPlugin)
scriptedLaunchOpts := { scriptedLaunchOpts.value ++
  Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
}
scriptedBufferLog := false

publishMavenStyle := false

bintrayOrganization := None
bintrayRepository := "sbt-plugins"

licenses += ("MIT", url("http://opensource.org/licenses/MIT"))

sbtPlugin := true

name := "sbt-dotenv"
organization := "au.com.onegeek"

description := "An sbt plugin to load environment variables from .env into the JVM System Environment for local development. Assists with 'Twelve Factor App' development principle 3 'Store config in the environment'."

scalaVersion := "2.12.8"

libraryDependencies ++= Seq(
    "net.java.dev.jna" % "jna" % "5.5.0",
    "org.scalatest" %% "scalatest" % "3.1.2" % Test
)

enablePlugins(ScriptedPlugin)

scriptedLaunchOpts := {
    if (System.getProperty("java.version").startsWith("1.")) {
        scriptedLaunchOpts.value ++ Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
    }
    else {
        scriptedLaunchOpts.value ++ Seq("--illegal-access=deny", "--add-opens", "java.base/java.util=ALL-UNNAMED", "--add-opens", "java.base/java.lang=ALL-UNNAMED", "-Xmx1024M", "-Dplugin.version=" + version.value)
    }
}

scriptedBufferLog := false

publishMavenStyle := false

bintrayOrganization := None
bintrayRepository := "sbt-plugins"

licenses += ("MIT", url("http://opensource.org/licenses/MIT"))

Add extra parameters to scriptedLaunchOpts for java 9 and up

to avoid "illegal reflective access" warnings


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.3" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}
version := "0.1.10"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.3" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}
version := "0.1.11"

autocommit: Update configuration to record version 0.1.11


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.3.14"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      filters,
      "com.jason-goodwin" %% "authentikat-jwt" % "0.4.3",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    ),
    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
    resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
    resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/",
    credentials += Credentials(
      "Artifactory Realm",
      "flow.artifactoryonline.com",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
)

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.3.15"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      filters,
      "com.jason-goodwin" %% "authentikat-jwt" % "0.4.3",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    ),
    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
    resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
    resolvers += "Artifactory" at "https://flow.artifactoryonline.com/flow/libs-release/",
    credentials += Credentials(
      "Artifactory Realm",
      "flow.artifactoryonline.com",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
)

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.3.15


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.1.2"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      "com.jason-goodwin" %% "authentikat-jwt" % "0.4.1",
      "org.scalatest" %% "scalatest" % "2.2.6" % "test",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    )
)

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.1.3"

lazy val root = project
  .in(file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      ws,
      "com.jason-goodwin" %% "authentikat-jwt" % "0.4.1",
      "org.scalatest" %% "scalatest" % "2.2.6" % "test",
      "org.scalatestplus" %% "play" % "1.4.0" % "test"
    )
)

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

autocommit: Update configuration to record version 0.1.3


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

crossScalaVersions := Seq("2.12.6", "2.11.12", "2.10.6")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

version := "0.1.84"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

crossScalaVersions := Seq("2.12.6", "2.11.12", "2.10.6")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    )
  )

publishTo := {
  val host = "https://flow.artifactoryonline.com/flow"
  if (isSnapshot.value) {
    Some("Artifactory Realm" at s"$host/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)
  } else {
    Some("Artifactory Realm" at s"$host/libs-release-local")
  }
}

version := "0.1.85"

autocommit: Update configuration to record version 0.1.85


package org.jetbrains.plugins.cbt.project.template

import javax.swing.Icon

import com.intellij.openapi.ui.ValidationInfo
import com.intellij.platform.ProjectTemplate
import org.jetbrains.plugins.cbt.CBT

class CbtProjectTemplate extends ProjectTemplate {
  override def getName: String = "CBT"

  override def getDescription: String = "CBT-based Scala project"

  override def getIcon: Icon = CBT.Icon

  override def createModuleBuilder(): CbtModuleBuilder = new CbtModuleBuilder()

  override def validateSettings(): ValidationInfo = null
}

package org.jetbrains.plugins.cbt.project.template

import javax.swing.Icon

import com.intellij.openapi.ui.ValidationInfo
import com.intellij.platform.ProjectTemplate
import org.jetbrains.plugins.cbt.CBT

class CbtProjectTemplate extends ProjectTemplate {
  override def getName: String = "CBT"

  override def getDescription: String =
    """CBT-based Scala project.

      | More information about CBT can be found here""".stripMargin

  override def getIcon: Icon = CBT.Icon

  override def createModuleBuilder(): CbtModuleBuilder = new CbtModuleBuilder()

  override def validateSettings(): ValidationInfo = null
}

Add link to CBT doc in a new CBT project description


addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.28")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29")

Update sbt-scalajs, scalajs-compiler, ... to 0.6.29


lazy val verifyDeps = taskKey[Unit]("verify inherited dependencies are properly extracted")

verifyDeps := {
	val a = compile.in(Compile).value
	same(a.relations.publicInherited.internal.forwardMap, expectedDeps.forwardMap)
}

lazy val expected = Seq(
	"A" -> Seq("C", "D", "E", "G", "J"),
	"B" -> Seq(),
	"C" -> Seq("D", "G", "J"),
	"D" -> Seq("G", "J"),
	"E" -> Seq(),
	"F" -> Seq("C", "D", "G", "J"),
	"G" -> Seq("J"),
	"J" -> Seq()
)
lazy val pairs =
	expected.map { case (from,tos) =>
		(toFile(from), tos.map(toFile))
	}
lazy val expectedDeps = (Relation.empty[File,File] /: pairs) { case (r, (x,ys)) => r + (x,ys) }
def toFile(s: String) = file(s + ".scala").getAbsoluteFile

def same[T](x: T, y: T) {
	assert(x == y, s"\nActual: $x, \nExpected: $y")
}

lazy val verifyDeps = taskKey[Unit]("verify inherited dependencies are properly extracted")

verifyDeps := {
	val a = compile.in(Compile).value
	val baseDir = baseDirectory.value
	def relative(f: java.io.File): java.io.File =  f.relativeTo(baseDir) getOrElse f
	def toFile(s: String) = relative(baseDir / (s + ".scala"))
	def inheritedDeps(name: String): Set[File] = {
		val file = (baseDir / (name + ".scala")).getAbsoluteFile
		val absoluteFiles = a.relations.publicInherited.internal.forward(file)
		absoluteFiles.map(relative)
	}
	val ADeps = Set("C", "D", "E", "G", "J").map(toFile)
	same(inheritedDeps("A"), ADeps)
	val BDeps = Set.empty[File]
	same(inheritedDeps("B"), BDeps)
	val CDeps = Set("D", "G", "J").map(toFile)
	same(inheritedDeps("C"), CDeps)
	val DDeps = Set("G", "J").map(toFile)
	same(inheritedDeps("D"), DDeps)
	val EDeps = Set.empty[File]
	same(inheritedDeps("E"), EDeps)
	val FDeps = Set("C", "D", "G", "J").map(toFile)
	same(inheritedDeps("F"), FDeps)
	val GDeps = Set("J").map(toFile)
	same(inheritedDeps("G"), GDeps)
	val JDeps = Set.empty[File]
	same(inheritedDeps("J"), JDeps)
}

def same[T](x: T, y: T) {
	assert(x == y, s"\nActual: $x, \nExpected: $y")
}

Improve failure message in `inherited-dependencies` test.

When the `source-dependencies/inherited-dependencies` test fails we
get a dump of a big collection of all dependencies with absolute
file paths printed. This is not very readable when one needs to
understand the actual difference.

I decided to test dependencies of each source file separately. This way
when assertion exception is thrown we get a stack trace that points
us at the line which tested dependencies of a specific source file.
Also, all files are relative to baseDirectory of the project.


package services.assessmentcentre

import repositories.assessmentcentre.AssessmentEventsRepository
import services.BaseServiceSpec

import scala.concurrent.Future

/**
  * Created by fayimora on 08/06/2017.
  */
class AssessmentCentreParsingServiceSpec extends BaseServiceSpec {
  "processCentres" must {
    "successfully save the file contents" in new TestFixture {
      val events = service.processCentres().futureValue
      events.size mustBe 2
      // TODO: Don't stop here!
    }
  }

  trait TestFixture {
    val mockAssessmentCentreRepository = mock[AssessmentEventsRepository]
    val service = new AssessmentCentreParsingService {
      val fileContents = Future.successful(List(
        "FSAC,London,London (Euston Tower),03/04/17,09:00,12:00,36,4,5,6,1,1,1,1,2",
        "SDIP telephone interview,London,London (Euston Tower),04/04/17,08:00,13:30,36,24,7,,,,,,"
      ))

      val assessmentCentreRepository = mockAssessmentCentreRepository
    }
  }
}

package services.assessmentcentre

import repositories.assessmentcentre.AssessmentEventsRepository
import services.BaseServiceSpec

import scala.concurrent.Future

/**
  * Created by fayimora on 08/06/2017.
  */
class AssessmentCentreParsingServiceSpec extends BaseServiceSpec {
  "processCentres" must {
    "successfully saves and loads the file contents" in new TestFixture {
      val events = service.processCentres().futureValue

      events.size mustBe 2
      events.head.eventType mustBe "FSAC"
      events(1).skillRequirements.getOrElse("QUALITY_ASSURANCE_COORDINATOR", "--") mustBe 0
    }
  }

  trait TestFixture {
    val mockAssessmentCentreRepository = mock[AssessmentEventsRepository]
    val service = new AssessmentCentreParsingService {
      val fileContents = Future.successful(List(
        "FSAC,London,London (Euston Tower),03/04/17,09:00,12:00,36,4,5,6,1,1,1,1,2",
        "SDIP telephone interview,London,London (Euston Tower),04/04/17,08:00,13:30,36,24,7,,,,,,"
      ))

      val assessmentCentreRepository = mockAssessmentCentreRepository
    }
  }
}

Add more matchers to the parsing service spec


package scalex
package db

import model.Def

import com.mongodb.casbah.Imports._
import com.mongodb.casbah.MongoCollection
import com.novus.salat._
import com.novus.salat.global._
import com.novus.salat.dao._

class DefRepo(collection: MongoCollection) extends SalatDAO[Def, ObjectId](collection) {

  def batchInsert(objs: List[Def]) { collection insert (objs map _grater.asDBObject) }

  def byIds(ids: Seq[String]): List[Def] = find("_id" $in ids).toList

  def removePack(pack: String) {
    collection remove MongoDBObject("pack" -> pack)
  }

  def findAll: List[Def] = find(MongoDBObject()).toList
}

package scalex
package db

import model.Def

import com.mongodb.casbah.Imports._
import com.mongodb.casbah.MongoCollection
import com.novus.salat._
import com.novus.salat.global._
import com.novus.salat.dao._

class DefRepo(collection: MongoCollection) extends SalatDAO[Def, ObjectId](collection) {

  def batchInsert(objs: List[Def]) { collection insert (objs map _grater.asDBObject) }

  def byIds(ids: Seq[String]): List[Def] = {
    val defs = find("_id" $in ids) toList
    val sorted = ids map { id => defs.find(_.id == id) }
    sorted.flatten.toList
  }

  def removePack(pack: String) {
    collection remove MongoDBObject("pack" -> pack)
  }

  def findAll: List[Def] = find(MongoDBObject()).toList
}

Sort mongodb results by ID

Sort mongodb results by ID


package hyperion

import akka.actor.{Extension, ExtendedActorSystem, ExtensionKey}

/**
  * Provides convenient access to the settings in application.conf.
  */
object Settings extends ExtensionKey[Settings]

class Settings(system: ExtendedActorSystem) extends Extension {
  private val hyperion = system.settings.config getConfig "hyperion"

  object meter {
    val serialPort: String = hyperion getString "meter.serial-port"
    val baudRate: Int      = hyperion getInt    "meter.baud-rate"
    val characterSize: Int = hyperion getInt    "meter.character-size"
    val stopBits: Int      = hyperion getInt    "meter.stop-bits"
    val parity: String     = hyperion getString "meter.parity"
  }
}

package hyperion

import akka.actor.{Actor, Extension, ExtendedActorSystem, ExtensionKey}

/**
  * Provides convenient access to the settings in application.conf.
  */
object Settings extends ExtensionKey[Settings]

class Settings(system: ExtendedActorSystem) extends Extension {
  private val hyperion = system.settings.config getConfig "hyperion"

  object meter {
    val serialPort: String = hyperion getString "meter.serial-port"
    val baudRate: Int      = hyperion getInt    "meter.baud-rate"
    val characterSize: Int = hyperion getInt    "meter.character-size"
    val stopBits: Int      = hyperion getInt    "meter.stop-bits"
    val parity: String     = hyperion getString "meter.parity"
  }
}

trait SettingsActor {
  this: Actor =>

  val settings: Settings = Settings(context.system)
}

Allow the settings to be mixed in

Allow the settings to be mixed in


import sbt._
import sbt.Keys._
import wartremover.WartRemover.autoImport._
import wartremover.Wart

object CodeAnalysis {

  lazy val disable = Seq(
    wartremoverErrors in (Compile, compile) := Seq.empty,
    wartremoverErrors in (Test, compile) := Seq.empty
  )

  lazy val settings = Seq(
    wartremoverErrors in (Compile, compile) := Warts.allBut(disabledWarts: _*),
    wartremoverErrors in (Test, compile) := (wartremoverErrors in (Compile, compile)).value
  )

  private def disabledWarts: List[Wart] =
    List(
      Wart.AsInstanceOf,
      Wart.Any,
      Wart.Equals,
      Wart.ImplicitConversion,
      Wart.ImplicitParameter,
      Wart.JavaSerializable,
      Wart.MutableDataStructures,
      Wart.NonUnitStatements,
      Wart.Nothing,
      Wart.Null,
      Wart.Overloading,
      Wart.OptionPartial, // Generated by boopickle macros
      Wart.Throw,
      Wart.ToString,
      Wart.TraversableOps,
      Wart.Var,
      Wart.While
    )
}

import sbt._
import sbt.Keys._
import wartremover.WartRemover.autoImport._
import wartremover.Wart

object CodeAnalysis {

  lazy val disable = Seq(
    wartremoverErrors in (Compile, compile) := Seq.empty,
    wartremoverErrors in (Test, compile) := Seq.empty
  )

  lazy val settings = Seq(
    wartremoverErrors in (Compile, compile) := Warts.allBut(disabledWarts: _*),
    wartremoverErrors in (Test, compile) := (wartremoverErrors in (Compile, compile)).value
  )

  private def disabledWarts: List[Wart] =
    List(
      Wart.AsInstanceOf,
      Wart.Any,
      Wart.Equals,
      Wart.ImplicitConversion,
      Wart.ImplicitParameter,
      Wart.JavaSerializable,
      Wart.MutableDataStructures,
      Wart.NonUnitStatements,
      Wart.Nothing,
      Wart.Null,
      Wart.Overloading,
      Wart.OptionPartial, // Generated by boopickle macros
      Wart.StringPlusAny, // see https://github.com/wartremover/wartremover/issues/447
      Wart.Throw,
      Wart.ToString,
      Wart.TraversableOps,
      Wart.Var,
      Wart.While
    )
}

Disable buggy wartremover StringPlusAny that messes up String interpolation


package lib

import org.joda.time.DateTime
import org.joda.time.format.ISODateTimeFormat.dateTime

case class ResolvedToken(
  requestId: String,
  userId: Option[String] = None,
  environment: Option[String] = None,
  organizationId: Option[String] = None,
  partnerId: Option[String] = None,
  role: Option[String] = None,
  sessionId: Option[String] = None
) {

  private[lib] val createdAt = DateTime.now

  def toMap: Map[String, String] = {
    Map(
      "request_id" -> Some(requestId),
      "user_id" -> userId,
      "created_at" -> Some(dateTime.print(createdAt)),
      "session_id" -> sessionId,
      "organization" -> organizationId,
      "partner" -> partnerId,
      "role" -> role,
      "environment" -> environment
    ).flatMap { case (key, value) => value.map { v => key -> v } }
  }

}

package lib

import org.joda.time.DateTime
import org.joda.time.format.ISODateTimeFormat.dateTime

case class ResolvedToken(
  requestId: String,
  userId: Option[String] = None,
  environment: Option[String] = None,
  organizationId: Option[String] = None,
  partnerId: Option[String] = None,
  role: Option[String] = None,
  sessionId: Option[String] = None
) {

  private[lib] val createdAt = DateTime.now

  def toMap: Map[String, String] = {
    Map(
      "request_id" -> Some(requestId),
      "user_id" -> userId,
      "created_at" -> Some(dateTime.print(createdAt)),
      "session" -> sessionId,
      "organization" -> organizationId,
      "partner" -> partnerId,
      "role" -> role,
      "environment" -> environment
    ).flatMap { case (key, value) => value.map { v => key -> v } }
  }

}

Rename 'session_id' in jwt map to 'session' to parallel org/partner


package de.unifreiburg.cs.proglang.jgs.sparta

/**
  * A model for SPARTA type annotations. http://types.cs.washington.edu/sparta/current/sparta-manual.html#flow-checker
  */
object Annotations {

  // SPARTA type annotations consist of source permission and sink permissions
  //   - source permissions specify what may flow into a variable/field
  //   - sink permissions specify where the information in a variable/field may flow
  sealed case class Type(source : Permissions, sink : Permissions)

  // Permissions are either ANY or a set of explicit PermissionS
  sealed trait Permissions
  sealed case object Any extends Permissions
  sealed case class PermSet(perms : Set[Permission])

  // An explicit permission consists of a name and a list of parameters
  sealed case class Permission(name : String , params : Seq[String])

  // SPARTA signatures specify potentially polymorphic return- and parameter-types
  sealed case class Signature(returnType : SigType,
                              paramTypes : Seq[SigType])

  // The types for signatures, analogous to `Type`
  sealed case class SigType(source : SigPermissions, sink : SigPermissions)

  // Permissions in signatures can be polymorphic, polymorphic wrt the receiver, or regular permissions
  sealed trait SigPermissions
  sealed case object Poly extends SigPermissions
  sealed case object PolyR extends SigPermissions
  sealed case class Mono(permissions : Permissions) extends SigPermissions

}

package de.unifreiburg.cs.proglang.jgs.sparta

/**
  * A model for SPARTA type annotations. http://types.cs.washington.edu/sparta/current/sparta-manual.html#flow-checker
  */
object Annotations {

  // SPARTA type annotations consist of source permission and sink permissions
  //   - source permissions specify what may flow into a variable/field
  //   - sink permissions specify where the information in a variable/field may flow
  sealed case class Type(source : Permissions, sink : Permissions)

  // Permissions are either ANY or a set of explicit PermissionS
  sealed trait Permissions
  sealed case object Any extends Permissions
  sealed case class PermSet(perms : Set[Permission])

  // An explicit permission consists of a name and a list of parameters
  sealed case class Permission(name : String , params : Seq[String])

  // SPARTA signatures specify potentially polymorphic return- and parameter-types
  sealed case class Signature(returnType : SigType,
                              paramTypes : Seq[SigType])

  // The types for signatures, analogous to `Type`
  sealed case class SigType(source : SigPermissions, sink : SigPermissions)

  // Permissions in signatures can be polymorphic, polymorphic wrt the receiver, or regular permissions
  sealed trait SigPermissions
  sealed case object Poly extends SigPermissions
  sealed case object PolyR extends SigPermissions
  sealed case class Mono(permissions : Permissions) extends SigPermissions

  // Policies are a set of edges between Permissions. They are interpreted intransitively.
  class Policy(edges : Set[(Permission, Permission)]) {

    def allowsFlow(p1 : Permission, p2 : Permission) = edges.contains(p1 -> p2)

  }

}

Add policies to sparta annotation modelling


// Shows that now implicit parameters act as a tie-breaker.
// The alternative with fewer implicit parameters wins.
case class Show[T](val i: Int)

class Generic
object Generic {
  implicit val gen: Generic = new Generic
  implicit def showGen[T](implicit gen: Generic): Show[T] = new Show[T](2)
}

object Test extends App {
  trait Context
  implied ctx for Context

  object a {
    def foo[T](implicit gen: Generic): Show[T] = new Show[T](1)
    def foo[T](implicit gen: Generic, ctx: Context): Show[T] = new Show[T](2)
  }
  object b {
    def foo[T](implicit gen: Generic): Show[T] = new Show[T](1)
    def foo[T]: Show[T] = new Show[T](2)
  }

  assert(a.foo[Int].i == 1)
  assert(b.foo[Int].i == 2)

}

// Shows that now implicit parameters act as a tie-breaker.
// The alternative with fewer implicit parameters wins.
case class Show[T](val i: Int)

class Generic
object Generic {
  implicit val gen: Generic = new Generic
  implicit def showGen[T](implicit gen: Generic): Show[T] = new Show[T](2)
}

object Test extends App {
  trait Context
  implied ctx for Context

  object a {
    def foo[T](implicit gen: Generic): Show[T] = new Show[T](1)
    def foo[T](implicit gen: Generic, ctx: Context): Show[T] = new Show[T](2)
  }
  object b {
    def foo[T](implicit gen: Generic): Show[T] = new Show[T](1)
    def foo[T]: Show[T] = new Show[T](2)
  }

  assert(a.foo[Int].i == 1)
  assert(b.foo[Int].i == 2)

  def f: Int = 1
  def f(x: Int): Int = x

  val x = f
  val x1: Int = x
}

Add test to show that rule is in line with normal overloading resolution


/*
 * Copyright (C) 2020 MapRoulette contributors (see CONTRIBUTORS.md).
 * Licensed under the Apache License, Version 2.0 (see LICENSE).
 */

package org.maproulette.framework.util

import play.api.db.Database
import play.api.db.evolutions.Evolutions
import play.api.inject.guice.GuiceApplicationBuilder

/**
  * A little helper class to create and drop test tables
  *
  * @author mcuthbert
  */
trait TestDatabase {
  implicit val application = GuiceApplicationBuilder()
    .configure(
      "db.default.url"                 -> "jdbc:postgresql://localhost:5432/mr_test",
      "db.default.username"            -> "osm",
      "db.default.password"            -> "osm",
      "db.default.logSql"              -> false,
      "maproulette.osm.consumerKey"    -> "test",
      "maproulette.osm.consumerSecret" -> "test",
      "maproulette.bootstrap"          -> true
    )
    .build()
  implicit val database = this.application.injector.instanceOf(classOf[Database])

  def applyEvolutions(): Unit = {
    Evolutions.cleanupEvolutions(database)
    Evolutions.applyEvolutions(database)
  }

  def cleanupEvolutions(): Unit = Evolutions.cleanupEvolutions(database)
}

/*
 * Copyright (C) 2020 MapRoulette contributors (see CONTRIBUTORS.md).
 * Licensed under the Apache License, Version 2.0 (see LICENSE).
 */

package org.maproulette.framework.util

import play.api.db.Database
import play.api.db.evolutions.Evolutions
import play.api.inject.guice.GuiceApplicationBuilder
import scala.util.Properties

/**
  * A little helper class to create and drop test tables
  *
  * @author mcuthbert
  */
trait TestDatabase {
  implicit val application = GuiceApplicationBuilder()
    .configure(
      "db.default.url"                 -> s"jdbc:postgresql://${Properties.envOrElse("MR_TEST_DB_HOST", "localhost")}:${Properties.envOrElse("MR_TEST_DB_PORT", "5432")}/${Properties.envOrElse("MR_TEST_DB_NAME", "mr_test")}",
      "db.default.username"            -> s"${Properties.envOrElse("MR_TEST_DB_USER", "osm")}",
      "db.default.password"            -> s"${Properties.envOrElse("MR_TEST_DB_PASSWORD", "osm")}",
      "db.default.logSql"              -> false,
      "maproulette.osm.consumerKey"    -> "test",
      "maproulette.osm.consumerSecret" -> "test",
      "maproulette.bootstrap"          -> true
    )
    .build()
  implicit val database = this.application.injector.instanceOf(classOf[Database])

  def applyEvolutions(): Unit = {
    Evolutions.cleanupEvolutions(database)
    Evolutions.applyEvolutions(database)
  }

  def cleanupEvolutions(): Unit = Evolutions.cleanupEvolutions(database)
}

Support customization of test database location and credentials via `MR_TEST_DB_{HOST,NAME,PASSWORD,PORT,USER}` environment variables.


package cpup.mc.lib.util.pos

import net.minecraft.world.World
import net.minecraft.block.Block
import cpup.mc.lib.util.Direction

case class BlockPos(world: World, x: Int, y: Int, z: Int) {
	def setBlock(block: Block) = {
		world.setBlock(x, y, z, block)

		this
	}

	def setMetadata(meta: Int, notify: Int) = {
		world.setBlockMetadataWithNotify(x, y, z, meta, notify)

		this
	}

	def block = world.getBlock(x, y, z)
	def metadata = world.getBlockMetadata(x, y, z)
	def tileEntity = world.getTileEntity(x, y, z)

	def offset(offsetX: Int, offsetY: Int, offsetZ: Int) = BlockPos(world, x + offsetX, y + offsetY, z + offsetZ)
	def offset(dir: Direction, dist: Int = 1): BlockPos = offset(dir.forgeDir.offsetX * dist, dir.forgeDir.offsetY * dist, dir.forgeDir.offsetZ * dist)

	def isAir = block.isAir(world, x, y, z)
	def isReplaceable = block.isReplaceable(world, x, y, z)
}

package cpup.mc.lib.util.pos

import net.minecraft.world.World
import net.minecraft.block.Block
import cpup.mc.lib.util.Direction
import net.minecraft.tileentity.TileEntity

case class BlockPos(world: World, x: Int, y: Int, z: Int) {
	def setBlock(block: Block) = {
		world.setBlock(x, y, z, block)

		this
	}

	def setMetadata(meta: Int, notify: Int) = {
		world.setBlockMetadataWithNotify(x, y, z, meta, notify)

		this
	}

	def setTileEntity(te: TileEntity) = {
		world.setTileEntity(x, y, z, te)

		this
	}

	def block = world.getBlock(x, y, z)
	def metadata = world.getBlockMetadata(x, y, z)
	def tileEntity = world.getTileEntity(x, y, z)
	def tileEntity_=(newTE: TileEntity) = {
		setTileEntity(newTE)
		newTE
	}

	def offset(offsetX: Int, offsetY: Int, offsetZ: Int) = BlockPos(world, x + offsetX, y + offsetY, z + offsetZ)
	def offset(dir: Direction, dist: Int = 1): BlockPos = offset(dir.forgeDir.offsetX * dist, dir.forgeDir.offsetY * dist, dir.forgeDir.offsetZ * dist)

	def isAir = block.isAir(world, x, y, z)
	def isReplaceable = block.isReplaceable(world, x, y, z)
}

Add the ability to set the tile entity

Add the ability to set the tile entity


addSbtPlugin(("com.typesafe.sbt" % "sbt-pgp" % "0.7").cross(CrossVersion.full))

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")

addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.6")

addSbtPlugin(("com.typesafe.sbt" % "sbt-pgp" % "0.7").cross(CrossVersion.full))

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")

addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.7")

Update release plugin with cross support.


libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.2.0"

addSbtPlugin("org.scala-js"  % "sbt-scalajs"         % "0.6.27")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.10.0")
addSbtPlugin("com.jsuereth"  % "sbt-pgp"             % "1.1.2")

libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.2.0"

addSbtPlugin("org.scala-js"  % "sbt-scalajs"         % "0.6.28")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.10.0")
addSbtPlugin("com.jsuereth"  % "sbt-pgp"             % "1.1.2")

Update sbt-scalajs, scalajs-compiler to 0.6.28


libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.11"

// https://github.com/coursier/coursier/issues/450
classpathTypes += "maven-plugin"

addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.2.4")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.10.0")
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.14.7")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.5")

libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.11"

// https://github.com/coursier/coursier/issues/450
classpathTypes += "maven-plugin"

addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.2.4")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.10.0")
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.14.7")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.6")

Update sbt-scoverage to 2.0.6 in series/0.23


resolvers ++= Seq(
  Classpaths.sbtPluginReleases,
  Resolver.sonatypeRepo("releases"),
  Resolver.bintrayIvyRepo("jetbrains", "sbt-plugins")
)

addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.12")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.5")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.0")

resolvers ++= Seq(
  Classpaths.sbtPluginReleases,
  Resolver.sonatypeRepo("releases"),
  Resolver.bintrayIvyRepo("jetbrains", "sbt-plugins")
)

addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.14")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.5")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.0")

Update mdoc, sbt-mdoc to 2.2.14

Update mdoc, sbt-mdoc to 2.2.14


addSbtPlugin("com.47deg" % "sbt-microsites" % "0.7.23")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.9")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.2")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.26")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.8")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")

addSbtPlugin("com.47deg" % "sbt-microsites" % "0.7.23")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.9")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.2")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.27")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.8")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")

Update sbt-scalajs, scalajs-compiler to 0.6.27


resolvers ++= Seq(
    DefaultMavenRepository,
    Resolver.url("Play", url("http://download.playframework.org/ivy-releases/"))(Resolver.ivyStylePatterns),
    "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
    Resolver.url("sbt-plugin-releases",url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
)

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0-RC1")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.2.5")

resolvers ++= Seq(
    DefaultMavenRepository,
    Resolver.url("Play", url("http://download.playframework.org/ivy-releases/"))(Resolver.ivyStylePatterns),
    "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
    Resolver.url("sbt-plugin-releases",url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)
)

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0-RC1")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.6.2")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.2.5")

Upgrade native-packager to avoid bug

Upgrade native-packager to avoid bug


libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.2.0"

addSbtPlugin("org.scala-js"  % "sbt-scalajs"         % "0.6.26")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.10.0")
addSbtPlugin("com.jsuereth"  % "sbt-pgp"             % "1.1.0")

libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.2.0"

addSbtPlugin("org.scala-js"  % "sbt-scalajs"         % "0.6.27")
addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.10.0")
addSbtPlugin("com.jsuereth"  % "sbt-pgp"             % "1.1.0")


scalacOptions += "-deprecation"
libraryDependencies += "org.slf4j" % "slf4j-nop" % "1.7.30"

addSbtPlugin("com.typesafe"                      % "sbt-mima-plugin"       % "0.8.1")
addSbtPlugin("com.typesafe.sbt"                  % "sbt-osgi"              % "0.9.6")
addSbtPlugin("com.eed3si9n"                      % "sbt-buildinfo"         % "0.10.0")
addSbtPlugin("com.geirsson"                      % "sbt-ci-release"        % "1.5.7")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings"      % "3.0.0")
addSbtPlugin("org.scoverage"                     % "sbt-scoverage"         % "1.6.1")
addSbtPlugin("org.scala-js"                      % "sbt-scalajs"           % "1.5.0")
addSbtPlugin("org.scala-native"                  % "sbt-scala-native"      % "0.4.0")
addSbtPlugin("org.portable-scala"                % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.portable-scala"                % "sbt-scala-native-crossproject" % "1.0.0")
addSbtPlugin("com.codecommit"                    % "sbt-github-actions"    % "0.10.1")

scalacOptions += "-deprecation"
libraryDependencies += "org.slf4j" % "slf4j-nop" % "1.7.30"

addSbtPlugin("com.typesafe"                      % "sbt-mima-plugin"       % "0.8.1")
addSbtPlugin("com.typesafe.sbt"                  % "sbt-osgi"              % "0.9.6")
addSbtPlugin("com.eed3si9n"                      % "sbt-buildinfo"         % "0.10.0")
addSbtPlugin("com.geirsson"                      % "sbt-ci-release"        % "1.5.7")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings"      % "3.0.0")
addSbtPlugin("org.scoverage"                     % "sbt-scoverage"         % "1.6.1")
addSbtPlugin("org.scala-js"                      % "sbt-scalajs"           % "1.5.1")
addSbtPlugin("org.scala-native"                  % "sbt-scala-native"      % "0.4.0")
addSbtPlugin("org.portable-scala"                % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.portable-scala"                % "sbt-scala-native-crossproject" % "1.0.0")
addSbtPlugin("com.codecommit"                    % "sbt-github-actions"    % "0.10.1")

Update sbt-scalajs, scalajs-compiler, ... to 1.5.1


package com.earldouglas.xwp

import sbt._
import sbt.Keys._
import sbt.internal.io.Source
import sbt.util.CacheStoreFactory
import FileInfo.Style
import WebappPlugin.autoImport.webappPrepare

object Compat {

  type Process = scala.sys.process.Process

  def forkOptionsWithRunJVMOptions(options: Seq[String]) =
    ForkOptions().withRunJVMOptions(options.toVector)

  val watchSourceSetting = watchSources += new Source((sourceDirectory in webappPrepare).value, "*", AllPassFilter)

  def cached(cacheBaseDirectory: File, inStyle: Style, outStyle: Style)(action: (ChangeReport[File], ChangeReport[File]) => Set[File]): Set[File] => Set[File] =
    sbt.util.FileFunction.cached(CacheStoreFactory(cacheBaseDirectory), inStyle = inStyle, outStyle = outStyle)(action = action)
}

package com.earldouglas.xwp

import sbt._
import sbt.Keys._
import sbt.internal.io.Source
import sbt.util.CacheStoreFactory
import FileInfo.Style
import WebappPlugin.autoImport.webappPrepare

object Compat {

  type Process = scala.sys.process.Process

  def forkOptionsWithRunJVMOptions(options: Seq[String]) =
    ForkOptions().withRunJVMOptions(options.toVector)

  val watchSourceSetting = watchSources += new Source((sourceDirectory in webappPrepare).value, AllPassFilter, NothingFilter)

  def cached(cacheBaseDirectory: File, inStyle: Style, outStyle: Style)(action: (ChangeReport[File], ChangeReport[File]) => Set[File]): Set[File] => Set[File] =
    sbt.util.FileFunction.cached(CacheStoreFactory(cacheBaseDirectory), inStyle = inStyle, outStyle = outStyle)(action = action)
}

Fix source filters in sbt 1.0 watchSourceSetting

Fixes #355


package com.twitter.scrooge.thrift_validation
import scala.collection.JavaConverters._

object ThriftValidationException {

  /**
   *  A java compatible exception which is used to communicate when a thrift_validation
   *  has failed with the respective [[ThriftValidationViolation]]
   *
   *  @param endpoint   thrift method the invalid request tries to reach
   *  @param requestClazz  the type of request that was passed in
   *  @param validationViolations all violations collected while deserializing the thrift object
   */
  def create(
    endpoint: String,
    requestClazz: Class[_],
    validationViolations: java.util.Set[ThriftValidationViolation]
  ): ThriftValidationException =
    ThriftValidationException(endpoint, requestClazz, validationViolations.asScala.toSet)
}

/**
 *  An exception which is used to communicate when a thrift_validation
 *  has failed with the respective [[ThriftValidationViolation]]
 *  @param endpoint   thrift method the invalid request tries to reach
 *  @param requestClazz  the type of request that was passed in
 *  @param validationViolations all violations collected while deserializing the thrift object
 */

final case class ThriftValidationException(
  endpoint: String,
  requestClazz: Class[_],
  validationViolations: Set[ThriftValidationViolation])
    extends RuntimeException {

  override def getMessage: String =
    s" The validation for request ${requestClazz.getName} to endpoint $endpoint failed with messages: ${validationViolations
      .mkString(",")}"

}

package com.twitter.scrooge.thrift_validation
import scala.collection.JavaConverters._

object ThriftValidationException {

  /**
   *  A java compatible exception which is used to communicate when a thrift_validation
   *  has failed with the respective [[ThriftValidationViolation]]
   *
   *  @param endpoint   thrift method the invalid request tries to reach
   *  @param requestClazz  the type of request that was passed in
   *  @param validationViolations all violations collected while deserializing the thrift object
   */
  def create(
    endpoint: String,
    requestClazz: Class[_],
    validationViolations: java.util.Set[ThriftValidationViolation]
  ): ThriftValidationException =
    ThriftValidationException(endpoint, requestClazz, validationViolations.asScala.toSet)
}

/**
 *  An exception which is used to communicate when a thrift_validation
 *  has failed with the respective [[ThriftValidationViolation]]
 *  @param endpoint   thrift method the invalid request tries to reach
 *  @param requestClazz  the type of request that was passed in
 *  @param validationViolations all violations collected while deserializing the thrift object
 */

final case class ThriftValidationException(
  endpoint: String,
  requestClazz: Class[_],
  validationViolations: Set[ThriftValidationViolation])
    extends RuntimeException {

  override def getMessage: String =
    s""" The validation for request \"${requestClazz.getName}\" to endpoint \"$endpoint\" failed with messages: [ ${validationViolations
      .mkString(",")}]""""
}

Add ReportingFilter support for Logging

finagle/finagle-thrift: Add ReportingFilter support for Logging

Problem/Solution

Similar to how we report metrics, upon receiving a ThriftValidationsException,
log failed validations in the ReportingFilter.

JIRA Issues: CSL-11202

Differential Revision: https://phabricator.twitter.biz/D862568


package ch.usi.inf.l3.sana.ooj.ast

import ch.usi.inf.l3.sana
import sana.tiny
import sana.calcj
import sana.primj
import sana.brokenj
import sana.ooj
import brokenj.ast
import tiny.ast.{Tree, NoTree}
import Implicits._
import ooj.symbols.SymbolUtils

trait TreeUtils extends ast.TreeUtils {
  def isConstructor(tree: Tree): Boolean =
    tree.symbol.map(SymbolUtils.isConstructor(_)).getOrElse(false)
}

object TreeUtils extends TreeUtils

package ch.usi.inf.l3.sana.ooj.ast

import ch.usi.inf.l3.sana
import sana.tiny
import sana.calcj
import sana.primj
import sana.brokenj
import sana.ooj
import brokenj.ast
import tiny.ast.{Tree, NoTree, TypeUseApi}
import Implicits._
import ooj.symbols.SymbolUtils
import ooj.modifiers.Ops._
import ooj.ast.TreeExtractors._

trait TreeUtils extends ast.TreeUtils {
  def isConstructor(tree: Tree): Boolean =
    tree.symbol.map(SymbolUtils.isConstructor(_)) match {
      case Some(v)                                  => v
      case None                                     =>
        tree match {
          case mthd: MethodDefApi =>
            mthd.mods.isConstructor
          case _                  =>
            false
        }
    }

}

object TreeUtils extends TreeUtils

Fix isConstructor to actaully detect constructors


package stainless.lang

import stainless.annotation._

object StaticChecks {

  @library
  implicit class Ensuring[A](val x: A) extends AnyVal {
    def ensuring(@ghost cond: (A) => Boolean): A = x
  }

  @library
  def require(@ghost pred: Boolean): Unit = ()

  @library
  def assert(@ghost pred: Boolean): Unit = ()

}

package stainless.lang

import stainless.annotation._

object StaticChecks {

  @library
  implicit class Ensuring[A](val x: A) extends AnyVal {
    def ensuring(@ghost cond: (A) => Boolean): A = x
  }

  @library @ignore
  implicit class WhileDecorations(val u: Unit) {
    def invariant(@ghost x: Boolean): Unit = {
      require(x)
      u
    }
  }

  @library
  def require(@ghost pred: Boolean): Unit = ()

  @library
  def assert(@ghost pred: Boolean): Unit = ()

}

Add while invariant with ghost argument

Add while invariant with ghost argument


addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.0.1")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.0.0.BETA1")

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.4")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.0.1")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.0.0.BETA1")

Update assembly plugin just to stay up-to-date.


addSbtPlugin("com.47deg" % "sbt-microsites" % "0.7.23")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.9")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.2")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.25")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.8")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")

addSbtPlugin("com.47deg" % "sbt-microsites" % "0.7.23")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.9")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.2")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.26")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.8")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")

Update sbt-scalajs, scalajs-compiler, scalajs-library... to 0.6.26


addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")

// addSbtPlugin("com.typesafe.sbt" % "sbt-proguard" % "0.2.2")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")

addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.3")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")

// addSbtPlugin("com.typesafe.sbt" % "sbt-proguard" % "0.2.2")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")

addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.4")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")

Update sbt-wartremover, wartremover to 2.4.4


// Run sbt eclipse to create Eclipse project file
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")

// Run sbt gen-idea to create IntelliJ project file
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")

// Run sbt eclipse to create Eclipse project file
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.3.0")

// Run sbt gen-idea to create IntelliJ project file
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")

Use sbteclipse 2.3.0 because 2.4.0+ has a bug that ignores unmanagedClasspath


addSbtPlugin("com.lightbend.paradox"     % "sbt-paradox"             % "0.8.0")
addSbtPlugin("com.typesafe.sbt"          % "sbt-site"                % "1.4.1")
addSbtPlugin("com.typesafe.sbt"          % "sbt-ghpages"             % "0.6.3")
addSbtPlugin("com.geirsson"              % "sbt-ci-release"          % "1.5.4")
addSbtPlugin("org.scoverage"             % "sbt-scoverage"           % "1.6.1")
addSbtPlugin("com.timushev.sbt"          % "sbt-updates"             % "0.5.1")
addSbtPlugin("pl.project13.scala"        % "sbt-jmh"                 % "0.3.7")
addSbtPlugin("de.heikoseeberger"         % "sbt-header"              % "5.6.0")
addSbtPlugin("io.chrisdavenport"         % "sbt-mima-version-check"  % "0.1.2")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat"            % "0.1.14")
addSbtPlugin("org.scalameta"             % "sbt-mdoc"                % "2.2.10" )

addSbtPlugin("com.lightbend.paradox"     % "sbt-paradox"             % "0.8.0")
addSbtPlugin("com.typesafe.sbt"          % "sbt-site"                % "1.4.1")
addSbtPlugin("com.typesafe.sbt"          % "sbt-ghpages"             % "0.6.3")
addSbtPlugin("com.geirsson"              % "sbt-ci-release"          % "1.5.4")
addSbtPlugin("org.scoverage"             % "sbt-scoverage"           % "1.6.1")
addSbtPlugin("com.timushev.sbt"          % "sbt-updates"             % "0.5.1")
addSbtPlugin("pl.project13.scala"        % "sbt-jmh"                 % "0.3.7")
addSbtPlugin("de.heikoseeberger"         % "sbt-header"              % "5.6.0")
addSbtPlugin("io.chrisdavenport"         % "sbt-mima-version-check"  % "0.1.2")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat"            % "0.1.14")
addSbtPlugin("org.scalameta"             % "sbt-mdoc"                % "2.2.11" )

Update mdoc, sbt-mdoc to 2.2.11

Update mdoc, sbt-mdoc to 2.2.11


addSbtPlugin("com.lightbend.paradox"     % "sbt-paradox"             % "0.9.1")
addSbtPlugin("com.typesafe.sbt"          % "sbt-site"                % "1.4.1")
addSbtPlugin("com.typesafe.sbt"          % "sbt-ghpages"             % "0.6.3")
addSbtPlugin("com.geirsson"              % "sbt-ci-release"          % "1.5.5")
addSbtPlugin("org.scoverage"             % "sbt-scoverage"           % "1.6.1")
addSbtPlugin("com.timushev.sbt"          % "sbt-updates"             % "0.5.1")
addSbtPlugin("pl.project13.scala"        % "sbt-jmh"                 % "0.4.0")
addSbtPlugin("de.heikoseeberger"         % "sbt-header"              % "5.6.0")
addSbtPlugin("io.chrisdavenport"         % "sbt-mima-version-check"  % "0.1.2")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat"            % "0.1.16")
addSbtPlugin("org.scalameta"             % "sbt-mdoc"                % "2.2.16")
addSbtPlugin("ch.epfl.lamp"              % "sbt-dotty"               % "0.5.2")

addSbtPlugin("com.lightbend.paradox"     % "sbt-paradox"             % "0.9.1")
addSbtPlugin("com.typesafe.sbt"          % "sbt-site"                % "1.4.1")
addSbtPlugin("com.typesafe.sbt"          % "sbt-ghpages"             % "0.6.3")
addSbtPlugin("com.geirsson"              % "sbt-ci-release"          % "1.5.5")
addSbtPlugin("org.scoverage"             % "sbt-scoverage"           % "1.6.1")
addSbtPlugin("com.timushev.sbt"          % "sbt-updates"             % "0.5.1")
addSbtPlugin("pl.project13.scala"        % "sbt-jmh"                 % "0.4.0")
addSbtPlugin("de.heikoseeberger"         % "sbt-header"              % "5.6.0")
addSbtPlugin("io.chrisdavenport"         % "sbt-mima-version-check"  % "0.1.2")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat"            % "0.1.16")
addSbtPlugin("org.scalameta"             % "sbt-mdoc"                % "2.2.17")
addSbtPlugin("ch.epfl.lamp"              % "sbt-dotty"               % "0.5.2")

Update mdoc_2.12.12, mdoc_2.13, sbt-mdoc to 2.2.17


addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.0")
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.1")
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3")

Update play-ahc-ws, play-specs2, sbt-plugin to 2.8.1


package dotty.runtime.vc

abstract class VCPrototype {
}

abstract class VCCompanionPrototype {

}

abstract class VCArrayPrototype[T <: VCPrototype] {
  def apply(idx: Int): Object
  def update(idx: Int, el: T): Unit
  def length: Int
}

package dotty.runtime.vc

abstract class VCPrototype {
}

abstract class VCArrayPrototype[T <: VCPrototype] {
  def apply(idx: Int): Object
  def update(idx: Int, el: T): Unit
  def length: Int
}

Remove VCCompanionPrototype: it is not used.


package org.jetbrains.plugins.scala.performance.highlighting.projectHighlighting

import java.util.concurrent.TimeUnit

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
import org.jetbrains.plugins.scala.SlowTests
import org.junit.experimental.categories.Category

/**
  * Author: Svyatoslav Ilinskiy
  * Date: 10/23/15.
  */
@Category(Array(classOf[SlowTests]))
class ScalaCommunityHighlightingPerformanceTest extends PerformanceSbtProjectHighlightingTestBase {

  override protected def getExternalSystemConfigFileName: String = "build.sbt"

  override def githubUsername: String = "JetBrains"

  override def githubRepoName: String = "intellij-scala"

  override def revision: String = "493444f6465d0eddea75ac5cd5a848cc30d48ae5"

  def testPerformanceScalaCommunityScalaPsiUtil() = doTest("ScalaPsiUtil.scala", TimeUnit.SECONDS.toMillis(20))

  def testPerformanceScalaCommunityScalaAnnotator() = doTest("ScalaAnnotator.scala", TimeUnit.SECONDS.toMillis(15))

  override def doTest(path: String, timeout: Long): Unit = {
    VfsRootAccess.SHOULD_PERFORM_ACCESS_CHECK = false
    super.doTest(path, timeout)
  }
}

package org.jetbrains.plugins.scala.performance.highlighting.projectHighlighting

import java.util.concurrent.TimeUnit.SECONDS

import com.intellij.openapi.vfs.newvfs.impl.VfsRootAccess
import org.jetbrains.plugins.scala.SlowTests
import org.junit.experimental.categories.Category

/**
  * Author: Svyatoslav Ilinskiy
  * Date: 10/23/15.
  */
@Category(Array(classOf[SlowTests]))
class ScalaCommunityHighlightingPerformanceTest extends PerformanceSbtProjectHighlightingTestBase {

  override protected def getExternalSystemConfigFileName: String = "build.sbt"

  override def githubUsername: String = "JetBrains"

  override def githubRepoName: String = "intellij-scala"

  override def revision: String = "493444f6465d0eddea75ac5cd5a848cc30d48ae5"

  def testPerformanceScalaCommunityScalaPsiUtil() = doTest("ScalaPsiUtil.scala", SECONDS.toMillis(20))

  def testPerformanceScalaCommunityScalaAnnotator() = doTest("ScalaAnnotator.scala", SECONDS.toMillis(15))

  def testPerformanceScalaCommunityScalaEvaluatorBuilderUtil() =
    doTest("ScalaEvaluatorBuilderUtil.scala", SECONDS.toMillis(20))

  def testPerformanceScalaCommunityConformance() = doTest("Conformance.scala", SECONDS.toMillis(20))

  def testPerformanceScalaCommunityScalaSpacingProcessor() = doTest("ScalaSpacingProcessor.scala", SECONDS.toMillis(20))

  override def doTest(path: String, timeout: Long): Unit = {
    VfsRootAccess.SHOULD_PERFORM_ACCESS_CHECK = false
    super.doTest(path, timeout)
  }
}

Add more file to Scala community performance test


import sbt._
import sbt.Keys._
import android.Keys._
import android.Plugin._

object Build extends android.AutoBuild
{
	lazy val main = Project( "toolbelt", file( "." ) )
		.settings( buildAar: _* )
		.settings(
			libraryDependencies ++= Seq(
				"com.android.support" % "appcompat-v7" % "21.0.0",
				"com.android.support" % "cardview-v7" % "21.0.0",
				"com.github.japgolly.android" % "svg-android" % "2.0.6",
				"org.scala-lang" % "scala-reflect" % scalaVersion.value
			),
			name := "Toolbelt",
			organization := "com.taig.android",
			scalaVersion := "2.11.4",
			scalacOptions ++= Seq(
				"-deprecation",
				"-feature",
				"-language:dynamics",
				"-language:implicitConversions",
				"-language:reflectiveCalls"
			),
			version := "0.2.3-BETA",
			libraryProject in Android := true,
			minSdkVersion in Android := "10",
			targetSdkVersion in Android := "21"
		)
}

import sbt._
import sbt.Keys._
import android.Keys._
import android.Plugin._

object Build extends android.AutoBuild
{
	lazy val main = Project( "toolbelt", file( "." ) )
		.settings( buildAar: _* )
		.settings(
			libraryDependencies ++= Seq(
				"com.android.support" % "appcompat-v7" % "21.0.0",
				"com.android.support" % "cardview-v7" % "21.0.0",
				"com.github.japgolly.android" % "svg-android" % "2.0.6",
				"org.scala-lang" % "scala-reflect" % scalaVersion.value
			),
			name := "Toolbelt",
			organization := "com.taig.android",
			scalaVersion := "2.11.4",
			scalacOptions ++= Seq(
				"-deprecation",
				"-feature",
				"-language:dynamics",
				"-language:implicitConversions",
				"-language:reflectiveCalls"
			),
			version := "0.2.4-BETA",
			libraryProject in Android := true,
			minSdkVersion in Android := "10",
			targetSdkVersion in Android := "21"
		)
}

Set project version to 0.2.4-BETA

Set project version to 0.2.4-BETA


addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject"      % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0")
addSbtPlugin("org.scala-js"       % "sbt-scalajs"                   % "1.7.1")
addSbtPlugin("org.scala-native"   % "sbt-scala-native"              % "0.4.0")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.10")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2")

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject"      % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0")
addSbtPlugin("org.scala-js"       % "sbt-scalajs"                   % "1.7.1")
addSbtPlugin("org.scala-native"   % "sbt-scala-native"              % "0.4.1")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.10")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2")

Update auxlib, javalib, nativelib, nscplugin, ... to 0.4.1


resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.3")

addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.2")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.4.0")

addSbtPlugin("com.gu" % "sbt-riffraff-artifact" % "0.8.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.4")

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.3")

addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.2")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.4.0")

addSbtPlugin("com.gu" % "sbt-riffraff-artifact" % "0.9.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.4")

Use new sbt-riffraff-artifact with exploded format


package composition

import com.google.inject.name.Names
import com.tzavellas.sse.guice.ScalaModule
import play.api.{Logger, LoggerLike}
import uk.gov.dvla.vehicles.presentation.common.filters.AccessLoggingFilter._

final class LoggerLikeBinding extends ScalaModule {

  def configure() = {
    bind[LoggerLike].annotatedWith(Names.named(AccessLoggerName)).toInstance(Logger("dvla.common.AccessLogger"))
  }
}

package composition

import com.google.inject.name.Names
import uk.gov.dvla.vehicles.presentation.common
import common.filters.{AccessLoggingConfig, DefaultAccessLoggingConfig}
import com.tzavellas.sse.guice.ScalaModule
import play.api.{Logger, LoggerLike}
import uk.gov.dvla.vehicles.presentation.common.filters.AccessLoggingFilter._

final class LoggerLikeBinding extends ScalaModule {

  def configure() = {
    bind[LoggerLike].annotatedWith(Names.named(AccessLoggerName)).toInstance(Logger("dvla.common.AccessLogger"))
    bind[AccessLoggingConfig].toInstance(new DefaultAccessLoggingConfig())
  }
}

Fix the exception cases for the access logging


// Temporary workaround for problem resolving scala 2.10.2 jars:
resolvers += Resolver.sonatypeRepo("releases")

// Standard sbt plugins:
resolvers += Classpaths.sbtPluginReleases

// Jenkins CI
resolvers += "Jenkins-CI" at "http://repo.jenkins-ci.org/repo"

libraryDependencies += "org.kohsuke" % "github-api" % "1.59"

resolvers += Resolver.url(
  "sbt-plugin-releases",
  new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/")
)(Resolver.ivyStylePatterns)

// Scoverage & Coveralls:
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.0.1")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.0.0.BETA1")

// sbt-one-jar
addSbtPlugin("org.scala-sbt.plugins" % "sbt-onejar" % "0.8")

// sbt-release
addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.5")

// wartremover
addSbtPlugin("org.brianmckenna" % "sbt-wartremover" % "0.13")

// sbt-header
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "1.5.0")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.4.0")

// Temporary workaround for problem resolving scala 2.10.2 jars:
resolvers += Resolver.sonatypeRepo("releases")

// Standard sbt plugins:
resolvers += Classpaths.sbtPluginReleases

// Jenkins CI
resolvers += "Jenkins-CI" at "http://repo.jenkins-ci.org/repo"

libraryDependencies += "org.kohsuke" % "github-api" % "1.59"

// Scoverage & Coveralls:
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.0.1")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.0.0.BETA1")

// sbt-one-jar
addSbtPlugin("org.scala-sbt.plugins" % "sbt-onejar" % "0.8")

// sbt-release
addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.5")

// wartremover
addSbtPlugin("org.brianmckenna" % "sbt-wartremover" % "0.13")

// sbt-header
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "1.5.0")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.4.0")

Delete our explicit sbt-plugin resolver.


addSbtPlugin("io.gatling"         % "gatling-build-plugin"  % "4.0.1")
addSbtPlugin("com.typesafe.sbt"   % "sbt-native-packager"   % "1.8.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh"               % "0.4.3")
addSbtPlugin("net.aichler"        % "sbt-jupiter-interface" % "0.9.1")
addSbtPlugin("com.typesafe.sbt"   % "sbt-site"              % "1.4.1")
addSbtPlugin("org.wartremover"    % "sbt-wartremover"       % "2.4.15")
addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"          % "0.9.29")

addSbtPlugin("io.gatling"         % "gatling-build-plugin"  % "4.0.1")
addSbtPlugin("com.typesafe.sbt"   % "sbt-native-packager"   % "1.8.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh"               % "0.4.3")
addSbtPlugin("net.aichler"        % "sbt-jupiter-interface" % "0.9.1")
addSbtPlugin("com.typesafe.sbt"   % "sbt-site"              % "1.4.1")
addSbtPlugin("org.wartremover"    % "sbt-wartremover"       % "2.4.16")
addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"          % "0.9.29")

Update sbt-wartremover, wartremover to 2.4.16


resolvers += Resolver.url("hmrc-sbt-plugin-releases",
  url("https://dl.bintray.com/hmrc/sbt-plugin-releases"))(Resolver.ivyStylePatterns)

resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "0.9.0")

addSbtPlugin("uk.gov.hmrc" % "sbt-git-versioning" % "0.8.0")

addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "0.4.0")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.8")

resolvers += Resolver.url("hmrc-sbt-plugin-releases",
  url("https://dl.bintray.com/hmrc/sbt-plugin-releases"))(Resolver.ivyStylePatterns)

resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"

addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "0.9.0")

addSbtPlugin("uk.gov.hmrc" % "sbt-git-versioning" % "0.8.0")

addSbtPlugin("uk.gov.hmrc" % "sbt-distributables" % "0.5.0")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.8")

Upgrade sbt-distributables, do not publish zip


scalacOptions := Seq(
  "-deprecation"
)

// For MimeLoader plugin. Dogfooding and hoping it doesn't clash with
// our other sbt plugins.
libraryDependencies ++= List(
  "com.eed3si9n" %% "treehugger" % "0.4.4",
  "io.circe" %% "circe-generic" % "0.14.1",
  "org.http4s" %% "http4s-ember-client" % "0.21.24",
  "org.http4s" %% "http4s-circe" % "0.21.24",
)

scalacOptions := Seq(
  "-deprecation"
)

// For MimeLoader plugin. Dogfooding and hoping it doesn't clash with
// our other sbt plugins.
libraryDependencies ++= List(
  "com.eed3si9n" %% "treehugger" % "0.4.4",
  "io.circe" %% "circe-generic" % "0.14.1",
  "org.http4s" %% "http4s-ember-client" % "0.21.25",
  "org.http4s" %% "http4s-circe" % "0.21.25",
)

Update http4s-circe, http4s-ember-client to 0.21.25


// Adds 'dependencyUpdates':
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.7")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")

Remove sbt-updates plugin (having it now as global plugin)


resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.0")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.1")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

Upgrade Play 2.3.0 -> 2.3.1

Upgrade Play 2.3.0 -> 2.3.1


addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")

addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")

resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")

// cross-compiling
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject"      % "1.0.0")
addSbtPlugin("org.scala-js"       % "sbt-scalajs"                   % "1.3.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")

addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")

resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")

// cross-compiling
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject"      % "1.0.0")
addSbtPlugin("org.scala-js"       % "sbt-scalajs"                   % "1.3.1")

Update sbt-scalajs, scalajs-compiler, ... to 1.3.1


resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")

addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.9")

resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")

addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.9")

Downgrade of pgp plugin to 1.1.0

Downgrade of pgp plugin to 1.1.0