import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.5"

version := "0.1.69"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.9",
      "com.ning" % "async-http-client" % "1.9.40",
      "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")
  }
}

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.5"

version := "0.1.70"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.9",
      "com.ning" % "async-http-client" % "1.9.40",
      "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")
  }
}

autocommit: Update configuration to record version 0.1.70


name := "lib-apidoc-json-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.13"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.8",
      "org.scalatest" %% "scalatest" % "2.2.6" % 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")
  }
}

name := "lib-apidoc-json-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.14"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.8",
      "org.scalatest" %% "scalatest" % "2.2.6" % 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.0.14


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.3"

crossScalaVersions := Seq("2.12.3", "2.11.11", "2.10.6")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.4" % 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.41"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.3"

crossScalaVersions := Seq("2.12.3", "2.11.11", "2.10.6")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.4" % 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.42"

autocommit: Update configuration to record version 0.1.42


package utils.helpers

import views.html.helper.FieldConstructor

object ClaimHelpers {
  implicit val myFields = FieldConstructor(views.html.common.carersText.f)
}

package utils.helpers

import views.html.helper.FieldConstructor

object ClaimHelpers {
  implicit val myFields = FieldConstructor(views.html.helper.carersText.f)
}

Fix broken ClaimHelper after carersText moved to different package.


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.4",
  "org.http4s" %% "http4s-circe" % "0.23.4",
)

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.5",
  "org.http4s" %% "http4s-circe" % "0.23.5",
)

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


package controllers

import com.gilt.apidocgenerator.models.json._
import com.gilt.apidocgenerator.models.{Invocation, Generator, ServiceDescription}
import core.generator.{CodeGenTarget, CodeGenerator}
import lib.Validation
import play.api.libs.json._
import play.api.mvc._

object Invocations extends Controller {
  def postByKey(key: String) = Action(parse.json) { request: Request[JsValue] =>
    Generators.findGenerator(key) match {
      case Some((_, generator)) =>
        request.body.validate[ServiceDescription] match {
          case e: JsError => Conflict(Json.toJson(Validation.error("invalid json document: " + e.toString)))
          case s: JsSuccess[ServiceDescription] => Ok(Json.toJson(Invocation(generator.generate(s.get))))
        }
      case _ => NotFound
    }
  }
}

package controllers

import com.gilt.apidocgenerator.models.json._
import com.gilt.apidocgenerator.models.{Invocation, Generator, ServiceDescription}
import core.generator.{CodeGenTarget, CodeGenerator}
import lib.Validation
import play.api.libs.json._
import play.api.mvc._

object Invocations extends Controller {
  def postByKey(key: String) = Action(parse.json(maxLength = 1024 * 1024)) { request: Request[JsValue] =>
    Generators.findGenerator(key) match {
      case Some((_, generator)) =>
        request.body.validate[ServiceDescription] match {
          case e: JsError => Conflict(Json.toJson(Validation.error("invalid json document: " + e.toString)))
          case s: JsSuccess[ServiceDescription] => Ok(Json.toJson(Invocation(generator.generate(s.get))))
        }
      case _ => NotFound
    }
  }
}

Increase POST payload size to 1M

Increase POST payload size to 1M


package com.gu.scanamo.request

import com.amazonaws.services.dynamodbv2.model.AttributeValue
import com.gu.scanamo.EvaluationKey
import com.gu.scanamo.query.{Condition, Query}

case class ScanamoPutRequest(
    tableName: String,
    item: AttributeValue,
    condition: Option[RequestCondition]
)

case class ScanamoDeleteRequest(
    tableName: String,
    key: Map[String, AttributeValue],
    condition: Option[RequestCondition]
)

case class ScanamoUpdateRequest(
    tableName: String,
    key: Map[String, AttributeValue],
    updateExpression: String,
    attributeNames: Map[String, String],
    attributeValues: Map[String, AttributeValue],
    condition: Option[RequestCondition]
)

case class ScanamoScanRequest(
    tableName: String,
    index: Option[String],
    options: ScanamoQueryOptions
)

case class ScanamoQueryRequest(
    tableName: String,
    index: Option[String],
    query: Query[_],
    options: ScanamoQueryOptions
)

case class ScanamoQueryOptions(
    consistent: Boolean,
    limit: Option[Int],
    exclusiveStartKey: Option[EvaluationKey],
    filter: Option[Condition[_]]
)
object ScanamoQueryOptions {
  val default = ScanamoQueryOptions(false, None, None, None)
}

case class RequestCondition(
    expression: String,
    attributeNames: Map[String, String],
    attributeValues: Option[Map[String, AttributeValue]]
)

package com.gu.scanamo.request

import com.amazonaws.services.dynamodbv2.model.AttributeValue
import com.gu.scanamo.EvaluationKey
import com.gu.scanamo.query.{Condition, Query}

case class ScanamoPutRequest(
    tableName: String,
    item: AttributeValue,
    condition: Option[RequestCondition]
)

case class ScanamoDeleteRequest(
    tableName: String,
    key: Map[String, AttributeValue],
    condition: Option[RequestCondition]
)

case class ScanamoUpdateRequest(
    tableName: String,
    key: Map[String, AttributeValue],
    updateExpression: String,
    attributeNames: Map[String, String],
    attributeValues: Map[String, AttributeValue],
    condition: Option[RequestCondition]
)

case class ScanamoScanRequest(
    tableName: String,
    index: Option[String],
    options: ScanamoQueryOptions
)

case class ScanamoQueryRequest(
    tableName: String,
    index: Option[String],
    query: Query[_],
    options: ScanamoQueryOptions
)

case class ScanamoQueryOptions(
    consistent: Boolean,
    scanIndexForward: Boolean,
    limit: Option[Int],
    exclusiveStartKey: Option[EvaluationKey],
    filter: Option[Condition[_]]
)
object ScanamoQueryOptions {
  val default = ScanamoQueryOptions(false, true, None, None, None)
}

case class RequestCondition(
    expression: String,
    attributeNames: Map[String, String],
    attributeValues: Option[Map[String, AttributeValue]]
)

Add ScanIndexForward property to query options


package com.softwaremill.clippy

import com.softwaremill.clippy.StringDiff.{DeltaEnd, DeltaStart}

object StringDiff {
  val AnsiReset = "\u001B[0m"
  val AnsiRed = "\u001B[31m"
  val DeltaEnd = AnsiReset
  val DeltaStart = AnsiRed
}

class StringDiff(expected: String, actual: String) {

  def diff(message: String): String = {
    if (this.expected == this.actual) format(message, this.expected, this.actual)
    else format(message, markDiff(expected), markDiff(actual))
  }

  private def format(msg: String, expected: String, actual: String) = msg.format(expected, actual)

  private def markDiff(source: String) = {
    val prefix = findCommonPrefix()
    val suffix = findCommonSuffix()
    val diff = DeltaStart + source.substring(prefix.length, source.length - suffix.length) + DeltaEnd
    prefix + diff + suffix
  }

  private def findCommonPrefix(expectedStr: String = expected, actualStr: String = actual): String = {
    expectedStr.zip(actualStr).takeWhile(Function.tupled(_ == _)).map(_._1).mkString
  }

  private def findCommonSuffix(): String =
    findCommonPrefix(expected.reverse, actual.reverse).reverse
}

package com.softwaremill.clippy

import com.softwaremill.clippy.StringDiff.{DeltaEnd, DeltaStart}

object StringDiff {
  val DeltaEnd = Console.RESET
  val DeltaStart = Console.RED
}

class StringDiff(expected: String, actual: String) {

  def diff(message: String): String = {
    if (this.expected == this.actual) format(message, this.expected, this.actual)
    else format(message, markDiff(expected), markDiff(actual))
  }

  private def format(msg: String, expected: String, actual: String) = msg.format(expected, actual)

  private def markDiff(source: String) = {
    val prefix = findCommonPrefix()
    val suffix = findCommonSuffix()
    val diff = DeltaStart + source.substring(prefix.length, source.length - suffix.length) + DeltaEnd
    prefix + diff + suffix
  }

  private def findCommonPrefix(expectedStr: String = expected, actualStr: String = actual): String = {
    expectedStr.zip(actualStr).takeWhile(Function.tupled(_ == _)).map(_._1).mkString
  }

  private def findCommonSuffix(): String =
    findCommonPrefix(expected.reverse, actual.reverse).reverse
}

Use predefined constants for ANSI colors


import java.io.PrintWriter

import org.specs2.mutable._
import settings.TaskSettings
import task.CommandLineRunner

class WatcherSpec extends Specification {
  val command = TaskSettings.command
  val repoDir = TaskSettings.repositories

  "When watching the queue it" should {
    "execute the task correctly" in {
/*
      val queue = new TestQueue
      val data = new TestDatabase
      val runner = new CommandLineRunner(repoDir, command, new PrintWriter(null, true))

      Watcher.watch(queue, data, runner)
*/
      true must beTrue
    }
  }
}

import java.io.PrintWriter

import org.specs2.mutable._
import settings.TaskSettings
import task.CommandLineRunner

class WatcherSpec extends Specification {
/*
  val command = TaskSettings.command
  val repoDir = TaskSettings.repositories

  "When watching the queue it" should {
    "execute the task correctly" in {
      val queue = new TestQueue
      val data = new TestDatabase
      val runner = new CommandLineRunner(repoDir, command, new PrintWriter(System.out, true))

      Watcher.watch(queue, data, runner)
      true must beTrue
    }
  }
*/
}

Disable settings initialization in test

Disable settings initialization in test


// Check https://github.com/scoverage/sbt-scoverage/issues/146 before upgrading
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.2.0")

Add note to check the sbt-scoverage issue before upgrading

closes #72


package uk.ac.wellcome.test.utils

import com.amazonaws.auth.{AWSStaticCredentialsProvider, BasicAWSCredentials}
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration
import com.amazonaws.services.sqs.model.PurgeQueueRequest
import com.amazonaws.services.sqs.{AmazonSQS, AmazonSQSClientBuilder}
import com.google.inject.{Provides, Singleton}
import com.twitter.inject.TwitterModule
import org.scalatest.concurrent.{Eventually, IntegrationPatience}
import org.scalatest.{BeforeAndAfterEach, Suite}

trait SQSLocal
    extends BeforeAndAfterEach
    with Eventually
    with IntegrationPatience { this: Suite =>

  val sqsClient: AmazonSQS = AmazonSQSClientBuilder
    .standard()
    .withCredentials(
      new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x")))
    .withEndpointConfiguration(
      new EndpointConfiguration(s"http://localhost:9324", "localhost"))
    .build()

  private var queueUrls: List[String] = Nil

  def createQueueAndReturnUrl(queueName: String): String = {
    // Use eventually to allow some time for the local SQS to start up.
    // If it is not started all suites using this will crash at start up time.
    val queueUrl = eventually {
      sqsClient.createQueue(queueName).getQueueUrl
    }
    queueUrls = queueUrl :: queueUrls
    queueUrl
  }

  override def beforeEach(): Unit = {
    super.beforeEach()
    queueUrls.foreach(queueUrl => sqsClient.purgeQueue(new PurgeQueueRequest().withQueueUrl(queueUrl)))
  }
}

package uk.ac.wellcome.test.utils

import com.amazonaws.auth.{AWSStaticCredentialsProvider, BasicAWSCredentials}
import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration
import com.amazonaws.services.sqs.model.PurgeQueueRequest
import com.amazonaws.services.sqs.{AmazonSQS, AmazonSQSClientBuilder}
import org.scalatest.concurrent.Eventually
import org.scalatest.{BeforeAndAfterEach, Suite}

trait SQSLocal
    extends BeforeAndAfterEach
    with Eventually
    with ExtendedPatience { this: Suite =>

  val sqsClient: AmazonSQS = AmazonSQSClientBuilder
    .standard()
    .withCredentials(
      new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x")))
    .withEndpointConfiguration(
      new EndpointConfiguration(s"http://localhost:9324", "localhost"))
    .build()

  private var queueUrls: List[String] = Nil

  def createQueueAndReturnUrl(queueName: String): String = {
    // Use eventually to allow some time for the local SQS to start up.
    // If it is not started all suites using this will crash at start up time.
    val queueUrl = eventually {
      sqsClient.createQueue(queueName).getQueueUrl
    }
    queueUrls = queueUrl :: queueUrls
    queueUrl
  }

  override def beforeEach(): Unit = {
    super.beforeEach()
    queueUrls.foreach(queueUrl => sqsClient.purgeQueue(new PurgeQueueRequest().withQueueUrl(queueUrl)))
  }
}

MAke SQSLoncal use ExtendedPatience so that we don't mixin more than one different PatienceConfiguration


addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")

addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.0")

Update dependency com.github.sbt:sbt-pgp to v2.2.0


package com.sksamuel.elastic4s.http.search.queries

import com.sksamuel.elastic4s.searches.queries.RangeQueryDefinition
import org.elasticsearch.common.xcontent.{XContentBuilder, XContentFactory}

object RangeQueryBodyFn {
  def apply(range: RangeQueryDefinition): XContentBuilder = {
    val builder = XContentFactory.jsonBuilder()
    builder.startObject()
    builder.startObject("range")
    builder.startObject(range.field)

    if (range.gte.nonEmpty) {
      builder.field("gte", range.gte.get)
    }

    if (range.lte.nonEmpty) {
      builder.field("lte", range.lte.get)
    }

    range.boost.map(_.toString).foreach(builder.field("boost", _))
    range.queryName.foreach(builder.field("_name", _))

    builder.endObject()
    builder.endObject()
    builder.endObject()
    builder
  }
}

package com.sksamuel.elastic4s.http.search.queries

import com.sksamuel.elastic4s.searches.queries.RangeQueryDefinition
import org.elasticsearch.common.xcontent.{XContentBuilder, XContentFactory}

object RangeQueryBodyFn {
  def apply(range: RangeQueryDefinition): XContentBuilder = {
    val builder = XContentFactory.jsonBuilder()
    builder.startObject()
    builder.startObject("range")
    builder.startObject(range.field)

    range.gte.foreach(builder.field("gte", _))
    range.lte.foreach(builder.field("lte", _))
    range.includeUpper.foreach(builder.field("include_upper", _))
    range.includeLower.foreach(builder.field("include_lower", _))

    range.boost.map(_.toString).foreach(builder.field("boost", _))
    range.timeZone.foreach(builder.field("time_zone", _))
    range.queryName.foreach(builder.field("_name", _))

    builder.endObject()
    builder.endObject()
    builder.endObject()
    builder
  }
}

Add include_lower, include_upper, and time_zone in range query


package web

import org.scalatest.mock.MockitoSugar
import org.scalatestplus.play._
import org.webjars.play.RequireJS
import play.api.mvc.{Result, Results}
import play.api.test.FakeRequest
import play.api.cache.CacheApi
import play.api.test.Helpers._

import scala.concurrent.Future

class MainControllerSpec extends PlaySpec
  with Results
  with MockitoSugar {

  "the browser must invalidate the basic-auth credentials it supplied so the controller" should {
    "send 401 Unauthorized when logging out" in {

      val controller = new MainController(mock[CacheApi], "foo", "foo", "foo",
        mock[controllers.WebJarAssets], mock[RequireJS], "bar")

      val result: Future[Result] = controller.logout.apply(FakeRequest())

      status(result) mustBe 401
      contentAsString(result) mustBe ""
    }
  }
}

package web

import org.scalatest.mock.MockitoSugar
import org.scalatestplus.play._
import org.webjars.play.RequireJS
import play.api.mvc.{Result, Results}
import play.api.test.FakeRequest
import play.api.cache.CacheApi
import play.api.test.Helpers._

import scala.concurrent.Future

class MainControllerSpec extends PlaySpec
  with Results
  with MockitoSugar {

  "the browser must invalidate the basic-auth credentials it supplied so the controller" should {
    "send 401 Unauthorized when logging out" in {

      val controller = new MainController(mock[CacheApi], "foo", "foo", "foo",
        mock[controllers.WebJarAssets], mock[RequireJS], "bar")

      val result: Future[Result] = controller.logout.apply(FakeRequest())

      status(result) mustBe 401
      contentAsString(result) mustBe ""
    }
  }

  "all deployments and nginx-configs out there assume that we run on /narthex so /" should {
    "redirect us to /narthex/" in {

      val controller = new MainController(mock[CacheApi], "foo", "foo", "foo",
        mock[controllers.WebJarAssets], mock[RequireJS], "bar")

      val result: Future[Result] = controller.root.apply(FakeRequest())

      status(result) mustBe 303
      header("Location", result) mustBe Some("/narthex/")
    }
  }
}

Add a test for root()

Add a test for root()


resolvers ++= Seq(
    "socrata maven" at "https://repository-socrata-oss.forge.cloudbees.com/release",
    "DiversIT repo" at "http://repository-diversit.forge.cloudbees.com/release"
)

addSbtPlugin("com.socrata" % "socrata-cloudbees-sbt" % "1.3.0")

addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "0.4.2")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")

addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2")

libraryDependencies ++= Seq(
  "com.rojoma" %% "simple-arm" % "1.2.0",
  "com.rojoma" %% "rojoma-json" % "2.4.3"
)

resolvers ++= Seq(
    "socrata maven" at "https://repository-socrata-oss.forge.cloudbees.com/release",
    "DiversIT repo" at "http://repository-diversit.forge.cloudbees.com/release"
)

addSbtPlugin("com.socrata" % "socrata-cloudbees-sbt" % "1.3.1-SNAPSHOT")

addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "0.4.2")

addSbtPlugin("io.spray" % "sbt-revolver" % "0.7.2")

libraryDependencies ++= Seq(
  "com.rojoma" %% "simple-arm" % "1.2.0",
  "com.rojoma" %% "rojoma-json" % "2.4.3"
)

Upgrade to newer cloudbees-sbt plugin; make sbt-release work again

No need for dependency-graph, already included by cloudbees


name := "oauth2-plugin-example"

Settings.common ++ Settings.disablePublishing ++ Settings.integrationTest

libraryDependencies ++= Seq(
  javaWs,
  "me.tfeng.play-plugins" % "oauth2-plugin" % version.value,
  "org.springframework" % "spring-test" % "4.0.3.RELEASE" % "test"
)

name := "oauth2-plugin-example"

Settings.common ++ Settings.disablePublishing ++ Settings.integrationTest

libraryDependencies ++= Seq(
  javaWs % "test",
  "me.tfeng.play-plugins" % "oauth2-plugin" % version.value,
  "org.springframework" % "spring-test" % "4.0.3.RELEASE" % "test"
)

Make dependency on javaWs to be test only.


package backend.services

import java.io.ByteArrayInputStream
import java.nio.charset.StandardCharsets

import org.apache.jena.query.ResultSetFactory
import org.apache.jena.query.ResultSetRewindable

import scalaj.http.Http
import scalaj.http.HttpOptions
import backend.PlatformConstants

trait ScalaService {

  // This value is injected at runtime
  val uri: String = null

  private val timeout = HttpOptions.connTimeout(if (PlatformConstants.runsInDebugMode) 0 else 1000)

  def response(str: String): String = {
    str
  }

  def requestId: String = {
    "#reqId"
  }

  def sparqlRequest(query: String): ResultSetRewindable = {
    val req = Http(uri)
      .postData(query)
      .header("Accept", "application/sparql-results+json")
      .header("Charset", "UTF-8")
      .option(timeout)
    val resp = req.asString
    if (resp.code != 200)
      throw new IllegalStateException(s"SPARQL request responded with an error.\nRequest: $req\nResponse: $resp")

    val in = new ByteArrayInputStream(resp.body.getBytes(StandardCharsets.UTF_8))
    ResultSetFactory.makeRewindable(ResultSetFactory.fromJSON(in))
  }
}

package backend.services

import java.io.ByteArrayInputStream
import java.nio.charset.StandardCharsets

import org.apache.jena.query.ResultSetFactory
import org.apache.jena.query.ResultSetRewindable

import scalaj.http.Http
import scalaj.http.HttpOptions
import backend.PlatformConstants

trait ScalaService {

  // This value is injected at runtime
  val uri: String = null

  private val timeout = HttpOptions.connTimeout(if (PlatformConstants.runsInDebugMode) 0 else 1000)

  def response(str: String): String = {
    str
  }

  def requestId: String = {
    "#reqId"
  }

  def sparqlRequest(query: String): ResultSetRewindable = {
    val req = Http(uri)
      .postData(query)
      .header("Content-Type", "application/sparql-query")
      .header("Accept", "application/sparql-results+json")
      .header("Charset", "UTF-8")
      .option(timeout)
    val resp = req.asString
    if (resp.code != 200)
      throw new IllegalStateException(s"SPARQL request responded with an error.\nRequest: $req\nResponse: $resp")

    val in = new ByteArrayInputStream(resp.body.getBytes(StandardCharsets.UTF_8))
    ResultSetFactory.makeRewindable(ResultSetFactory.fromJSON(in))
  }
}

Fix service tests by emitting the correct Content-Type header


package com.twitter.example
import com.twitter.mydemo.renamed.{User, UserService}
import com.twitter.finagle.Thrift
import com.twitter.finagle.thrift.{ThriftServerFramedCodec, ThriftClientRequest}
import com.twitter.finagle.builder.{ServerBuilder, ClientBuilder}
import org.apache.thrift.protocol.TBinaryProtocol
import java.net.{SocketAddress, InetSocketAddress}
import com.twitter.util.Future
import java.util.concurrent.atomic.AtomicInteger

object DemoClient {
  def buildClient(address: SocketAddress) = {
    val clientService = ClientBuilder()
      .hosts(Seq(address))
      .stack(Thrift.client)
      .hostConnectionLimit(1)
      .build()
    new UserService.FinagledClient(clientService)
  }
}

object DemoServer {
  private val userIdCounter: AtomicInteger = new AtomicInteger(0)

  // need to provide an implementation for the finagle service
  class MyUserImpl extends UserService.FutureIface {
    def createUser(name: String): Future[User] = {
      val id = userIdCounter.incrementAndGet()
      Future.value(User(id, name))
    }
  }

  def buildServer() = {
    val protocol = new TBinaryProtocol.Factory()
    val serverService = new UserService.FinagledService(new MyUserImpl, protocol)
    ServerBuilder()
      .stack(Thrift.client)
      .name("binary_service")
      .bindTo(new InetSocketAddress(0))
      .build(serverService)
  }
}

package com.twitter.example
import com.twitter.mydemo.renamed.{User, UserService}
import com.twitter.finagle.Thrift
import com.twitter.finagle.thrift.ThriftClientRequest
import com.twitter.finagle.builder.{ServerBuilder, ClientBuilder}
import org.apache.thrift.protocol.TBinaryProtocol
import java.net.{SocketAddress, InetSocketAddress}
import com.twitter.util.Future
import java.util.concurrent.atomic.AtomicInteger

object DemoClient {
  def buildClient(address: SocketAddress) = {
    val clientService = ClientBuilder()
      .hosts(Seq(address))
      .stack(Thrift.client)
      .hostConnectionLimit(1)
      .build()
    new UserService.FinagledClient(clientService)
  }
}

object DemoServer {
  private val userIdCounter: AtomicInteger = new AtomicInteger(0)

  // need to provide an implementation for the finagle service
  class MyUserImpl extends UserService.FutureIface {
    def createUser(name: String): Future[User] = {
      val id = userIdCounter.incrementAndGet()
      Future.value(User(id, name))
    }
  }

  def buildServer() = {
    val protocol = new TBinaryProtocol.Factory()
    val serverService = new UserService.FinagledService(new MyUserImpl, protocol)
    ServerBuilder()
      .stack(Thrift.client)
      .name("binary_service")
      .bindTo(new InetSocketAddress(0))
      .build(serverService)
  }
}

Remove remaining usages of ThriftServerFramedCodec

Problem / Solution

ThriftServerFramedCodec is Netty 3 specific and has been deprecated in
favor of the stack server pattern which provides identical behavior in a
Netty version agnostic manner.

RB_ID=915188
TBR=true


package com.microsoft.partnercatalyst.fortis.spark.transforms.language

import com.microsoft.partnercatalyst.fortis.spark.logging.FortisTelemetry
import com.optimaize.langdetect.LanguageDetectorBuilder
import com.optimaize.langdetect.ngram.NgramExtractors
import com.optimaize.langdetect.profiles.LanguageProfileReader
import com.optimaize.langdetect.text.CommonTextObjectFactories

@SerialVersionUID(100L)
class LocalLanguageDetector extends LanguageDetector {
  @transient private lazy val languageProfiles = new LanguageProfileReader().readAllBuiltIn
  @transient private lazy val languageDetector = LanguageDetectorBuilder.create(NgramExtractors.standard()).withProfiles(languageProfiles).build()
  @transient private lazy val textObjectFactory = CommonTextObjectFactories.forDetectingOnLargeText()

  override def detectLanguage(text: String): Option[String] = {
    if (text.isEmpty) {
      return None
    }

    val language = Option(languageDetector.detect(textObjectFactory.forText(text)).orNull).map(_.getLanguage)
    FortisTelemetry.get().logLanguageDetection(language)
    language
  }
}

package com.microsoft.partnercatalyst.fortis.spark.transforms.language

import com.microsoft.partnercatalyst.fortis.spark.logging.FortisTelemetry
import com.optimaize.langdetect.LanguageDetectorBuilder
import com.optimaize.langdetect.ngram.NgramExtractors
import com.optimaize.langdetect.profiles.LanguageProfileReader
import com.optimaize.langdetect.text.{CommonTextObjectFactories, TextObjectFactory}

@SerialVersionUID(100L)
class LocalLanguageDetector extends LanguageDetector {
  @transient private lazy val languageProfiles = new LanguageProfileReader().readAllBuiltIn
  @transient private lazy val languageDetector = LanguageDetectorBuilder.create(NgramExtractors.standard()).withProfiles(languageProfiles).build()
  @transient private lazy val largeTextFactory = CommonTextObjectFactories.forDetectingOnLargeText()
  @transient private lazy val shortTextFactory = CommonTextObjectFactories.forDetectingShortCleanText()

  override def detectLanguage(text: String): Option[String] = {
    if (text.isEmpty) {
      return None
    }

    var language = detectWithFactory(text, shortTextFactory)
    if (language.isEmpty) language = detectWithFactory(text, largeTextFactory)

    FortisTelemetry.get().logLanguageDetection(language)
    language
  }

  private def detectWithFactory(text: String, factory: TextObjectFactory): Option[String] = {
    Option(languageDetector.detect(factory.forText(text)).orNull).map(_.getLanguage)
  }
}

Use multiple detectors to increase accuracy


package uk.ac.wellcome.platform.reindex.reindex_worker.fixtures

import uk.ac.wellcome.platform.reindex.reindex_worker.dynamo.{
  MaxRecordsScanner,
  ParallelScanner,
  ScanSpecScanner
}
import uk.ac.wellcome.storage.fixtures.LocalDynamoDb
import uk.ac.wellcome.storage.fixtures.LocalDynamoDb.Table
import uk.ac.wellcome.storage.dynamo.DynamoConfig
import uk.ac.wellcome.test.fixtures.TestWith

import scala.concurrent.ExecutionContext.Implicits.global

trait DynamoFixtures extends LocalDynamoDb {
  def withScanSpecScanner[R](testWith: TestWith[ScanSpecScanner, R]): R = {
    val scanner = new ScanSpecScanner(dynamoDbClient)

    testWith(scanner)
  }

  def withParallelScanner[R](table: Table)(
    testWith: TestWith[ParallelScanner, R]): R = {
    withScanSpecScanner { scanSpecScanner =>
      val scanner = new ParallelScanner(
        scanSpecScanner = scanSpecScanner,
        dynamoConfig = DynamoConfig(
          table = table.name,
          index = table.index
        )
      )

      testWith(scanner)
    }
  }

  def withMaxRecordsScanner[R](table: Table)(
    testWith: TestWith[MaxRecordsScanner, R]): R = {
    withScanSpecScanner { scanSpecScanner =>
      val scanner = new MaxRecordsScanner(
        scanSpecScanner = scanSpecScanner,
        dynamoConfig = DynamoConfig(
          table = table.name,
          index = table.index
        )
      )

      testWith(scanner)
    }
  }
}

package uk.ac.wellcome.platform.reindex.reindex_worker.fixtures

import uk.ac.wellcome.platform.reindex.reindex_worker.dynamo.{
  MaxRecordsScanner,
  ParallelScanner,
  ScanSpecScanner
}
import uk.ac.wellcome.storage.fixtures.LocalDynamoDb
import uk.ac.wellcome.storage.fixtures.LocalDynamoDb.Table
import uk.ac.wellcome.test.fixtures.TestWith

import scala.concurrent.ExecutionContext.Implicits.global

trait DynamoFixtures extends LocalDynamoDb {
  def withScanSpecScanner[R](testWith: TestWith[ScanSpecScanner, R]): R = {
    val scanner = new ScanSpecScanner(dynamoDbClient)

    testWith(scanner)
  }

  def withParallelScanner[R](table: Table)(
    testWith: TestWith[ParallelScanner, R]): R = {
    withScanSpecScanner { scanSpecScanner =>
      val scanner = new ParallelScanner(
        scanSpecScanner = scanSpecScanner,
        dynamoConfig = createDynamoConfigWith(table)
      )

      testWith(scanner)
    }
  }

  def withMaxRecordsScanner[R](table: Table)(
    testWith: TestWith[MaxRecordsScanner, R]): R = {
    withScanSpecScanner { scanSpecScanner =>
      val scanner = new MaxRecordsScanner(
        scanSpecScanner = scanSpecScanner,
        dynamoConfig = createDynamoConfigWith(table)
      )

      testWith(scanner)
    }
  }
}

Use a test helper to clean up this fixture


/*
 * Copyright 2005-2010 LAMP/EPFL
 */
// $Id$

package scala.tools.eclipse.util

/** A ref cell to a managed resource. Overwrite 'create' and 'destroy'.
 *
 *  @note Important: 'create' is not allowed to throw any exceptions. Throwing
 *        an exception may lead to either NoSuchElementException, or an infinite
 *        loop if other threads wait while 'create' is in progress. Use a Cached[Option[T]]
 *        in such a case.
 *
 */
trait Cached[T] {
  private var inProgress = false
  private var elem: Option[T] = None

  def apply[U](op: T => U): U = {
    val e = synchronized {
      elem match {
        case Some(t) => t
        case None => {
          if (inProgress)
            throw new RuntimeException("Recursive call during initialization of Cached resource")

          inProgress = true
          try {
            val t = create
            elem = Some(t)
          } finally {
            inProgress = false
            notifyAll
          }
          elem.get
        }
      }
    }

    op(e)
  }

  /** Is the cached object initialized, at this point in time? */
  def initialized: Boolean = synchronized { elem.isDefined }

  def invalidate() {
    val oldElem = synchronized {
      val elem0 = elem
      elem = None
      elem0
    }

    oldElem match {
      case Some(t) => destroy(t)
      case _       =>
    }
  }

  /** Should not throw. */
  protected def create(): T

  protected def destroy(t: T)
}

/*
 * Copyright 2005-2010 LAMP/EPFL
 */
// $Id$

package scala.tools.eclipse.util

/** A ref cell to a managed resource. Overwrite 'create' and 'destroy'.
 *
 *  @note Important: 'create' is not allowed to throw any exceptions. Throwing
 *        an exception may lead to either NoSuchElementException, or an infinite
 *        loop if other threads wait while 'create' is in progress. Use a Cached[Option[T]]
 *        in such a case.
 *
 */
trait Cached[T] {
  private var inProgress = false
  @volatile private var elem: Option[T] = None

  def apply[U](op: T => U): U = {
    val e = synchronized {
      elem match {
        case Some(t) => t
        case None => {
          if (inProgress)
            throw new RuntimeException("Recursive call during initialization of Cached resource")

          inProgress = true
          try {
            val t = create
            elem = Some(t)
          } finally {
            inProgress = false
            notifyAll
          }
          elem.get
        }
      }
    }

    op(e)
  }

  /** Is the cached object initialized, at this point in time? */
  def initialized: Boolean = elem.isDefined

  def invalidate() {
    val oldElem = synchronized {
      val elem0 = elem
      elem = None
      elem0
    }

    oldElem match {
      case Some(t) => destroy(t)
      case _       =>
    }
  }

  /** Should not throw. */
  protected def create(): T

  protected def destroy(t: T)
}

Revert "Sync 'isDefined' in presentation compiler cache."

This reverts commit 3608a8191c91062aa608beb77da930cdc3c8cda7.

We need to revert this because of a possible deadlock at startup between the PC
and the classpath resolution. More information on the related ticket (#1001875).

backport to release/scala-ide-3.0.x

Review by @dragos

Re #1001880
Fixes #1001875


package io.continuum.bokeh
package widgets

@model abstract class Layout extends Widget {
    object width extends Field[Int]
    object height extends Field[Int]
}

@model class HBox extends Layout {
    object children extends Field[List[Widget]]
}

@model class VBox extends Layout {
    object children extends Field[List[Widget]]
}

package io.continuum.bokeh
package widgets

@model abstract class Layout extends Widget {
    object width extends Field[Int]
    object height extends Field[Int]
}

@model abstract class BaseBox extends Layout {
    object children extends Field[List[Widget]]
}

@model class HBox extends BaseBox

@model class VBox extends BaseBox

Make {H,V}Box inherit from BaseBox

Make {H,V}Box inherit from BaseBox


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

crossScalaVersions := Seq("2.12.6")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/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.94"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

crossScalaVersions := Seq("2.12.6")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/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.95"

autocommit: Update configuration to record version 0.1.95


organization := "tv.cntt"

name         := "sinetja"

version      := "1.2-SNAPSHOT"

//------------------------------------------------------------------------------

scalaVersion := "2.11.2"

autoScalaLibrary := false

// Do not append Scala versions to the generated artifacts
crossPaths := false

javacOptions in (Compile) ++= Seq("-source", "1.5", "-target", "1.5", "-Xlint:deprecation")

javacOptions in (Compile, doc) := Seq("-source", "1.5")

//------------------------------------------------------------------------------

// Projects using Sinetja must provide a concrete implementation of SLF4J (Logback etc.)
libraryDependencies += "org.slf4s" %% "slf4s-api" % "1.7.7"

libraryDependencies += "io.netty" % "netty-all" % "4.0.23.Final"

// Netty speed can be boosted by Javassist
libraryDependencies += "org.javassist" % "javassist" % "3.18.2-GA"

libraryDependencies += "tv.cntt" % "netty-router" % "1.10"

libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.4.3"

libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.2" % "test"

organization := "tv.cntt"

name         := "sinetja"

version      := "1.2-SNAPSHOT"

//------------------------------------------------------------------------------

scalaVersion := "2.11.2"

autoScalaLibrary := false

// Do not append Scala versions to the generated artifacts
crossPaths := false

javacOptions in (Compile) ++= Seq("-source", "1.5", "-target", "1.5", "-Xlint:deprecation")

javacOptions in (Compile, doc) := Seq("-source", "1.5")

//------------------------------------------------------------------------------

// Projects using Sinetja must provide a concrete implementation of SLF4J (Logback etc.)
libraryDependencies += "org.slf4s" %% "slf4s-api" % "1.7.7"

libraryDependencies += "io.netty" % "netty-all" % "4.0.24.Final"

// Netty speed can be boosted by Javassist
libraryDependencies += "org.javassist" % "javassist" % "3.18.2-GA"

libraryDependencies += "tv.cntt" % "netty-router" % "1.10"

libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.4.3"

libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.2" % "test"

Update Netty from 4.0.23 to 4.0.24

Update Netty from 4.0.23 to 4.0.24


name          := """Castalia Stub Server"""
organization  := "castalia"
version       := "0.0.1"
scalaVersion  := "2.11.7"
scalacOptions := Seq("-unchecked", "-feature", "-deprecation", "-encoding", "utf8")

libraryDependencies ++= {
  val akkaStreamV      = "1.0"
  val scalaTestV       = "3.0.0-M7"
  val scalaMockV       = "3.2.2"
  Seq(
    "com.typesafe.akka" %% "akka-stream-experimental"             % akkaStreamV,
    "com.typesafe.akka" %% "akka-http-core-experimental"          % akkaStreamV,
    "com.typesafe.akka" %% "akka-http-spray-json-experimental"    % akkaStreamV,
    "org.scalatest"     %% "scalatest"                            % scalaTestV       % "test",
    "org.scalamock"     %% "scalamock-scalatest-support"          % scalaMockV       % "test",
    "com.typesafe.akka" %% "akka-http-testkit-experimental"       % akkaStreamV      % "test",
    "com.twitter"       %% "finagle-http"                    % "6.30.0" % "test"
  )
}

initialCommands := """|import akka.actor._
                      |import akka.pattern._
                      |import akka.util._
                      |import scala.concurrent._
                      |import scala.concurrent.duration._""".stripMargin

publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := { _ => false }

fork in run := true

name          := """Castalia Stub Server"""
organization  := "castalia"
version       := "0.0.1"
scalaVersion  := "2.11.7"
scalacOptions := Seq("-unchecked", "-feature", "-deprecation", "-encoding", "utf8")

libraryDependencies ++= {
  val akkaStreamV      = "2.0-M1"
  val scalaTestV       = "3.0.0-M12"
  val scalaMockV       = "3.2.2"
  Seq(
    "com.typesafe.akka" %% "akka-stream-experimental"             % akkaStreamV,
    "com.typesafe.akka" %% "akka-http-core-experimental"          % akkaStreamV,
    "com.typesafe.akka" %% "akka-http-spray-json-experimental"    % akkaStreamV,
    "org.scalatest"     %% "scalatest"                            % scalaTestV       % "test",
    "org.scalamock"     %% "scalamock-scalatest-support"          % scalaMockV       % "test",
    "com.typesafe.akka" %% "akka-http-testkit-experimental"       % akkaStreamV      % "test",
    "com.twitter"       %% "finagle-http"                    % "6.30.0" % "test"
  )
}

initialCommands := """|import akka.actor._
                      |import akka.pattern._
                      |import akka.util._
                      |import scala.concurrent._
                      |import scala.concurrent.duration._""".stripMargin

publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := { _ => false }

fork in run := true

Update Akka http and ScalaTest libraries.


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.6"

lazy val allScalacOptions = Seq(
  "-feature",
  "-Xfatal-warnings",
  "-unchecked",
  "-Xcheckinit",
  "-Xlint:adapted-args",
  "-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
  "-Wconf:src=generated/.*:silent",
  "-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes
)

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.11" % Test,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/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")
  }
}

scalacOptions ++= allScalacOptions

version := "0.3.1"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.6"

lazy val allScalacOptions = Seq(
  "-feature",
  "-Xfatal-warnings",
  "-unchecked",
  "-Xcheckinit",
  "-Xlint:adapted-args",
  "-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
  "-Wconf:src=generated/.*:silent",
  "-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes
)

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.11" % Test,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/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")
  }
}

scalacOptions ++= allScalacOptions

version := "0.3.2"

autocommit: Update configuration to record version 0.3.2


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

crossScalaVersions := Seq("2.11.8")

version := "0.3.23"

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.24"

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.24


package com.gu.management

case class IndexPage(pages: Seq[ManagementPage], applicationName: String, version: String) extends HtmlManagementPage {
  val path = "/management"
  val title = "Management Index"

  def body(r: HttpRequest) =
    <xml:group>

        {
          for (p <- pages) yield

                                     { p.linktext }

        }

          This page generated by
          guardian-management{ version }

    </xml:group>

}

package com.gu.management

case class IndexPage(pages: Seq[ManagementPage], applicationName: String, version: String) extends HtmlManagementPage {
  val path = "/management"
  val title = "Management Index"

  def body(r: HttpRequest) =
    <xml:group>

        {
          for (p <- pages) yield

                                     { p.linktext }

        }

          This page generated by
          guardian-management { version }

    </xml:group>

}

Insert space before version in "This page generated by..." message


package mesosphere.marathon.plugin

/**
  * A Marathon RunSpec Definition
  */
trait RunSpec {

  /**
    * The uniqie id of this run specification
    */
  val id: PathId

  /**
    * The Mesos resource roles that are accepted
    */
  val acceptedResourceRoles: Set[String]

  /**
    * All defined secret definitions
    */
  val secrets: Map[String, Secret]

}

/**
  * An application is a run spec that launches a single task.
  */
trait ApplicationSpec extends RunSpec {

  /**
    * The user to execute the container task
    */
  val user: Option[String]

  /**
    * The environment of this container.
    */
  val env: Map[String, EnvVarValue]

  /**
    * The labels in that container
    */
  val labels: Map[String, String]
}

/**
  * A Marathon Container definition
  */
trait ContainerSpec {

  /**
    * The name of the container spec.
    */
  val name: String

  /**
    * The user to execute the container task
    */
  val user: Option[String]

  /**
    * The environment of this container.
    */
  val env: Map[String, EnvVarValue]

  /**
    * The labels in that container
    */
  val labels: Map[String, String]
}

/**
  * A pod is a run spec that launches a task group.
  */
trait PodSpec extends RunSpec {

  /**
    * All containers of this run specification
    */
  val containers: Seq[ContainerSpec]

}

package mesosphere.marathon.plugin

/**
  * A Marathon RunSpec Definition
  */
trait RunSpec {

  /**
    * The uniqie id of this run specification
    */
  val id: PathId

  /**
    * The Mesos resource roles that are accepted
    */
  val acceptedResourceRoles: Set[String]

  /**
    * All defined secret definitions
    */
  val secrets: Map[String, Secret]

}

/**
  * An application is a run spec that launches a single task.
  */
trait ApplicationSpec extends RunSpec {

  /**
    * The user to execute the container task
    */
  val user: Option[String]

  /**
    * The environment of this container.
    */
  val env: Map[String, EnvVarValue]

  /**
    * The labels in that container
    */
  val labels: Map[String, String]
}

/**
  * A Marathon Container definition
  */
trait ContainerSpec {

  /**
    * The name of the container spec.
    */
  val name: String

  /**
    * The user to execute the container task
    */
  val user: Option[String]

  /**
    * The environment of this container.
    */
  val env: Map[String, EnvVarValue]

  /**
    * The labels in that container
    */
  val labels: Map[String, String]
}

/**
  * A pod is a run spec that launches a task group.
  */
trait PodSpec extends RunSpec {

  /**
    * All containers of this run specification
    */
  val containers: Seq[ContainerSpec]

  /**
    * The environment shared for all containers inside this pod.
    */
  val env: Map[String, EnvVarValue]
}

Make pod.env available in the plugin definition.

Summary:
Users can define env vars on the level of pods (for every container) or on the level of containers.
The same structure should be available to plugin developers.

Test Plan: sbt test

Reviewers: unterstein, meichstedt

Reviewed By: unterstein, meichstedt

Subscribers: marathon-team

Differential Revision: https://phabricator.mesosphere.com/D210


resolvers ++= Seq(
  "socrata releases" at "http://repository-socrata-oss.forge.cloudbees.com/release",
  "DiversIT repo" at "http://repository-diversit.forge.cloudbees.com/release"
)

addSbtPlugin("com.socrata" % "socrata-cloudbees-sbt" % "1.3.0")

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

lazy val scalabuff = uri("git://github.com/tkawachi/sbt-scalabuff.git#47a1ab48a50ccd42c7c5a44d8ff605184e2b3707")

libraryDependencies ++= Seq(
  "com.rojoma" %% "rojoma-json" % "2.4.3",
  "com.rojoma" %% "simple-arm" % "1.2.0"
)

resolvers ++= Seq(
  "socrata releases" at "http://repository-socrata-oss.forge.cloudbees.com/release",
  "DiversIT repo" at "http://repository-diversit.forge.cloudbees.com/release"
)

addSbtPlugin("com.socrata" % "socrata-cloudbees-sbt" % "1.3.1")

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

lazy val scalabuff = uri("git://github.com/tkawachi/sbt-scalabuff.git#47a1ab48a50ccd42c7c5a44d8ff605184e2b3707")

libraryDependencies ++= Seq(
  "com.rojoma" %% "rojoma-json" % "2.4.3",
  "com.rojoma" %% "simple-arm" % "1.2.0"
)

Upgrade to latst version of cloudbees-sbt


package breeze.linalg

import breeze.benchmark._

import breeze.linalg._
import breeze.stats.distributions._
import breeze.numerics._
import spire.implicits._

object MappingUfuncBenchmark extends MyRunner(classOf[MappingUfuncBenchmark])

class MappingUfuncBenchmark extends BreezeBenchmark with BuildsRandomMatrices with BuildsRandomVectors {
  def timeMappingUfuncDenseMat(reps: Int) = runWith(reps, {randomMatrix(2048,2048)})((mat:DenseMatrix[Double]) => {
    exp(mat)
  })

  def timeMappingUfuncDenseVec(reps: Int) = runWith(reps, {randomArray(2048*2048)})((arr:DenseVector[Double]) => {
    exp(arr)
  })

  def timeMappingUfuncArray(reps: Int) = runWith(reps, {randomArray(2048*2048)})((arr:DenseVector[Double]) => {
    val data = arr.data
    var i=0
    while (i < data.size) {
      data(i) = exp(data(i))
      i += 1
    }
    data
  })

}

package breeze.linalg

import breeze.benchmark._
import breeze.generic.{MappingUFunc, UFunc}

import breeze.linalg._
import breeze.stats.distributions._
import breeze.numerics._
import spire.implicits._

object MappingUfuncBenchmark extends MyRunner(classOf[MappingUfuncBenchmark])

object addOne extends UFunc with MappingUFunc {
  //A custom stupid ufunc that is very fast to run
  implicit object expDoubleImpl extends Impl[Double, Double] { def apply(v: Double) = v+1 }
}

class MappingUfuncBenchmark extends BreezeBenchmark with BuildsRandomMatrices with BuildsRandomVectors {
  def timeMappingUfuncDenseMat(reps: Int) = runWith(reps, {randomMatrix(2048,2048)})((mat:DenseMatrix[Double]) => {
    addOne(mat)
  })

  def timeMappingUfuncDenseVec(reps: Int) = runWith(reps, {randomArray(2048*2048)})((arr:DenseVector[Double]) => {
    addOne(arr)
  })

  def timeMappingUfuncArray(reps: Int) = runWith(reps, {randomArray(2048*2048)})((arr:DenseVector[Double]) => {
    val data = arr.data
    var i=0
    while (i < data.size) {
      data(i) = addOne(data(i))
      i += 1
    }
    data
  })

}

Update benchmark to avoid spending so much time inside implementation of ufunc.


package scala.tools.eclipse
package structurebuilder

import org.junit._
import scala.tools.eclipse.testsetup.SDTTestUtils
import org.eclipse.jdt.core._
import org.eclipse.core.runtime.Path

class StructureBuilderTest {

  var project: ScalaProject = _

  def setupWorkspace {
    // auto-building is off
    val desc = SDTTestUtils.workspace.getDescription
    desc.setAutoBuilding(false)
    SDTTestUtils.workspace.setDescription(desc)
    ScalaPlugin
  }

  def traversePackage(pkg: IPackageFragment) {
    for (unit <- pkg.getChildren) {
      openAll(unit)
      println("-" * 10 + unit + "-" * 10)
    }
  }

  def openAll(elem: IJavaElement) {
    elem match {
      case parent: IParent =>
        parent.getOpenable.open(null)
        parent.getChildren.foreach(openAll)
      case _ => ()
    }
  }

  @Before def setupProject {

    project = SDTTestUtils.setupProject("simple-structure-builder")
    println(project)
  }

  @Test def testStructure() {
    val javaProject = JavaCore.create(project.underlying)

    javaProject.open(null)
    val srcPackageRoot = javaProject.findPackageFragmentRoot(new Path("/simple-structure-builder/src"))
    Assert.assertNotNull(srcPackageRoot)

    srcPackageRoot.open(null)
    for (pkg <- srcPackageRoot.getChildren) pkg match {
      case p: IPackageFragment => traversePackage(p)
      case _ => println("unknown " + pkg)
    }

  }
}

package scala.tools.eclipse
package structurebuilder

import org.junit._
import scala.tools.eclipse.testsetup.SDTTestUtils
import org.eclipse.jdt.core._
import org.eclipse.core.runtime.Path

class StructureBuilderTest {

  var project: ScalaProject = _

  def setupWorkspace {
    // auto-building is off
    val desc = SDTTestUtils.workspace.getDescription
    desc.setAutoBuilding(false)
    SDTTestUtils.workspace.setDescription(desc)
    ScalaPlugin
  }

  def traversePackage(pkg: IPackageFragment) {
    for (unit <- pkg.getChildren) {
      openAll(unit)
      println("-" * 10 + unit + "-" * 10)
    }
  }

  def openAll(elem: IJavaElement) {
    elem match {
      case parent: IParent =>
        println(parent + ": " + parent.getClass)
        parent.getOpenable.open(null)
        parent.getChildren.foreach(openAll)
      case _ => ()
    }
  }

  @Before def setupProject {

    project = SDTTestUtils.setupProject("simple-structure-builder")
    println(project)
  }

  @Test def testStructure() {
    val javaProject = JavaCore.create(project.underlying)

    javaProject.open(null)
    val srcPackageRoot = javaProject.findPackageFragmentRoot(new Path("/simple-structure-builder/src"))
    Assert.assertNotNull(srcPackageRoot)

    srcPackageRoot.open(null)
    for (pkg <- srcPackageRoot.getChildren) pkg match {
      case p: IPackageFragment => traversePackage(p)
      case _ => println("unknown " + pkg)
    }

  }
}

Print the runtime type of JavaElements.

Print the runtime type of JavaElements.


package org.clulab.twitter4food.util

import com.typesafe.config.ConfigFactory

object DataStats {
  def main(args: Array[String]): Unit = {
    val dataset = if (args.isEmpty) "overweight" else args.head

    val config = ConfigFactory.load

    val train = FileUtils.load(config.getString(s"classifiers.$dataset.trainingData")).toSeq
    val dev = FileUtils.load(config.getString(s"classifiers.$dataset.devData")).toSeq
    val test = FileUtils.load(config.getString(s"classifiers.$dataset.testData")).toSeq

    val dsMap = Map("train" -> train, "dev" -> dev, "test" -> test)

    println("partition,label,numAccounts,totalTweets,tweetsPerAccount,totalTokens,tokensPerTweet")
    dsMap.foreach { case (partition, ds) =>
      val byLabel = ds.groupBy(_._2)
      byLabel.foreach { case (lbl, acctsWithLbls) =>
        val (accts, lbls) = acctsWithLbls.unzip
        val numAccts = accts.length
        val totalTweets = accts.map(_.tweets.length).sum
        val tPerAccount = totalTweets.toDouble / numAccts
        val totalTokens = accts.flatMap(_.tweets.map(_.text.split(" +").length)).sum
        val tPerTweet = totalTokens.toDouble / totalTweets
        println(f"$partition,$lbl,$numAccts,$totalTweets,$tPerAccount%1.0f,$totalTokens,$tPerTweet%1.1f")
      }
    }
  }
}

package org.clulab.twitter4food.util

import com.typesafe.config.ConfigFactory

object DataStats {
  def main(args: Array[String]): Unit = {
    val dataset = if (args.isEmpty) "overweight" else args.head

    val config = ConfigFactory.load

    val train = FileUtils.load(config.getString(s"classifiers.$dataset.trainingData")).toSeq
    val dev = FileUtils.load(config.getString(s"classifiers.$dataset.devData")).toSeq
    val test = FileUtils.load(config.getString(s"classifiers.$dataset.testData")).toSeq
    val total = train ++ dev ++ test

    val dsMap = Map("train" -> train, "dev" -> dev, "test" -> test, "total" -> total)

    println("partition,label,numAccounts,totalTweets,tweetsPerAccount,totalTokens,tokensPerTweet")
    dsMap.foreach { case (partition, ds) =>
      val byLabel = ds.groupBy(_._2)
      byLabel.foreach { case (lbl, acctsWithLbls) =>
        val (accts, lbls) = acctsWithLbls.unzip
        val numAccts = accts.length
        val totalTweets = accts.map(_.tweets.length).sum
        val tPerAccount = totalTweets.toDouble / numAccts
        val totalTokens = accts.flatMap(_.tweets.map(_.text.split(" +").length)).sum
        val tPerTweet = totalTokens.toDouble / totalTweets
        println(f"$partition,$lbl,$numAccts,$totalTweets,$tPerAccount%1.0f,$totalTokens,$tPerTweet%1.1f")
      }
    }
  }
}

Include summary over whole corpus

Include summary over whole corpus


package com.sksamuel.elastic4s

import org.elasticsearch.script.ScriptService
import org.elasticsearch.script.ScriptService.ScriptType

trait ScriptFieldDsl {
  case class ExpectsScript(field: String) {
    def script(script: String): ScriptFieldDefinition = ScriptFieldDefinition(field, script, None, None)
  }
}

case class ScriptFieldDefinition(field: String,
                                 script: String,
                                 language: Option[String] = None,
                                 parameters: Option[Map[String, AnyRef]] = None,
                                 scriptType: ScriptService.ScriptType = ScriptService.ScriptType.INLINE) {
  def lang(l: String): ScriptFieldDefinition = copy(language = Option(l))
  def params(p: Map[String, Any]): ScriptFieldDefinition = {
    copy(parameters = Some(p.map(e => e._1 -> e._2.asInstanceOf[AnyRef])))
  }
  def params(ps: (String, Any)*): ScriptFieldDefinition = {
    copy(parameters = Some(ps.toMap.map(e => e._1 -> e._2.asInstanceOf[AnyRef])))
  }
  def scriptType(scriptType: ScriptType): ScriptFieldDefinition = copy(scriptType = scriptType)
}

package com.sksamuel.elastic4s

import org.elasticsearch.script.ScriptService
import org.elasticsearch.script.ScriptService.ScriptType

trait ScriptFieldDsl {
  case class ExpectsScript(field: String) {
    def script(script: String): ScriptFieldDefinition = ScriptFieldDefinition(field, script, None, None)
  }
}

case class ScriptFieldDefinition(field: String,
                                 script: String,
                                 language: Option[String] = None,
                                 parameters: Option[Map[String, AnyRef]] = None,
                                 scriptType: ScriptService.ScriptType = ScriptService.ScriptType.INLINE) {
  def lang(l: String): ScriptFieldDefinition = copy(language = Option(l))
  def params(p: Map[String, Any]): ScriptFieldDefinition = {
    copy(parameters = Some(p.map(e => e._1 -> e._2.asInstanceOf[AnyRef])))
  }
  def params(ps: (String, Any)*): ScriptFieldDefinition = {
    copy(parameters = Some(ps.toMap.map(e => e._1 -> e._2.asInstanceOf[AnyRef])))
  }
  def scriptType(scriptType: ScriptService.ScriptType): ScriptFieldDefinition = copy(scriptType = scriptType)
}

Add parameter ScriptType to ScriptFieldDefinition


/*
 * Copyright 2010-2011 WorldWide Conferencing, LLC
 *
 * 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 net.liftweb
package http

import org.specs2.mutable.Specification

/**
 * System under specification for ResourceServer.
 */
class ResourceServerSpec extends Specification  {
  "ResourceServer Specification".title

  "ResourceServer.pathRewriter" should {
    "not default jquery.js to jquery-1.3.2" in {
      ResourceServer.pathRewriter("jquery.js"::Nil) must_== List("jquery.js")
    }

    "default json to json2 minified version" in {
      (ResourceServer.pathRewriter("json.js"::Nil) must_== List("json2-min.js")) and
      (ResourceServer.pathRewriter("json2.js"::Nil) must_== List("json2-min.js"))
    }
  }
}

/*
 * Copyright 2010-2011 WorldWide Conferencing, LLC
 *
 * 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 net.liftweb
package http

import org.specs2.mutable.Specification

/**
 * System under specification for ResourceServer.
 */
class ResourceServerSpec extends Specification  {
  "ResourceServer Specification".title

  "ResourceServer.pathRewriter" should {
    "not default jquery.js to jquery-1.3.2" in {
      ResourceServer.pathRewriter("jquery.js"::Nil) must_== List("jquery.js")
    }

    "default json to json2 minified version" in {
      (ResourceServer.pathRewriter("json.js"::Nil) must_== List("json2-min.js")) and
      (ResourceServer.pathRewriter("json2.js"::Nil) must_== List("json2-min.js"))
    }.pendingUntilFixed
  }
}

Mark minified spec as pending until fixed


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.99"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.9",
      "com.ning" % "async-http-client" % "1.9.39",
      "org.scalatest" %% "scalatest" % "3.0.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 com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.1.0"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.9",
      "com.ning" % "async-http-client" % "1.9.39",
      "org.scalatest" %% "scalatest" % "3.0.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.0


name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.11"

version := "0.1.1"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.2",
      "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")
  }
}

name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.11"

version := "0.1.2"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.2",
      "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")
  }
}

autocommit: Update configuration to record version 0.1.2


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" % "2.2.6" % 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.0.2"

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" % "2.2.6" % 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.0.3"

autocommit: Update configuration to record version 0.0.3


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.88"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.8",
      "com.ning" % "async-http-client" % "1.9.39",
      "org.scalatest" %% "scalatest" % "2.2.6" % 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 com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.89"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.8",
      "com.ning" % "async-http-client" % "1.9.39",
      "org.scalatest" %% "scalatest" % "2.2.6" % 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.0.89


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.87"

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.88"

autocommit: Update configuration to record version 0.1.88


androidBuildAar

autoScalaLibrary := false

githubProject := "floatinglabellayout"

javacOptions ++=
    "-source" :: "1.7" ::
    "-target" :: "1.7" ::
    Nil

libraryDependencies ++=
    "com.android.support" % "design" % "23.2.0" ::
    Nil

minSdkVersion := "7"

name := "FloatingLabelLayout"

normalizedName := "floating-label-layout"

organization := "io.taig.android"

platformTarget := "android-23"

publishArtifact in ( Compile, packageDoc ) := false

scalaVersion := "2.11.7"

scalacOptions ++=
    "-deprecation" ::
    "-feature" ::
    Nil

targetSdkVersion := "23"

typedResources := false

version := "1.1.3"

androidBuildAar

autoScalaLibrary := false

githubProject := "floatinglabellayout"

javacOptions ++=
    "-source" :: "1.7" ::
    "-target" :: "1.7" ::
    Nil

libraryDependencies ++=
    "com.android.support" % "design" % "23.2.1" ::
    Nil

minSdkVersion := "7"

name := "FloatingLabelLayout"

normalizedName := "floating-label-layout"

organization := "io.taig.android"

platformTarget := "android-23"

publishArtifact in ( Compile, packageDoc ) := false

scalaVersion := "2.11.7"

scalacOptions ++=
    "-deprecation" ::
    "-feature" ::
    Nil

targetSdkVersion := "23"

typedResources := false

version := "1.1.3"

Upgrade to android support library 23.2.1


lazy val gallery = project.in( file( "." ) )
    .enablePlugins( AndroidLib )
    .settings( Settings.common )
    .settings(
        libraryDependencies ++=
            "com.android.support" % "appcompat-v7" % "25.0.1" ::
            "com.github.chrisbanes" % "PhotoView" % "1.3.1" ::
            "com.github.jkwiecien" % "EasyImage" % "1.3.1" ::
            "com.github.square.picasso" % "picasso" % "059993e3cc" ::
            "com.google.android" % "flexbox" % "0.2.5" ::
            Nil,
        name := "gallery",
        publishArtifact in ( Compile, packageDoc ) := false,
        renderVectorDrawables := true,
        resolvers += Resolver.jcenterRepo
    )

lazy val sample = project
    .enablePlugins( AndroidApp )
    .settings( Settings.common )
    .settings(
        organization := organization.value + ".gallery.sample",
        run := ( run in Android ).evaluated
    )
    .dependsOn( gallery )

lazy val gallery = project.in( file( "." ) )
    .enablePlugins( AndroidLib )
    .settings( Settings.common )
    .settings(
        libraryDependencies ++=
            "com.android.support" % "appcompat-v7" % "25.1.0" ::
            "com.github.chrisbanes" % "PhotoView" % "1.3.1" ::
            "com.github.jkwiecien" % "EasyImage" % "1.3.1" ::
            "com.github.square.picasso" % "picasso" % "059993e3cc" ::
            "com.google.android" % "flexbox" % "0.2.5" ::
            Nil,
        name := "gallery",
        publishArtifact in ( Compile, packageDoc ) := false,
        renderVectorDrawables := true,
        resolvers += Resolver.jcenterRepo
    )

lazy val sample = project
    .enablePlugins( AndroidApp )
    .settings( Settings.common )
    .settings(
        organization := organization.value + ".gallery.sample",
        run := ( run in Android ).evaluated
    )
    .dependsOn( gallery )

Upgrade to Android support library 25.1.0


name := "gatsby"

version := "0.1.0"

scalaVersion := "2.11.2"

crossScalaVersions := Seq("2.11.2", "2.10.4")

organization := "com.themillhousegroup"

libraryDependencies ++= Seq(
    "ch.qos.logback"        %   "logback-classic"       % "1.1.2",
    "org.mockito"           %   "mockito-all"           % "1.9.0",
    "org.specs2"            %%  "specs2"                % "2.3.12"      % "test"
)

resolvers ++= Seq(  "oss-snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
                    "oss-releases"  at "https://oss.sonatype.org/content/repositories/releases",
                    "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/")

jacoco.settings

credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")

publishTo := Some("Cloudbees releases" at "https://repository-themillhousegroup.forge.cloudbees.com/"+ "release")

scalariformSettings

net.virtualvoid.sbt.graph.Plugin.graphSettings

name := "gatsby"

version := "0.1.0"

scalaVersion := "2.10.4"

organization := "com.themillhousegroup"

libraryDependencies ++= Seq(
    "io.gatling.highcharts" %   "gatling-charts-highcharts"   % "2.0.0",
    "com.dividezero"        %% "stubby-standalone"            % "1.2",
    "ch.qos.logback"        %   "logback-classic"             % "1.1.2",
    "org.mockito"           %   "mockito-all"                 % "1.9.0",
    "org.specs2"            %%  "specs2"                      % "2.3.12"      % "test"
)

resolvers ++= Seq(  "oss-snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
                    "oss-releases"  at "https://oss.sonatype.org/content/repositories/releases",
                    "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/")

jacoco.settings

credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")

publishTo := Some("Cloudbees releases" at "https://repository-themillhousegroup.forge.cloudbees.com/"+ "release")

scalariformSettings

net.virtualvoid.sbt.graph.Plugin.graphSettings

Bring in the all-important dependencies

Bring in the all-important dependencies


import sbt._
import Keys._

object SbtIdeaBuild extends Build {
	lazy val sbtIdea = Project("sbt-idea", file("."), settings = mainSettings)

	lazy val mainSettings: Seq[Project.Setting[_]] = Defaults.defaultSettings ++	ScriptedPlugin.scriptedSettings ++ Seq(
		sbtPlugin := true,
		organization := "com.github.mpeltonen",
		name := "sbt-idea",
		version := "0.10.0",
		publishTo := Some(Resolver.file("Github Pages", Path.userHome / "git" / "mpeltonen.github.com" / "maven" asFile)(Patterns(true, Resolver.mavenStyleBasePattern))),
		scalacOptions ++= Seq("-deprecation", "-unchecked"),
    libraryDependencies ++= scriptedTestHelperDependencies
	)

  private def scriptedTestHelperDependencies = Seq(
    "commons-io" % "commons-io" % "2.0.1"
  )
}

import sbt._
import Keys._

object SbtIdeaBuild extends Build {
	lazy val sbtIdea = Project("sbt-idea", file("."), settings = mainSettings)

	lazy val mainSettings: Seq[Project.Setting[_]] = Defaults.defaultSettings ++	ScriptedPlugin.scriptedSettings ++ Seq(
		sbtPlugin := true,
		organization := "com.github.mpeltonen",
		name := "sbt-idea",
		version := "0.10.1-SNAPSHOT",
		publishTo := Some(Resolver.file("Github Pages", Path.userHome / "git" / "mpeltonen.github.com" / "maven" asFile)(Patterns(true, Resolver.mavenStyleBasePattern))),
		scalacOptions ++= Seq("-deprecation", "-unchecked"),
    libraryDependencies ++= scriptedTestHelperDependencies
	)

  private def scriptedTestHelperDependencies = Seq(
    "commons-io" % "commons-io" % "2.0.1"
  )
}

Set next development snapshot version

Set next development snapshot version


addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.0")
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.14")
addSbtPlugin("ohnosequences" % "sbt-github-release" % "0.7.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")

// https://github.com/ohnosequences/sbt-github-release/issues/28#issuecomment-426086656
libraryDependencies += "com.sun.activation" % "javax.activation" % "1.2.0"

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.0")
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.12.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.14")
addSbtPlugin("ohnosequences" % "sbt-github-release" % "0.7.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")

// https://github.com/ohnosequences/sbt-github-release/issues/28#issuecomment-426086656
libraryDependencies += "com.sun.activation" % "javax.activation" % "1.2.0"

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


addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.13")

addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14")

Update sbt-scala-module plugin to avoid inlining from stdlib


addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.0")

val sbtSoftwareMillVersion = "2.0.9"
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion)
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion)
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-browser-test-js" % sbtSoftwareMillVersion)

addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")

addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.1")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.5")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.0")

val sbtSoftwareMillVersion = "2.0.9"
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion)
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion)
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-browser-test-js" % sbtSoftwareMillVersion)

addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")

addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.1")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")

Update nscplugin, sbt-scala-native, ... to 0.4.5


package com.gu.teamcity

import jetbrains.buildServer.serverSide.{SBuild, BuildServerListener}
import jetbrains.buildServer.util.EventDispatcher

class S3Plugin(eventDispatcher: EventDispatcher[BuildServerListener], s3: S3, s3ConfigManager: S3ConfigManager) {
  eventDispatcher.addListener(new ArtifactUploader(s3ConfigManager, s3))
  eventDispatcher.addListener(new ManifestUploader(s3ConfigManager, s3))
  eventDispatcher.addListener(new TagUploader(s3ConfigManager, s3))
}

object S3Plugin {
  def cleanFullName(build: SBuild): String = build.getFullName.split(" :: ").mkString("::")
}

package com.gu.teamcity

import jetbrains.buildServer.serverSide.{SBuild, BuildServerListener}
import jetbrains.buildServer.util.EventDispatcher

class S3Plugin(eventDispatcher: EventDispatcher[BuildServerListener], s3: S3, s3ConfigManager: S3ConfigManager) {
  eventDispatcher.addListener(new ArtifactUploader(s3ConfigManager, s3))
  eventDispatcher.addListener(new ManifestUploader(s3ConfigManager, s3))
  eventDispatcher.addListener(new TagUploader(s3ConfigManager, s3))
}

object S3Plugin {
  def cleanFullName(build: SBuild): String = build.getFullName.split(" / ").mkString("::")
}

Change name cleaner to replace ' / ' instead of ' :: ' following change in TC version 2018.1.


package plainFP

object ConfigAPI {
  case class Config(name: String, age: Int)
  case class Name(first: String, last: String)
  case class Age(age: Int)
  case class Person(name: Name, age: Age)

  def readName(name: String): Option[Name] = {
    val parts = name.split(" ")
    if (parts.length >= 2) Some(Name(parts(0), parts.tail.mkString(" ")))
    else None
  }

  def readAge(age: Int): Option[Age] = {
    if (1 <= age && age <= 150) Some(Age(age))
    else None
  }

  def readPerson(config: Config): Option[Person] = {
    for {
      name <- readName(config.name)
      age <- readAge(config.age)
    } yield Person(name, age)
  }
}

object ConfigApp extends App {
  import ConfigAPI._

  println(readPerson(Config("John Doe", 20)))
  println(readPerson(Config("Incognito", 99)))
  println(readPerson(Config("John Doe", 170)))
}

package plainFP

object ConfigAPI {
  case class Config(name: String, age: Int)
  case class Name(first: String, last: String)
  case class Age(age: Int)
  case class Person(name: Name, age: Age)

  def readName(name: String): Option[Name] = {
    val parts = name.split(" ")
    if (parts.length >= 2) Some(Name(parts(0), parts.tail.mkString(" ")))
    else None
  }

  def readAge(age: Int): Option[Age] = {
    if (1 <= age && age <= 150) Some(Age(age))
    else None
  }

  def readPerson(config: Config): Option[Person] = {
    for {
      name <- readName(config.name)
      age <- readAge(config.age)
    } yield Person(name, age)
  }

  // or better:
  def optMap2[A, B, C](f: (A, B) => C)(optA: Option[A], optB: Option[B]) =
    for {a <- optA; b <- optB} yield f(a, b)
}

object ConfigApp extends App {
  import ConfigAPI._

  val config1 = Config("John Doe", 20)
  println(readPerson(config1))
  println(optMap2(Person)(readName(config1.name), readAge(config1.age)))
  println(optMap2(Tuple2[Name, Age])(readName(config1.name), readAge(config1.age)))
  val config2 = Config("Incognito", 99)
  println(readPerson(config2))
  println(optMap2(Person)(readName(config2.name), readAge(config2.age)))
  val config3 = Config("John Doe", 170)
  println(readPerson(config3))
  println(optMap2(Person)(readName(config3.name), readAge(config3.age)))
}

Add better solution for readPerson

Add better solution for readPerson


package controllers

import com.google.inject.Inject
import models.{AllCacheKeys}
import play.api.mvc.{Action, Controller}
import play.api.Logger
import uk.gov.dvla.vehicles.presentation.common
import common.clientsidesession.ClientSideSessionFactory
import common.clientsidesession.CookieImplicits.RichResult
import common.model.VehicleAndKeeperDetailsModel
import common.clientsidesession.CookieImplicits.RichCookies
import utils.helpers.Config

class SuppressedV5C @Inject()()(implicit clientSideSessionFactory: ClientSideSessionFactory,
                                         config: Config) extends Controller {

  def present = Action { implicit request =>
    Ok(views.html.disposal_of_vehicle.suppressedV5C())
  }

  def buyAnotherVehicle = Action { implicit request =>
    Redirect(routes.VehicleLookup.present())//.
  }

  def finish = Action { implicit request =>
    Redirect(routes.BeforeYouStart.present()).
      discardingCookies(AllCacheKeys)
  }
}

package controllers

import com.google.inject.Inject
import models.{AllCacheKeys, DisposeCacheKeys}
import play.api.mvc.{Action, Controller}
import play.api.Logger
import uk.gov.dvla.vehicles.presentation.common
import common.clientsidesession.ClientSideSessionFactory
import common.clientsidesession.CookieImplicits.RichResult
import common.model.VehicleAndKeeperDetailsModel
import common.clientsidesession.CookieImplicits.RichCookies
import utils.helpers.Config

class SuppressedV5C @Inject()()(implicit clientSideSessionFactory: ClientSideSessionFactory,
                                         config: Config) extends Controller {

  def present = Action { implicit request =>
    Ok(views.html.disposal_of_vehicle.suppressedV5C())
  }

  def buyAnotherVehicle = Action { implicit request =>
    Redirect(routes.VehicleLookup.present()).
      discardingCookies(DisposeCacheKeys)
  }

  def finish = Action { implicit request =>
    Redirect(routes.BeforeYouStart.present()).
      discardingCookies(AllCacheKeys)
  }
}

US2343: Clear vehicle details cookie on buy-another-vehicle.


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

addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.2.1")

// 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.12")

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

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

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

addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.2.1")

// 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.13")

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

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

Update sbt-wartremover, wartremover to 2.4.13


resolvers ++= Seq(
  Classpaths.typesafeReleases,
  Classpaths.sbtPluginReleases,
  "jgit-repo" at "https://download.eclipse.org/jgit/maven",
  Resolver.url("scoverage-bintray", url("https://dl.bintray.com/sksamuel/sbt-plugins/"))(Resolver.ivyStylePatterns),
  Resolver.sonatypeRepo("snapshots")
)

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2-1")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.4")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0")
addSbtPlugin("com.47deg"  % "sbt-microsites" % "1.2.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.10")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.21")

resolvers ++= Seq(
  Classpaths.typesafeReleases,
  Classpaths.sbtPluginReleases,
  "jgit-repo" at "https://download.eclipse.org/jgit/maven",
  Resolver.url("scoverage-bintray", url("https://dl.bintray.com/sksamuel/sbt-plugins/"))(Resolver.ivyStylePatterns),
  Resolver.sonatypeRepo("snapshots")
)

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.2-1")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.4")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.0")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.2.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.19")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.21")

Update sbt-wartremover, wartremover to 2.4.19


addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.13.1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.23")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.27")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "0.6.0")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.2")

addSbtCoursier

libraryDependencies ++= List(
  "io.github.bonigarcia" % "webdrivermanager" % "3.6.1",
  "com.thesamet.scalapb" %% "compilerplugin-shaded" % "0.8.4",
  "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
)

addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.13.1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.thesamet" % "sbt-protoc" % "0.99.23")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.27")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-crossproject" % "0.6.0")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.2")

addSbtCoursier

libraryDependencies ++= List(
  "io.github.bonigarcia" % "webdrivermanager" % "3.6.1",
  "com.thesamet.scalapb" %% "compilerplugin-shaded" % "0.9.1",
  "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
)

Update compilerplugin-shaded, ... to 0.9.1


libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.3.0"
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.28")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.9")

addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill" % "1.8.2")

libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "0.3.0"
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "0.6.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.3.9")

addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill" % "1.8.2")

Update sbt-scalajs, scalajs-compiler to 0.6.29


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

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

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

// 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.1")

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")

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

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

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

// 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.1")

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")

Enable debug mode in builds to debug travis.


name := "lib-apidoc-json-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.6"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.8",
      "org.scalatest" %% "scalatest" % "2.2.6" % 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")
  }
}

name := "lib-apidoc-json-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.7"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.8",
      "org.scalatest" %% "scalatest" % "2.2.6" % 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.0.7


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.6"

lazy val allScalacOptions = Seq(
  "-feature",
  "-Xfatal-warnings",
  "-unchecked",
  "-Xcheckinit",
  "-Xlint:adapted-args",
  "-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
  "-Wconf:src=generated/.*:silent",
  "-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes
)

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.11" % Test,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/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")
  }
}

scalacOptions ++= allScalacOptions

version := "0.3.0"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.6"

lazy val allScalacOptions = Seq(
  "-feature",
  "-Xfatal-warnings",
  "-unchecked",
  "-Xcheckinit",
  "-Xlint:adapted-args",
  "-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
  "-Wconf:src=generated/.*:silent",
  "-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes
)

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.11" % Test,
    ),
    credentials += Credentials(
      "Artifactory Realm",
      "flow.jfrog.io",
      System.getenv("ARTIFACTORY_USERNAME"),
      System.getenv("ARTIFACTORY_PASSWORD")
    )
  )

publishTo := {
  val host = "https://flow.jfrog.io/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")
  }
}

scalacOptions ++= allScalacOptions

version := "0.3.1"

autocommit: Update configuration to record version 0.3.1