scalaVersion := "2.11.8"

resolvers += Resolver.bintrayRepo("underscoreio", "training")

initialCommands in console := """
      |import doodle.core._
      |import doodle.core.Image._
      |import doodle.syntax._
      |import doodle.jvm.Java2DCanvas._
      |import doodle.backend.StandardInterpreter._
      |import doodle.examples._
    """.trim.stripMargin

cleanupCommands in console := """
      |doodle.jvm.quit()
    """.trim.stripMargin

libraryDependencies ++= Seq(
  "underscoreio" %% "doodle" % "0.6.1",
  "org.typelevel" %% "cats" % "0.4.1"
)

scalaVersion := "2.11.8"

resolvers += Resolver.bintrayRepo("underscoreio", "training")

initialCommands in console := """
      |import doodle.core._
      |import doodle.core.Image._
      |import doodle.syntax._
      |import doodle.jvm.Java2DCanvas._
      |import doodle.backend.StandardInterpreter._
      |import doodle.examples._
    """.trim.stripMargin

cleanupCommands in console := """
      |doodle.jvm.quit()
    """.trim.stripMargin

libraryDependencies ++= Seq(
  "underscoreio" %% "doodle" % "0.6.3",
  "org.typelevel" %% "cats" % "0.6.0"
)

Update Cats and Doodle version numbers

Update Cats and Doodle version numbers


/*
 * Telefónica Digital - Product Development and Innovation
 *
 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
 *
 * Copyright (c) Telefónica Investigación y Desarrollo S.A.U.
 * All rights reserved.
 */

package es.tid.cosmos.api.mocks

import scala.Some

import org.specs2.execute.{Result, AsResult}
import play.api.test.{WithApplication, FakeApplication}

class WithTestApplication(additionalConfiguration: Map[String, String] = Map.empty)
  extends WithApplication(new FakeApplication(
    withGlobal = Some(TestGlobal),
    additionalConfiguration = additionalConfiguration
  )) {

  import WithTestApplication.ConfigFileProperty

  def services = TestGlobal.application.services

  override def around[T: AsResult](block: => T): Result = {
    super.around {
      val oldValue = Option(System.getProperty(ConfigFileProperty))
      System.setProperty(ConfigFileProperty, "cosmos-api/it/resources/test.conf")
      val result = block
      oldValue.foreach(v => System.setProperty(ConfigFileProperty, v))
      result
    }
  }
}

private object WithTestApplication {
  val ConfigFileProperty: String = "config.file"
}

/*
 * Telefónica Digital - Product Development and Innovation
 *
 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
 *
 * Copyright (c) Telefónica Investigación y Desarrollo S.A.U.
 * All rights reserved.
 */

package es.tid.cosmos.api.mocks

import scala.Some

import org.specs2.execute.{Result, AsResult}
import play.api.test.{WithApplication, FakeApplication}

class WithTestApplication(additionalConfiguration: Map[String, String] = Map.empty)
  extends WithApplication(new FakeApplication(
    withGlobal = Some(TestGlobal),
    additionalConfiguration = additionalConfiguration
  )) {

  import WithTestApplication.ConfigFileProperty

  def services = TestGlobal.application.services

  override def around[T: AsResult](block: => T): Result = {
    super.around {
      val oldValue = System.getProperty(ConfigFileProperty)
      try {
        System.setProperty(ConfigFileProperty, "cosmos-api/it/resources/test.conf")
        block
      } finally {
        System.setProperty(ConfigFileProperty, oldValue)
      }
    }
  }
}

private object WithTestApplication {
  val ConfigFileProperty: String = "config.file"
}

Fix config file override for testing

Fix config file override for testing


package nbmtools

import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import java.util.zip.ZipInputStream

object appendExternal {
    def apply(s: String): String = s + ".external"
    def unapply(s: String): Option[String] = {
        if (s.endsWith(".external"))
            Some(s.stripSuffix(".external"))
        else None
    }
}

class NbmInputStream(is: InputStream) extends ZipInputStream(is) {
    private var externalStream: Option[InputStream] = None

    def this(file: File) = { this(new FileInputStream(file)) }

    private def closeExternalStream() {
        externalStream match {
            case Some(es) => es.close()
            case None => ()
        }
    }

    override def getNextEntry() = {
        closeExternalStream()
        val originalEntry = super.getNextEntry
        if (originalEntry == null) null
        else
            originalEntry.getName match {
                case appendExternal(name) => {
                        val external = External.from(this)
                        externalStream = Some(external.openStream())
                        val entry = createZipEntry(name)
                        entry
                }
                case name => {
                        externalStream = None
                        originalEntry
                }
            }
    }

    override def read(b: Array[Byte], off: Int, len: Int): Int = {
        externalStream match {
            case None => super.read(b, off, len)
            case Some(es) => es.read(b, off, len)
        }
    }

    override def close() {
        closeExternalStream()
        super.close()
    }
}

package nbmtools

import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import java.util.zip.ZipInputStream

object appendExternal {
    def apply(s: String): String = s + ".external"
    def unapply(s: String): Option[String] = {
        if (s.endsWith(".external"))
            Some(s.stripSuffix(".external"))
        else None
    }
}

class NbmInputStream(is: InputStream) extends ZipInputStream(is) {
    private var externalStream: Option[InputStream] = None

    def this(file: File) = { this(new FileInputStream(file)) }

    private def closeExternalStream() {
        externalStream match {
            case Some(es) => es.close()
            case None => ()
        }
        externalStream = None
    }

    override def getNextEntry() = {
        closeExternalStream()
        val originalEntry = super.getNextEntry
        if (originalEntry == null) null
        else
            originalEntry.getName match {
                case appendExternal(name) => {
                        val external = External.from(this)
                        externalStream = Some(external.openStream())
                        val entry = createZipEntry(name)
                        entry
                }
                case name => originalEntry
            }
    }

    override def read(b: Array[Byte], off: Int, len: Int): Int = {
        externalStream match {
            case None => super.read(b, off, len)
            case Some(es) => es.read(b, off, len)
        }
    }

    override def close() {
        closeExternalStream()
        super.close()
    }
}

Fix: Set externalStream to None in closeExternalStream

because it affects the behavior of read


import org.specs2.mutable._

class WatcherSpec extends Specification {
  "When watching the queue it" should {
    "execute the task correctly" in {
      val command = "prioritizer $owner $repository $dir"
      val queue = new TestQueue
      val data = new TestDatabase
      val runner = new TestRunner(command)

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

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)

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

Test case for cmd task runner

Test case for cmd task runner


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

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.40"

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

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.41"

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


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

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

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.8"

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


name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.7.1",
      "org.apache.commons" % "commons-compress" % "1.18",
      "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.4.3"

name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.7.1",
      "org.apache.commons" % "commons-compress" % "1.18",
      "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.4.4"

autocommit: Update configuration to record version 0.4.4


name := "no-carrier"

version := "1.0"

scalaVersion := "2.11.5"

mainClass := Some("com.getbootstrap.no_carrier.Main")

resolvers ++= Seq("snapshots", "releases").map(Resolver.sonatypeRepo)

libraryDependencies += "com.jcabi" % "jcabi-github" % "0.24"

libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.1.0"

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

libraryDependencies += "org.specs2" %% "specs2" % "2.3.12" % "test"

scalacOptions := Seq("-unchecked", "-deprecation", "-feature", "–Xlint", "-encoding", "utf8")

scalacOptions in Test ++= Seq("-Yrangepos")

// parallelExecution in Test := false

Revolver.settings

name := "no-carrier"

version := "1.0"

scalaVersion := "2.11.5"

mainClass := Some("com.getbootstrap.no_carrier.Main")

resolvers ++= Seq("snapshots", "releases").map(Resolver.sonatypeRepo)

libraryDependencies += "com.jcabi" % "jcabi-github" % "0.24"

libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.1.0"

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

libraryDependencies += "org.specs2" %% "specs2" % "2.3.12" % "test"

// Because jcabi-github:

libraryDependencies += "com.google.code.findbugs" % "annotations" % "2.0.1"

scalacOptions := Seq("-unchecked", "-deprecation", "-feature", "–Xlint", "-encoding", "utf8")

scalacOptions in Test ++= Seq("-Yrangepos")

// parallelExecution in Test := false

Revolver.settings

Fix "Class javax.annotation.Nullable not found"


enablePlugins(MdocPlugin)

name := "rendering-service"

libraryDependencies ++= Seq(
  MdocLibrary.commonModel,
  MdocLibrary.renderingEngines,
  Library.circeGeneric,
  Library.http4sCirce,
  Library.http4sCore,
  Library.http4sDsl,
  Library.http4sBlazeServer,
  Library.logbackClassic,
  Library.properly,
  Library.scalaLogging,
  Library.scalacheck % "test"
)

// sbt-native-packager
enablePlugins(JavaServerAppPackaging, DebianPlugin)
debianPackageDependencies in Debian ++= Seq("libreoffice-writer", "wkhtmltopdf", "xvfb")
serverLoading in Debian := com.typesafe.sbt.packager.archetypes.ServerLoader.SystemV

mdocValidateCommands += "debian:packageBin"

enablePlugins(MdocPlugin)

name := "rendering-service"

libraryDependencies ++= Seq(
  MdocLibrary.commonModel,
  MdocLibrary.renderingEngines,
  Library.circeGeneric,
  Library.http4sCirce,
  Library.http4sCore,
  Library.http4sDsl,
  Library.http4sBlazeServer,
  Library.logbackClassic,
  Library.properly,
  Library.scalaLogging,
  Library.scalacheck % "test"
)

// sbt-native-packager
enablePlugins(JavaServerAppPackaging, DebianPlugin)
debianPackageDependencies in Debian ++= Seq(
  "libreoffice-writer",
  "pandoc",
  "texlive",
  "wkhtmltopdf",
  "xvfb"
)
serverLoading in Debian := com.typesafe.sbt.packager.archetypes.ServerLoader.SystemV

mdocValidateCommands += "debian:packageBin"

Add pandoc and texlive as dependencies

Add pandoc and texlive as dependencies


name := """reactive-elasticsearch-play"""

version := "1.0-SNAPSHOT"

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

javacOptions ++= Seq("-source", "1.8", "-target", "1.8")

libraryDependencies ++= Seq(
  "net.lingala.zip4j" % "zip4j" % "1.3.2",
  "org.testng" % "testng" % "6.8.8",
  "com.google.inject" % "guice" % "3.0",
  "org.elasticsearch" % "elasticsearch" % "1.5.1",
  "org.apache.tika" % "tika-core" % "1.7",
  "org.apache.tika" % "tika-parsers" % "1.7")

initialize := {
  val _ = initialize.value
  if (sys.props("java.specification.version") != "1.8")
    sys.error("Java 8 is required for this project.")
}

name := """reactive-elasticsearch-play"""

version := "1.0-SNAPSHOT"

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

javacOptions ++= Seq("-source", "1.8", "-target", "1.8")

libraryDependencies ++= Seq(
  "org.testng" % "testng" % "6.8.8",
  "org.mockito" % "mockito-all" % "1.9.5",
  "org.easytesting" % "fest-assert-core" % "2.0M10",
  "com.google.inject" % "guice" % "3.0",
  "org.elasticsearch" % "elasticsearch" % "1.5.1",
  "net.lingala.zip4j" % "zip4j" % "1.3.2",
  "org.apache.tika" % "tika-core" % "1.7",
  "org.apache.tika" % "tika-parsers" % "1.7")

initialize := {
  val _ = initialize.value
  if (sys.props("java.specification.version") != "1.8")
    sys.error("Java 8 is required for this project.")
}

Add FEST and MOCKITO librairies

Add FEST and MOCKITO librairies


import com.typesafe.sbt.SbtGhPages.ghpages
import com.typesafe.sbt.SbtGit._
import com.typesafe.sbt.SbtSite.site
import sbt.ScriptedPlugin._

versionWithGit

// library
// The library of PGP functions.
// Note:  We're going to just publish this to the sbt repo now.
lazy val library =
  Project("library", file("gpg-library")).settings(
    name := "pgp-library",
    libraryDependencies ++= Seq(bouncyCastlePgp, dispatchDependency, specs2 % "test", sbtIo % "test")
  )

// The sbt plugin.
lazy val plugin =
  Project("plugin", file("pgp-plugin")).
    dependsOn(library).
    settings(
      sbtPlugin := true,
      name := "sbt-pgp",
      libraryDependencies += dispatchDependency
    ).
    //settings(websiteSettings:_*).
    settings(scriptedSettings:_*).
    settings(
      scriptedLaunchOpts += s"-Dproject.version=${version.value}"
    )

// Website settings

site.settings

ghpages.settings

site.jekyllSupport()

site.includeScaladoc()

git.remoteRepo := "git@github.com:sbt/sbt-pgp.git"

site.addMappingsToSiteDir(mappings in packageDoc in Compile in library, "library/latest/api")

site.addMappingsToSiteDir(mappings in packageDoc in Compile in plugin, "plugin/latest/api")

// Release settings
Release.settings

// Disable publishing of root
publish := ()

publishLocal := ()

import com.typesafe.sbt.SbtGhPages.ghpages
import com.typesafe.sbt.SbtGit._
import com.typesafe.sbt.SbtSite.site
import sbt.ScriptedPlugin._

versionWithGit

// library
// The library of PGP functions.
// Note:  We're going to just publish this to the sbt repo now.
lazy val library =
  Project("library", file("gpg-library")).settings(
    name := "pgp-library",
    libraryDependencies ++= Seq(bouncyCastlePgp, dispatchDependency, specs2 % "test", sbtIo % "test")
  )

// The sbt plugin.
lazy val plugin =
  Project("plugin", file("pgp-plugin")).
    dependsOn(library).
    settings(
      sbtPlugin := true,
      name := "sbt-pgp",
      libraryDependencies += dispatchDependency,
      publishLocal <<= publishLocal.dependsOn(publishLocal in library)
    ).
    //settings(websiteSettings:_*).
    settings(scriptedSettings:_*).
    settings(
      scriptedLaunchOpts += s"-Dproject.version=${version.value}"
    )

// Website settings

site.settings

ghpages.settings

site.jekyllSupport()

site.includeScaladoc()

git.remoteRepo := "git@github.com:sbt/sbt-pgp.git"

site.addMappingsToSiteDir(mappings in packageDoc in Compile in library, "library/latest/api")

site.addMappingsToSiteDir(mappings in packageDoc in Compile in plugin, "plugin/latest/api")

// Release settings
Release.settings

// Disable publishing of root
publish := ()

publishLocal := ()

Fix publishing os scripted works in automated clean machines.


val ext_libgdxVersion = "1.9.2"

val leavu3 = Project(id = "leavu3", base = file("."))
  .settings(
    organization := "se.gigurra",
    version := "SNAPSHOT",

    scalaVersion := "2.11.8",
    scalacOptions ++= Seq("-feature", "-unchecked", "-deprecation"),

    mainClass in assembly := Some("se.gigurra.leavu3.DesktopMain"),

    libraryDependencies ++= Seq(
      "com.badlogicgames.gdx" %   "gdx"                   % ext_libgdxVersion,
      "com.badlogicgames.gdx" %   "gdx-freetype"          % ext_libgdxVersion,
      "com.badlogicgames.gdx" %   "gdx-backend-lwjgl"     % ext_libgdxVersion,
      "com.badlogicgames.gdx" %   "gdx-platform"          % ext_libgdxVersion classifier "natives-desktop",
      "com.badlogicgames.gdx" %   "gdx-freetype-platform" % ext_libgdxVersion classifier "natives-desktop"
    )

  )
  .dependsOn(uri("git://github.com/GiGurra/service-utils.git#0.1.7"))

val ext_libgdxVersion = "1.9.2"

val leavu3 = Project(id = "leavu3", base = file("."))
  .settings(
    organization := "se.gigurra",
    version := "SNAPSHOT",

    scalaVersion := "2.11.8",
    scalacOptions ++= Seq("-feature", "-unchecked", "-deprecation"),

    mainClass in assembly := Some("se.gigurra.leavu3.DesktopMain"),

    libraryDependencies ++= Seq(
      "com.badlogicgames.gdx" %   "gdx"                   % ext_libgdxVersion,
      "com.badlogicgames.gdx" %   "gdx-freetype"          % ext_libgdxVersion,
      "com.badlogicgames.gdx" %   "gdx-backend-lwjgl"     % ext_libgdxVersion,
      "com.badlogicgames.gdx" %   "gdx-platform"          % ext_libgdxVersion classifier "natives-desktop",
      "com.badlogicgames.gdx" %   "gdx-freetype-platform" % ext_libgdxVersion classifier "natives-desktop"
    )

  )
  .dependsOn(uri("git://github.com/GiGurra/service-utils.git#0.1.10"))

Update service utils version (-> update finagle version)


name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.7.1",
      "org.apache.commons" % "commons-compress" % "1.18",
      "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.3.22"

name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.7.1",
      "org.apache.commons" % "commons-compress" % "1.18",
      "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.4.0"

autocommit: Update configuration to record version 0.4.0


name := "configs-root"

enablePlugins(Unpublished)

lazy val core = project
  .dependsOn(testutil % "test")
  .settings(
    name := "configs",
    Dependencies.core,
    scalapropsWithScalazlaws,
    compileOrder in Test := CompileOrder.JavaThenScala,
    initialCommands :=
      """import com.typesafe.config.ConfigFactory._
        |import configs._
        |import configs.syntax._
        |""".stripMargin
  )

lazy val bench = project
  .dependsOn(core, testutil)
  .enablePlugins(JmhPlugin, Unpublished)

lazy val testutil = project
  .enablePlugins(Unpublished)
  .settings(
    Dependencies.testutil
  )

lazy val docs = project
  .dependsOn(core % "test")
  .enablePlugins(Unpublished)
  .settings(
    Dependencies.docs,
    tutSettings,
    tutSourceDirectory := sourceDirectory.value / "tut"
  )

name := "configs-root"

enablePlugins(Unpublished)

lazy val core = project
  .dependsOn(testutil % "test")
  .settings(
    name := "configs",
    Dependencies.core,
    scalapropsWithScalazlaws,
    initialCommands :=
      """import com.typesafe.config.ConfigFactory._
        |import configs._
        |import configs.syntax._
        |""".stripMargin
  )

lazy val bench = project
  .dependsOn(core, testutil)
  .enablePlugins(JmhPlugin, Unpublished)

lazy val testutil = project
  .enablePlugins(Unpublished)
  .settings(
    Dependencies.testutil
  )

lazy val docs = project
  .dependsOn(core % "test")
  .enablePlugins(Unpublished)
  .settings(
    Dependencies.docs,
    tutSettings,
    tutSourceDirectory := sourceDirectory.value / "tut"
  )

Delete compileOrder setting no longer needed


organization := "com.lightbend.studentify"

name := "studentify"

version := "1.0.0"

scalaVersion := Version.scalaVer

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

libraryDependencies ++= Dependencies.studentify

scalacOptions ++= List(
  "-unchecked",
  "-deprecation",
  "-language:_",
  "-target:jvm-1.6",
  "-encoding", "UTF-8"
)

addCommandAlias("studentify", "runMain com.lightbend.coursegentools.Studentify")
addCommandAlias("linearize", "runMain com.lightbend.coursegentools.Linearize")
addCommandAlias("delinearize", "runMain com.lightbend.coursegentools.DeLinearize")

organization := "com.lightbend.studentify"

name := "studentify"

version := "1.0.0"

scalaVersion := Version.scalaVer

// The Typesafe repository
resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"
resolvers += Resolver.url("Typesafe Ivy Releases", url("http://repo.typesafe.com/typesafe/ivy-releases/"))(Resolver.ivyStylePatterns)

libraryDependencies ++= Dependencies.studentify

scalacOptions ++= List(
  "-unchecked",
  "-deprecation",
  "-language:_",
  "-target:jvm-1.6",
  "-encoding", "UTF-8"
)

addCommandAlias("studentify", "runMain com.lightbend.coursegentools.Studentify")
addCommandAlias("linearize", "runMain com.lightbend.coursegentools.Linearize")
addCommandAlias("delinearize", "runMain com.lightbend.coursegentools.DeLinearize")

Change resolver for Typesafe ivy releases to use IvyStylePatterns


package frmr.scyig.webapp.api

import frmr.scyig.db._
import frmr.scyig.webapp.auth.AuthenticationHelpers._
import net.liftweb.common._
import net.liftweb.http._
import net.liftweb.http.rest._
import net.liftweb.json._
import net.liftweb.json.JsonDSL._
import net.liftweb.util.Helpers._
import net.liftweb.util.CanResolveAsync.resolveFuture
import scala.concurrent.ExecutionContext.Implicits.global
import slick.jdbc.MySQLProfile.api._

object SuggestionApi extends RestHelper {
  serve {
    case Get("api" :: "v1" :: "competition" :: AsInt(competitionId) :: "team-suggestions" :: Nil, req) if currentUserId.is > 0 =>
      val nameQuery = S.param("q").openOr("")
      val query = Teams.to[List]
        .filter(_.name startsWith nameQuery)
        .filter(_.competitionId === competitionId)
        .result

      DB.run(query).map { teams =>
        val teamObjs = teams.map { team =>
          ("display" -> team.name) ~
          ("value" -> team.id)
        }

        JsonResponse(teamObjs)
      }
  }
}

package frmr.scyig.webapp.api

import frmr.scyig.db._
import frmr.scyig.webapp.auth.AuthenticationHelpers._
import net.liftweb.common._
import net.liftweb.http._
import net.liftweb.http.rest._
import net.liftweb.json._
import net.liftweb.json.JsonDSL._
import net.liftweb.util.Helpers._
import net.liftweb.util.CanResolveAsync.resolveFuture
import scala.concurrent.ExecutionContext.Implicits.global
import slick.jdbc.MySQLProfile.api._

object SuggestionApi extends RestHelper {
  serve {
    case Get("api" :: "v1" :: "competition" :: AsInt(competitionId) :: "team-suggestions" :: Nil, req) if currentUserId.is > 0 =>
      val nameQuery = S.param("q").openOr("")
      val query = Teams.to[List]
        .filter(_.name startsWith nameQuery)
        .filter(_.competitionId === competitionId)
        .result

      DB.run(query).map { teams =>
        val teamObjs = teams.map { team =>
          ("display" -> team.name) ~
          ("value" -> team.id)
        }

        JsonResponse(teamObjs)
      }

    case Get("api" :: "v1" :: "competition" :: AsInt(competitionId) :: "judge-suggestions" :: Nil, req) if currentUserId.is > 0 =>
      val nameQuery = S.param("q").openOr("")
      val query = Judges.to[List]
        .filter(_.name startsWith nameQuery)
        .filter(_.competitionId === competitionId)
        .result

      DB.run(query).map { judges =>
        val judgeObjs = judges.map { judge =>
          ("display" -> judge.name) ~
          ("value" -> judge.id)
        }

        JsonResponse(judgeObjs)
      }
  }
}

Build a judge suggestion api

Build a judge suggestion api


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.5"

crossScalaVersions := Seq("2.12.4", "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.68"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.5"

crossScalaVersions := Seq("2.12.4", "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.72"

autocommit: Update configuration to record version 0.1.72


name := "FoldOut"

organization := "com.roundeights"

version := "0.1"

scalaVersion := "2.10.3"

// Compiler flags
scalacOptions ++= Seq("-deprecation", "-feature")

// Repositories in which to find dependencies
resolvers ++= Seq(
    "Specs Repository" at "http://oss.sonatype.org/content/repositories/releases",
    "RoundEights" at "http://maven.spikemark.net/roundeights"
)

publishTo := Some("Spikemark" at "https://spikemark.herokuapp.com/maven/roundeights")

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

// Application dependencies
libraryDependencies ++= Seq(
    "com.roundeights" %% "scalon" % "0.1",
    "com.roundeights" %% "hasher" % "1.0.0",
    "com.ning" % "async-http-client" % "1.7.9",
    "org.slf4j" % "slf4j-simple" % "1.7.2",
    "commons-codec" % "commons-codec" % "1.7",
    "org.specs2" %% "specs2" % "2.3.4" % "test"
)

name := "FoldOut"

organization := "com.roundeights"

version := "0.1"

scalaVersion := "2.10.3"

// Compiler flags
scalacOptions ++= Seq("-deprecation", "-feature")

// Repositories in which to find dependencies
resolvers ++= Seq(
    "Specs Repository" at "http://oss.sonatype.org/content/repositories/releases",
    "RoundEights" at "http://maven.spikemark.net/roundeights"
)

publishTo := Some("Spikemark" at "https://spikemark.herokuapp.com/maven/roundeights")

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

// Application dependencies
libraryDependencies ++= Seq(
    "com.roundeights" %% "scalon" % "0.1",
    "com.roundeights" %% "hasher" % "1.0.0",
    "com.ning" % "async-http-client" % "1.8.8",
    "org.slf4j" % "slf4j-simple" % "1.7.2",
    "commons-codec" % "commons-codec" % "1.7",
    "org.specs2" %% "specs2" % "2.3.4" % "test"
)

Update http client to 1.8.8

Update http client to 1.8.8


resolvers += Classpaths.sbtPluginReleases

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

addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.10")

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

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")

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

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

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

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0")

addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")

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

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0")

resolvers += Classpaths.sbtPluginReleases

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

addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.10")

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

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")

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

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

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

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0")

addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")

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

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0")

Update sbt-scalajs, scalajs-compiler to 0.6.27


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.5"

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.8" % 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.2.81"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.5"

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.8" % 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.2.82"

autocommit: Update configuration to record version 0.2.82


name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.7"

crossScalaVersions := Seq("2.12.7")

version := "0.3.5"

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

name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.7"

crossScalaVersions := Seq("2.12.7")

version := "0.3.6"

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

autocommit: Update configuration to record version 0.3.6


androidBuildAar

autoScalaLibrary := false

githubProject := "floating-label-layout"

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

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

minSdkVersion := "7"

normalizedName := "floating-label-layout"

organization := "io.taig.android"

platformTarget := "android-24"

publishArtifact in ( Compile, packageDoc ) := false

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

typedResources := false

version := "1.1.10"

androidBuildAar

autoScalaLibrary := false

githubProject := "floating-label-layout"

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

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

minSdkVersion := "7"

normalizedName := "floating-label-layout"

organization := "io.taig.android"

platformTarget := "android-24"

publishArtifact in ( Compile, packageDoc ) := false

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

typedResources := false

version := "1.1.10"

Upgrade to Android support library 25.0.1


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

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

autocommit: Update configuration to record version 0.0.9


name := "shapeless"

organization := "com.chuusai"

version := "1.2.0-SNAPSHOT"

scalaVersion := "2.10.0-SNAPSHOT"

crossScalaVersions <<= (version) {
  v => Seq("2.9.1", "2.9.1-1", "2.9.2", "2.10.0-M2") ++ (if (v.endsWith("-SNAPSHOT")) Seq("2.10.0-SNAPSHOT") else Seq())
}

scalacOptions ++= Seq("-unchecked", "-deprecation")

scalacOptions <++= scalaVersion map { version =>
  val Version = """(\d+)\.(\d+)\..*"""r
  val Version(major0, minor0) = version map identity
  val (major, minor) = (major0.toInt, minor0.toInt)
  if (major < 2 || (major == 2 && minor < 10))
    Seq("-Ydependent-method-types")
 	else Nil
}

resolvers += ScalaToolsSnapshots

libraryDependencies ++= Seq(
  "com.novocode" % "junit-interface" % "0.7" % "test"
)

name := "shapeless"

organization := "com.chuusai"

version := "1.2.0-SNAPSHOT"

scalaVersion := "2.10.0-SNAPSHOT"

crossScalaVersions <<= (version) {
  v => Seq("2.9.1", "2.9.1-1", "2.9.2", "2.10.0-M2") ++ (if (v.endsWith("-SNAPSHOT")) Seq("2.10.0-SNAPSHOT") else Seq())
}

scalacOptions ++= Seq("-unchecked", "-deprecation")

scalacOptions <++= scalaVersion map { version =>
  val Some((major, minor)) = CrossVersion.partialVersion(version)
  if (major < 2 || (major == 2 && minor < 10))
    Seq("-Ydependent-method-types")
 	else Nil
}

resolvers += ScalaToolsSnapshots

libraryDependencies ++= Seq(
  "com.novocode" % "junit-interface" % "0.7" % "test"
)

Use CrossVersion.partialVersion to deconstruct Scala version.


package org.talkingpuffin.ui

import org.talkingpuffin.Session

trait ActionProcessor {
  val session: Session

  def process[T <: Object](items: Seq[T], action: ((T) => Unit), actionName: String, msg: String) =
    items.foreach(item =>
      session.addMessage(
        try {
          action(item)
          String.format(msg, item)
        } catch {
          case e: Throwable => "Error " + actionName + " " + item.toString
        }
      )
    )

}

package org.talkingpuffin.ui

import org.talkingpuffin.Session

trait ActionProcessor {
  val session: Session

  def process[T <: Any](items: Seq[T], action: ((T) => Unit), actionName: String, msg: String) =
    items.foreach(item =>
      session.addMessage(
        try {
          action(item)
          String.format(msg, item.asInstanceOf[Object])
        } catch {
          case e: Throwable => "Error " + actionName + " " + item.toString
        }
      )
    )

}

Switch type to Any, so Long and such can be used.


lazy val specs2Version = "4.10.2"
lazy val catsVersion   = "2.1.1"

libraryDependencies in Global ++=
  cats ++
  specs2

resolvers ++= Seq(
    Resolver.sonatypeRepo("releases")
  , Resolver.typesafeRepo("releases")
  , Resolver.url("ambiata-oss", new URL("https://ambiata-oss.s3.amazonaws.com"))(Resolver.ivyStylePatterns))

lazy val cats = Seq(
  "org.typelevel" %% "cats-core" % catsVersion)

lazy val specs2 = Seq(
    "org.specs2" %% "specs2-core"
  , "org.specs2" %% "specs2-matcher-extra"
  , "org.specs2" %% "specs2-scalacheck"
  , "org.specs2" %% "specs2-html"
  , "org.specs2" %% "specs2-junit").map(_ % specs2Version % "test")

lazy val specs2Version = "4.10.3"
lazy val catsVersion   = "2.1.1"

libraryDependencies in Global ++=
  cats ++
  specs2

resolvers ++= Seq(
    Resolver.sonatypeRepo("releases")
  , Resolver.typesafeRepo("releases")
  , Resolver.url("ambiata-oss", new URL("https://ambiata-oss.s3.amazonaws.com"))(Resolver.ivyStylePatterns))

lazy val cats = Seq(
  "org.typelevel" %% "cats-core" % catsVersion)

lazy val specs2 = Seq(
    "org.specs2" %% "specs2-core"
  , "org.specs2" %% "specs2-matcher-extra"
  , "org.specs2" %% "specs2-scalacheck"
  , "org.specs2" %% "specs2-html"
  , "org.specs2" %% "specs2-junit").map(_ % specs2Version % "test")

Update specs2-core, specs2-html, ... to 4.10.3


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

addSbtPlugin("org.scala-sbt" % "sbt-android-plugin" % "0.6.2-SNAPSHOT")

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

addSbtPlugin("org.scala-sbt" % "sbt-android-plugin" % "0.6.3-SNAPSHOT")

Upgrade Android plugin, requires SBT 0.12.0.

--HG--
extra : convert_revision : bd81495fca2faac4547c4aea6171060d8ba1406d


libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0"

addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"             % "0.9.30")
addSbtPlugin("com.github.sbt"     % "sbt-pgp"                  % "2.1.2")
addSbtPlugin("com.github.sbt"     % "sbt-release"              % "1.1.0")
addSbtPlugin("com.timushev.sbt"   % "sbt-updates"              % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
addSbtPlugin("org.scala-js"       % "sbt-jsdependencies"       % "1.0.2")
addSbtPlugin("org.scala-js"       % "sbt-scalajs"              % "1.6.0")
addSbtPlugin("org.xerial.sbt"     % "sbt-sonatype"             % "3.9.10")

libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0"

addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"             % "0.9.30")
addSbtPlugin("com.github.sbt"     % "sbt-pgp"                  % "2.1.2")
addSbtPlugin("com.github.sbt"     % "sbt-release"              % "1.1.0")
addSbtPlugin("com.timushev.sbt"   % "sbt-updates"              % "0.6.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
addSbtPlugin("org.scala-js"       % "sbt-jsdependencies"       % "1.0.2")
addSbtPlugin("org.scala-js"       % "sbt-scalajs"              % "1.7.0")
addSbtPlugin("org.xerial.sbt"     % "sbt-sonatype"             % "3.9.10")

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


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

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

libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value

ibraryDependencies += "net.databinder" %% "dispatch" % "0.8.10"

Add missing dispatch version to build.

Add missing dispatch version to build.


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

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

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

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

Upgrade sbt-sonatype to version 1.0

Upgrade sbt-sonatype to version 1.0


resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.20")

resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.1")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC5")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.2.20")

Add coursier plugin to speed up build

Add coursier plugin to speed up build

Summary: Problem/Solution:

Use coursier sbt plugin for a better Artifact Fetching, reduce sbt build time.

Result:

Build time down to 40 mins on average now.

JIRA Issues: CSL-4742

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


//NOTE: KEEP VERSIONS IN SYNC WITH ultimate/project/plugins.sbt
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0")
addSbtPlugin("org.jetbrains" % "sbt-idea-plugin" % "3.17.7")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")

// Only used for local development purposes, not in CI/CD.
// Should not be present in the scala-plugin-for-ultimate repos.
// See ../README.md for some examples of how to generate reports locally.
addSbtPlugin("org.scoverage" %% "sbt-scoverage" % "1.9.3")

libraryDependencies += "io.get-coursier" %% "coursier" % "2.0.16"

//NOTE: KEEP VERSIONS IN SYNC WITH ultimate/project/plugins.sbt
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0")
addSbtPlugin("org.jetbrains" % "sbt-idea-plugin" % "3.17.8")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")

// Only used for local development purposes, not in CI/CD.
// Should not be present in the scala-plugin-for-ultimate repos.
// See ../README.md for some examples of how to generate reports locally.
addSbtPlugin("org.scoverage" %% "sbt-scoverage" % "1.9.3")

libraryDependencies += "io.get-coursier" %% "coursier" % "2.0.16"

Update sbt-idea-plugin to 3.17.8 with workaround for slow light project tests


addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.9.2")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.0")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.6.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.9.2")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.0")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")


package io.continuum.bokeh

trait FillProps { self: HasFields with Vectorization =>
    object fill_color extends Vectorized[Color](Color.Gray)
    object fill_alpha extends Vectorized[Percent]
}

trait LineProps { self: HasFields with Vectorization =>
    object line_color extends Vectorized[Color](Color.Black)
    object line_width extends Vectorized[Double](1.0)
    object line_alpha extends Vectorized[Percent]
    object line_join extends Vectorized[LineJoin]
    object line_cap extends Vectorized[LineCap]
    object line_dash extends Vectorized[List[Int]]
    object line_dash_offset extends Vectorized[Int]
}

trait TextProps { self: HasFields with Vectorization =>
    object text_font extends Vectorized[String]
    object text_font_size extends Vectorized[FontSize](10 pt)
    object text_font_style extends Vectorized[FontStyle]
    object text_color extends Vectorized[Color](Color.Black)
    object text_alpha extends Vectorized[Percent]
    object text_align extends Vectorized[TextAlign]
    object text_baseline extends Vectorized[TextBaseline]
}

package io.continuum.bokeh

trait FillProps { self: HasFields with Vectorization =>
    object fill_color extends Vectorized[Color](Color.Gray)
    object fill_alpha extends Vectorized[Percent](1.0)
}

trait LineProps { self: HasFields with Vectorization =>
    object line_color extends Vectorized[Color](Color.Black)
    object line_width extends Vectorized[Double](1.0)
    object line_alpha extends Vectorized[Percent]
    object line_join extends Field[LineJoin]
    object line_cap extends Field[LineCap]
    object line_dash extends Field[List[Int]]
    object line_dash_offset extends Field[Int]
}

trait TextProps { self: HasFields with Vectorization =>
    object text_font extends Field[String]
    object text_font_size extends Vectorized[FontSize](12 pt)
    object text_font_style extends Field[FontStyle]
    object text_color extends Vectorized[Color]("#444444")
    object text_alpha extends Vectorized[Percent]
    object text_align extends Field[TextAlign]
    object text_baseline extends Field[TextBaseline]
}

Make sure mixins match the reference implementation


package com.twitter.scalding

import java.util.{ Date, Calendar }
import scala.annotation.tailrec

/**
 *
 */
object CalendarOps {
  def truncate(date: Calendar, field: Int): Calendar = {
    @tailrec
    def truncateIter(cal: Calendar, field: Int, currentField: Int): Calendar = {
      if (currentField > field) {
        currentField match {
          case Calendar.DAY_OF_MONTH => cal.set(currentField, 1)
          case Calendar.DAY_OF_WEEK_IN_MONTH => Unit // Skip
          case Calendar.DAY_OF_WEEK => Unit // Skip
          case Calendar.DAY_OF_YEAR => Unit // Skip
          case Calendar.WEEK_OF_MONTH => Unit // Skip
          case Calendar.WEEK_OF_YEAR => Unit // Skip
          case Calendar.HOUR_OF_DAY => Unit // Skip
          case _ => cal.set(currentField, 0)
        }

        truncateIter(cal, field, currentField - 1)
      } else {
        cal
      }
    }

    val cloned = date.clone().asInstanceOf[Calendar]

    truncateIter(cloned, field, Calendar.MILLISECOND)
  }

  def truncate(date: Date, field: Int): Date = {
    val cal = Calendar.getInstance();
    cal.setTime(date);

    truncate(cal, field).getTime();
  }

}

package com.twitter.scalding

import java.util.{ Date, Calendar }
import scala.annotation.tailrec

/**
 *
 */
object CalendarOps {
  def truncate(date: Calendar, field: Int): Calendar = {
    @tailrec
    def truncateIter(cal: Calendar, field: Int, currentField: Int): Calendar = {
      if (currentField > field) {
        currentField match {
          case Calendar.DAY_OF_MONTH => cal.set(currentField, 1)
          case Calendar.DAY_OF_WEEK_IN_MONTH => // Skip
          case Calendar.DAY_OF_WEEK => // Skip
          case Calendar.DAY_OF_YEAR => // Skip
          case Calendar.WEEK_OF_MONTH => // Skip
          case Calendar.WEEK_OF_YEAR => // Skip
          case Calendar.HOUR_OF_DAY => // Skip
          case _ => cal.set(currentField, 0)
        }

        truncateIter(cal, field, currentField - 1)
      } else {
        cal
      }
    }

    val cloned = date.clone().asInstanceOf[Calendar]

    truncateIter(cloned, field, Calendar.MILLISECOND)
  }

  def truncate(date: Date, field: Int): Date = {
    val cal = Calendar.getInstance();
    cal.setTime(date);

    truncate(cal, field).getTime();
  }

}

Replace unintentional use of `Unit` with `()`


package controllers

import javax.inject.Inject
import play.api.mvc.{Action, Controller}
import uk.gov.dvla.vehicles.presentation.common.clientsidesession.ClientSideSessionFactory
import utils.helpers.Config

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

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

package controllers

import javax.inject.Inject
import play.api.mvc.{Action, Controller}
import uk.gov.dvla.vehicles.presentation.common.clientsidesession.ClientSideSessionFactory
import uk.gov.dvla.vehicles.presentation.common.clientsidesession.CookieImplicits.RichResult
import utils.helpers.Config
import models.DisposeCacheKeys

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

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

DE289: Remove cookies when in duplicate error page.


scalaVersion := "2.13.4"

scalacOptions ++= Seq(
  "-Ywarn-unused"
)

scalaVersion := "2.13.5"

scalacOptions ++= Seq(
  "-Ywarn-unused"
)

Update dependency scala to v2.13.5

Update dependency scala to v2.13.5


import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName         = "admin"
  val appVersion      = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    jdbc,
    anorm,
    "org.quartz-scheduler" % "quartz" % "2.1.7",
    "com.lucidchart" %% "piezo-worker" % "1.2-SNAPSHOT"
  )

  val main = play.Project(appName, appVersion, appDependencies).settings(
    javacOptions in Compile ++= Seq("-source", "1.6", "-target", "1.6"),
    scalaVersion := "2.10.1",
    resolvers ++= List(
      Resolver.file("local ivy repository", file(System.getenv("HOME") + "/.ivy2/local/"))(Resolver.ivyStylePatterns),
      "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
    )
  )

}

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName         = "admin"
  val appVersion      = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    jdbc,
    anorm,
    "org.quartz-scheduler" % "quartz" % "2.1.7",
    "com.lucidchart" %% "piezo-worker" % "1.2-SNAPSHOT"
  )

  val main = play.Project(appName, appVersion, appDependencies).settings(
    javacOptions in Compile ++= Seq("-source", "1.6", "-target", "1.6"),
    scalaVersion := "2.10.1",
    resolvers ++= List(
      Resolver.file("local ivy repository", file(System.getenv("HOME") + "/.ivy2/local/"))(Resolver.ivyStylePatterns),
      "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
      "Staging Sonatype repository" at "https://oss.sonatype.org/content/groups/staging/"
    )
  )

}

Add sonatype staging repository to the resolvers


package lore

import lore.ast._
import lore.parser.{FileParser, FpExpressionParser}

import scala.io.Source

object Lore {
  def testCalculation(): Unit = {
    val source = Source.fromFile("examples/calculation.lore").getLines.mkString
    val parser = new FpExpressionParser()
    val expression = parser.parseExpression(source)
    val result = ExprAlgebra.evaluate(ExprAlgebra.evalAlgebra)(expression)
    println("FP  result: " + result)
  }

  def main(args: Array[String]): Unit = {
    // A new line is added at the end so the last statement has a closing newline.
    val source = Source.fromFile("examples/concat.lore").getLines.filter(_.trim.nonEmpty).mkString("\n") + "\n"
    println(source)
    val parser = new FileParser()
    val elements = parser.parse(source)

    println()
    println("Elements: ")
    elements.foreach(println)
  }
}

package lore

import lore.ast._
import lore.exceptions.FunctionNotFoundException
import lore.execution.Context
import lore.parser.{FileParser, FpExpressionParser}

import scala.io.Source

object Lore {
  def testCalculation(): Unit = {
    val source = Source.fromFile("examples/calculation.lore").getLines.mkString
    val parser = new FpExpressionParser()
    val expression = parser.parseExpression(source)
    val result = ExprAlgebra.evaluate(ExprAlgebra.evalAlgebra)(expression)
    println("FP  result: " + result)
  }

  def main(args: Array[String]): Unit = {
    // A new line is added at the end so the last statement has a closing newline.
    val source = Source.fromFile("examples/concat.lore").getLines.filter(_.trim.nonEmpty).mkString("\n") + "\n"
    println(source)
    val parser = new FileParser()
    val elements = parser.parse(source)

    println()
    println("Elements: ")
    elements.foreach(println)

    val context = Context.build(elements)

    println()
    println("Function fit for each call statement:")
    context.calls.foreach { call =>
      val multiFunction = context.multiFunctions.getOrElse(call.functionName, throw FunctionNotFoundException(call.functionName))
      val fit = multiFunction.fit(call.argumentType)
      println(fit)
    }
  }
}

Build the context and find the fit of each call-with statement.


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

object Build extends android.AutoBuild
{
	lazy val main = Project( "toolbelt", file( "." ) )
		.settings( androidBuildAar: _* )
		.settings(
			libraryDependencies ++= Seq(
				"com.android.support" % "appcompat-v7" % "21.0.0",
				"com.github.japgolly.android" % "svg-android" % "2.0.6",
				"com.jpardogo.materialtabstrip" % "library" % "1.0.5",
				"org.scala-lang" % "scala-reflect" % scalaVersion.value
			),
			name := "Toolbelt",
			organization := "com.taig.android",
			publishArtifact in ( Compile, packageDoc ) := false,
			scalaVersion := "2.11.4",
			scalacOptions ++= Seq(
				"-deprecation",
				"-feature",
				"-language:dynamics",
				"-language:existentials",
				"-language:implicitConversions",
				"-language:reflectiveCalls"
			),
			// @see https://github.com/pfn/android-sdk-plugin/issues/88
			sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ),
			version := "0.3.6-BETA",
			minSdkVersion in Android := "10",
			platformTarget in Android := "android-21",
			targetSdkVersion in Android := "21"
		)
}

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

object Build extends android.AutoBuild
{
	lazy val main = Project( "toolbelt", file( "." ) )
		.settings( androidBuildAar: _* )
		.settings(
			libraryDependencies ++= Seq(
				"com.android.support" % "appcompat-v7" % "21.0.0",
				"com.github.japgolly.android" % "svg-android" % "2.0.6",
				"com.jpardogo.materialtabstrip" % "library" % "1.0.5",
				"org.scala-lang" % "scala-reflect" % scalaVersion.value
			),
			name := "Toolbelt",
			organization := "com.taig.android",
			publishArtifact in ( Compile, packageDoc ) := false,
			scalaVersion := "2.11.4",
			scalacOptions ++= Seq(
				"-deprecation",
				"-feature",
				"-language:dynamics",
				"-language:existentials",
				"-language:implicitConversions",
				"-language:reflectiveCalls"
			),
			// @see https://github.com/pfn/android-sdk-plugin/issues/88
			sourceGenerators in Compile <<= ( sourceGenerators in Compile ) ( generators => Seq( generators.last ) ),
			version := "0.3.7-BETA",
			minSdkVersion in Android := "10",
			platformTarget in Android := "android-21",
			targetSdkVersion in Android := "21"
		)
}

Set project version to 0.3.7-BETA

Set project version to 0.3.7-BETA


addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.5")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")

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


addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.12.0")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.8")
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.6")

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

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.12.0")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.9")
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.6")

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

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


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

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

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

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

Set project version to 0.2.0-BETA

Set project version to 0.2.0-BETA


addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")

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

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

addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")

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

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

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


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

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

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

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

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

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

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

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

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


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

// For removing warts, maintain code quality
addSbtPlugin("org.wartremover" %% "sbt-wartremover" % "2.4.13")

// The sbt native packager - needed for docker builds
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1")

// For code coverage test
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")

// For checkstyle
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")

// For formatting Scala source code
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.16")

// Build fat jar file
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")

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

// For removing warts, maintain code quality
addSbtPlugin("org.wartremover" %% "sbt-wartremover" % "2.4.13")

// The sbt native packager - needed for docker builds
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1")

// For code coverage test
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")

// For checkstyle
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")

// For formatting Scala source code
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.16")

// Build fat jar file
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")

Update filters-helpers, play-ahc-ws, ... to 2.8.8


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

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

addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.2.1")

resolvers += "allenai nexus repository" at "http://utility.allenai.org:8081/nexus/content/repositories/releases"

credentials += Credentials("Sonatype Nexus Repository Manager", "utility.allenai.org", "deployment", "answermyquery")

addSbtPlugin("org.allenai.plugins" % "sbt-travis-publisher" % "2014.2.24-1-SNAPSHOT")

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

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

addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.2.1")

resolvers += "allenai nexus repository" at "http://utility.allenai.org:8081/nexus/content/repositories/snapshots"

credentials += Credentials("Sonatype Nexus Repository Manager", "utility.allenai.org", "deployment", "answermyquery")

addSbtPlugin("org.allenai.plugins" % "sbt-travis-publisher" % "2014.2.24-1-SNAPSHOT")

Change nexus repo to snapshots to get travis publisher plugin


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("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.5")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")

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("org.scala-js" % "sbt-scalajs" % "1.10.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")

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


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

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

addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")

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

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

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

addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M11-1")

addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.0")

Add sbt-updates plugin to track outdated dependencies


val scalaJSVersion = sys.env.getOrElse("SCALAJS_VERSION", "1.5.1")

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

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")

addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")

addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")

val scalaJSVersion = sys.env.getOrElse("SCALAJS_VERSION", "1.6.0")

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

addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")

addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "1.5.1")

addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")

Update sbt-scalajs, scalajs-library, ... to 1.6.0


package com.github.jt.sbt

import sbt._

/**
 * Dependencies which work together.
 */
object Deps {
  // Upgrade Scalatra + Json together
  // Scalatra 2.3 -> Json 3.2
  // Scalatra 2.4 -> Json 3.3
  object Json {
    private val version = "3.2.11"
    val json4s    = "org.json4s" %% "json4s-jackson" % version
    val json4sExt = "org.json4s" %% "json4s-ext" % version
  }

  object Scalatra {
    private val version = "2.3.1"
    private def module(name: String) = "org.scalatra" %% name % version
    val scalatra  = module("scalatra")
    val json      = module("scalatra-json")
    val swagger   = module("scalatra-swagger")
    val scalatest = module("scalatra-scalatest") % "it;test"

    val servletApi = "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
  }
}

package com.github.jt.sbt

import sbt._

/**
 * Dependencies which work together.
 */
object Deps {
  object Json {
    private val version = "3.3.0"
    val json4s    = "org.json4s" %% "json4s-jackson" % version
    val json4sExt = "org.json4s" %% "json4s-ext" % version
  }

  object Scalatra {
    private val version = "2.4.0"
    private def module(name: String) = "org.scalatra" %% name % version
    val scalatra  = module("scalatra")
    val json      = module("scalatra-json")
    val swagger   = module("scalatra-swagger")
    val scalatest = module("scalatra-scalatest") % "it;test"

    val servletApi = "javax.servlet" % "javax.servlet-api" % "3.1.0" % "provided"
  }
}

Use Scalatra 2.4, Json 3.3

Use Scalatra 2.4, Json 3.3


package ch.usi.inf.l3.sana.oberon0.errors

import ch.usi.inf.l3.sana
import sana.tiny.errors.ErrorCode
import sana.arrooj

trait ErrorCodes extends arrooj.errors.ErrorCodes {
  object MODULE_ALREADY_DEFINED extends ErrorCode {
    def message: String =
      "Module already defined"
  }

  object TYPE_ALREADY_DEFINED extends ErrorCode {
    def message: String =
      "Type already defined"
  }
}

object ErrorCodes extends ErrorCodes

package ch.usi.inf.l3.sana.oberon0.errors

import ch.usi.inf.l3.sana
import sana.tiny.errors.ErrorCode
import sana.arrooj

trait ErrorCodes extends arrooj.errors.ErrorCodes {
  object MODULE_ALREADY_DEFINED extends ErrorCode {
    def message: String =
      "Module already defined"
  }

  object TYPE_ALREADY_DEFINED extends ErrorCode {
    def message: String =
      "Type already defined"
  }

  object NAME_MISMATCH extends ErrorCode {
    def message: String = "Names do not match"
  }
}

object ErrorCodes extends ErrorCodes

Add an error code for name mismatch

Add an error code for name mismatch


package com.komanov.stringformat

import org.specs2.mutable.SpecificationWithJUnit
import org.specs2.specification.core.Fragment

class FormatsTest extends SpecificationWithJUnit {

  val formats: List[(String, (Int, String, Object) => String)] = List(
    "javaConcat" -> JavaFormats.concat,
    "stringFormat" -> JavaFormats.stringFormat,
    "messageFormat" -> JavaFormats.messageFormat,
    "messageFormatCached" -> JavaFormats.messageFormatCached,
    "slf4j" -> JavaFormats.slf4j,
    "scalaConcat" -> ScalaFormats.concat,
    "optimizedConcat" -> ScalaFormats.optimizedConcat,
    "sInterpolator" -> ScalaFormats.sInterpolator,
    "fInterpolator" -> ScalaFormats.fInterpolator,
    "rawInterpolator" -> ScalaFormats.rawInterpolator,
    "sfiInterpolator" -> ScalaFormats.sfiInterpolator
  )

  Fragment.foreach(formats) { case (name, f) =>
    s"$name" should {
      "product the same result as JavaConcat" >> {
        f(1, "str", null) must beEqualTo(JavaFormats.concat(1, "str", null))
        f(1, null, "str") must beEqualTo(JavaFormats.concat(1, null, "str"))
      }
    }
  }

}

package com.komanov.stringformat

import org.specs2.mutable.SpecificationWithJUnit
import org.specs2.specification.core.Fragment

class FormatsTest extends SpecificationWithJUnit {

  val formats: List[(String, (Int, String, Object) => String)] = List(
    "javaConcat" -> JavaFormats.concat,
    "stringFormat" -> JavaFormats.stringFormat,
    "messageFormat" -> JavaFormats.messageFormat,
    "messageFormatCached" -> JavaFormats.messageFormatCached,
    "slf4j" -> JavaFormats.slf4j,
    "scalaConcat" -> ScalaFormats.concat,
    "optimizedConcat" -> ScalaFormats.optimizedConcat,
    "sInterpolator" -> ScalaFormats.sInterpolator,
    "fInterpolator" -> ScalaFormats.fInterpolator,
    "rawInterpolator" -> ScalaFormats.rawInterpolator,
    "sfiInterpolator" -> ScalaFormats.sfiInterpolator
  )

  Fragment.foreach(formats) { case (name, f) =>
    s"$name" should {
      "product the same result as JavaConcat" >> {
        f(1, "str", null) must beEqualTo(JavaFormats.concat(1, "str", null))
        f(1, null, "str") must beEqualTo(JavaFormats.concat(1, null, "str"))
      }
    }
  }

  val formatsWithInputArgs = for {
    (name, f) <- formats
    arg <- InputArg.values
  } yield (name, arg, f)

  Fragment.foreach(formatsWithInputArgs) { case (name, arg, f) =>
    s"$name" should {
      s"product the same result as JavaConcat for $arg" >> {
        f(arg.value1, arg.value2, null) must beEqualTo(JavaFormats.concat(arg.value1, arg.value2, null))
      }
    }
  }

}

Add test to verify output

Add test to verify output


name := "jms-to-file"

/*
  To uses this sbt project stand-alone,
  copy ../project/Dependencies.scala into ./project.
 */
import Dependencies._

libraryDependencies ++= Seq(
  alpakkaJms,
  akkaHttp,
  "javax.jms" % "jms" % "1.1",
  "org.apache.activemq" % "activemq-all" % "5.14.4"
)

name := "jms-to-file"

/*
  To uses this sbt project stand-alone,
  copy ../project/Dependencies.scala into ./project.
 */
import Dependencies._

libraryDependencies ++= Seq(
  alpakkaJms,
  akkaHttp,
  "javax.jms" % "jms-api" % "1.1-rev-1",
  "org.apache.activemq" % "activemq-all" % "5.14.4"
)

Use more official JMS api jar

Use more official JMS api jar


package models

import mappings.Consent.consent
import org.joda.time.LocalDate
import play.api.data.Forms.mapping
import play.api.libs.json.Json
import uk.gov.dvla.vehicles.presentation.common.clientsidesession.CacheKey
import uk.gov.dvla.vehicles.presentation.common.mappings.Date.{dateMapping, notInTheFuture}
import uk.gov.dvla.vehicles.presentation.common.mappings.Mileage.mileage

case class CompleteAndConfirmFormModel(mileage: Option[Int],
                                       dateOfSale: LocalDate,
                                       consent: String)

object CompleteAndConfirmFormModel {
  implicit val JsonFormat = Json.format[CompleteAndConfirmFormModel]
  final val AllowGoingToCompleteAndConfirmPageCacheKey = "allowGoingToCompleteAndConfirmPage"
  final val CompleteAndConfirmCacheKey = "completeAndConfirm"
  final val CompleteAndConfirmCacheTransactionIdCacheKey = "completeAndConfirmTransactionId"
  implicit val Key = CacheKey[CompleteAndConfirmFormModel](CompleteAndConfirmCacheKey)

  object Form {
    final val MileageId = "mileage"
    final val DateOfSaleId = "dateofsale"
    final val TodaysDateId = "todays_date"
    final val ConsentId = "consent"

    final val Mapping = mapping(
      MileageId -> mileage,
      DateOfSaleId -> dateMapping.verifying(notInTheFuture()),
      ConsentId -> consent
    )(CompleteAndConfirmFormModel.apply)(CompleteAndConfirmFormModel.unapply)
  }
}

package models

import mappings.Consent.consent
import org.joda.time.LocalDate
import play.api.data.Forms.mapping
import play.api.libs.json.Json
import uk.gov.dvla.vehicles.presentation.common.clientsidesession.CacheKey
import uk.gov.dvla.vehicles.presentation.common.mappings.Date.{dateMapping, notInTheFuture}
import uk.gov.dvla.vehicles.presentation.common.mappings.Mileage.mileage

case class CompleteAndConfirmFormModel(mileage: Option[Int],
                                       dateOfSale: LocalDate,
                                       consent: String)

object CompleteAndConfirmFormModel {
  implicit val JsonFormat = Json.format[CompleteAndConfirmFormModel]
  final val AllowGoingToCompleteAndConfirmPageCacheKey = "allowGoingToCompleteAndConfirmPage"
  final val CompleteAndConfirmCacheKey = "completeAndConfirm"
  final val CompleteAndConfirmCacheTransactionIdCacheKey = "completeAndConfirmTransactionId"
  implicit val Key = CacheKey[CompleteAndConfirmFormModel](CompleteAndConfirmCacheKey)

  object Form {
    final val MileageId = "mileage"
    final val DateOfSaleId = "dateofsale"
    final val TodaysDateId = "todays_date"
    final val ConsentId = "consent"

    final def Mapping = mapping(
      MileageId -> mileage,
      DateOfSaleId -> dateMapping.verifying(notInTheFuture()),
      ConsentId -> consent
    )(CompleteAndConfirmFormModel.apply)(CompleteAndConfirmFormModel.unapply)
  }
}

DE151: Change the date mappings using date comparisons to def rather than val declarations.


name := "example"

version := "1.0"

scalaVersion := "2.12.9"

libraryDependencies ++= Seq(
  "com.github.pureconfig" %% "pureconfig" % "0.11.2-SNAPSHOT")

crossScalaVersions := Seq("2.12.9", "2.11.12", "2.13.0")

scalacOptions ++= Seq(
  "-deprecation",
  "-encoding", "UTF-8",
  "-language:experimental.macros",
  "-feature",
  "-unchecked",
  "-Xfatal-warnings",
  "-Xlint",
  "-Ywarn-numeric-widen",
  "-Ywarn-value-discard")

name := "example"

version := "1.0"

scalaVersion := "2.13.0"

libraryDependencies ++= Seq(
  "com.github.pureconfig" %% "pureconfig" % "0.11.2-SNAPSHOT")

crossScalaVersions := Seq("2.13.0", "2.12.9", "2.11.12")

scalacOptions ++= Seq(
  "-deprecation",
  "-encoding", "UTF-8",
  "-language:experimental.macros",
  "-feature",
  "-unchecked",
  "-Xfatal-warnings",
  "-Xlint",
  "-Ywarn-numeric-widen",
  "-Ywarn-value-discard")

Build example project against 2.13.0

Build example project against 2.13.0


package com.azavea.rf.user

import scala.concurrent.ExecutionContext

import akka.http.scaladsl.model.StatusCodes

import com.azavea.rf.utils.Database
import com.azavea.rf.auth.Authentication
import com.azavea.rf.datamodel.latest.schema.tables.UsersRow

/**
  * Routes for users
  */
trait UserRoutes extends Authentication {

  implicit val database: Database
  implicit val ec: ExecutionContext

  def userRoutes = (
    authenticate { user =>
      pathPrefix("api" / "users") {
        pathEndOrSingleSlash {
          get {
            onSuccess(UserService.getUsers) {
              resp => complete(resp)
            }
          } ~
          post {
            entity(as[UsersRowCreate]) {
              newUser =>
              onSuccess(UserService.createUser(newUser)) {
                resp => complete((StatusCodes.Created, resp))
              }
            }
          }
        } ~
        pathPrefix(JavaUUID) { id =>
          pathEndOrSingleSlash {
            get {
              onSuccess(UserService.getUserById(id)) {
                resp => complete(resp)
              }
            } ~
            put {
              entity(as[UsersRow]) {
                user =>
                onSuccess(UserService.updateUser(user, id)) {
                  resp => resp match {
                    case 1 => complete((StatusCodes.NoContent))
                    case 0 => complete((StatusCodes.NotFound))
                  }
                }
              }
            }
          }
        }
      }
    }
  )
}

package com.azavea.rf.user

import scala.concurrent.ExecutionContext

import akka.http.scaladsl.model.StatusCodes

import com.azavea.rf.utils.Database
import com.azavea.rf.auth.Authentication
import com.azavea.rf.datamodel.latest.schema.tables.UsersRow

/**
  * Routes for users
  */
trait UserRoutes extends Authentication {

  implicit val database: Database
  implicit val ec: ExecutionContext

  def userRoutes = (
    authenticate { user =>
      pathPrefix("api" / "users") {
        pathEndOrSingleSlash {
          get {
            onSuccess(UserService.getUsers) {
              resp => complete(resp)
            }
          } ~
          post {
            entity(as[UsersRowCreate]) {
              newUser =>
              onSuccess(UserService.createUser(newUser)) {
                resp => complete((StatusCodes.Created, resp))
              }
            }
          }
        } ~
        pathPrefix(JavaUUID) { id =>
          pathEndOrSingleSlash {
            get {
              onSuccess(UserService.getUserById(id)) {
                resp => resp match {
                  case Some(user) => complete(user)
                  case _ => complete((StatusCodes.NotFound))
                }
              }
            } ~
            put {
              entity(as[UsersRow]) {
                user =>
                onSuccess(UserService.updateUser(user, id)) {
                  resp => resp match {
                    case 1 => complete((StatusCodes.NoContent))
                    case 0 => complete((StatusCodes.NotFound))
                  }
                }
              }
            }
          }
        }
      }
    }
  )
}

Fix response for bad uuid GET to /users/{UUID}


package uk.gov.dvla.vehicles.presentation.common.filters

object ServiceOpen {
  val whitelist = List (
    "/assets/",
    "/help",
    "/feedback"
  )
}

package uk.gov.dvla.vehicles.presentation.common.filters

import uk.gov.dvla.vehicles.presentation.common.controllers.Version

object ServiceOpen {
  val whitelist = List (
    "/assets/",
    "/help",
    "/feedback",
    Version.Suffix
  )
}

Add the version to the our of hours exceptions


package com.yammer.dropwizard.modules

import com.google.inject.multibindings.Multibinder

class GuiceMultibindingModule[A](interface: Class[A], implementations: Class[_ <: A]*) extends GuiceModule {
  def configure = {
    val multibinder = Multibinder.newSetBinder(binder, interface)
    implementations.foreach { multibinder.addBinding.to(_) }
  }
}

package com.yammer.dropwizard.modules

import com.google.inject.multibindings.Multibinder

class GuiceMultibindingModule[A](interface: Class[A], implementations: Class[_ <: A]*) extends GuiceModule {
  def configure = {
    val multibinder = Multibinder.newSetBinder(binder, interface)
    implementations.foreach { multibinder.addBinding.to(_).asEagerSingleton }
  }
}

Make sure our multibinding assumes all the values are eager singletons.


package com.lucidchart.piezo.jobs.monitoring

import org.quartz.{JobExecutionContext, Job}
import java.io.{File, FileWriter}
import java.util.Date
import org.slf4j.LoggerFactory

object HeartBeat {
  val statsd = new com.lucidchart.util.statsd.StatsD("applications.jobs.worker")
}

class HeartBeat extends Job {
  val statsKey = "heartbeat.executed"

  def execute(context:JobExecutionContext) {
    LoggerFactory.getLogger(this.getClass).info((System.currentTimeMillis / 1000).toString)
    HeartBeat.statsd.increment(statsKey)
  }
}

package com.lucidchart.piezo.jobs.monitoring

import org.quartz.{JobExecutionContext, Job}
import java.io.{File, FileWriter}
import java.util.Date
import org.slf4j.LoggerFactory

class HeartBeat extends Job {
  def execute(context:JobExecutionContext) {
    LoggerFactory.getLogger(this.getClass).info((System.currentTimeMillis / 1000).toString)
  }
}

Remove duplicate statsd recording of heartbeat


package scruffy.examples

import com.mongodb.casbah.Imports._
import com.sksamuel.scruffy.EndpointProvider
import java.util.concurrent.ThreadLocalRandom

/** @author Stephen Samuel */
class Test2Endpoint() extends HttpEndpointProvider {

  val hostname = "database_host"
  val connection = MongoConnection(hostname, 27017)
  val collection = connection.getDB("hello_world").getCollection("world")

  val fields = DBObject("_id" -> true, "randomNumber" -> true)

  //uncomment to populate
  //for ( k <- 1 to 10000 )
  //  collection.save(DBObject("_id" -> k, "id" -> k, "randomNumber" -> random.nextInt(10000).toDouble))

  get("db").json {
    req =>
      val id = ThreadLocalRandom.current.nextInt(10000)
      val dbo = collection.findOne(DBObject("_id" -> id), fields)
      val randomNumber = Math.round(dbo.get("randomNumber").toString.toFloat)
      Output(id, randomNumber)
    }
  }
}

case class Output(id: Int, randomNumber: Int)

package scruffy.examples

import com.mongodb.casbah.Imports._
import com.sksamuel.scruffy.HttpEndpointProvider
import java.util.concurrent.ThreadLocalRandom

/** @author Stephen Samuel */
class Test2Endpoint() extends HttpEndpointProvider {

  val hostname = "database_host"
  val connection = MongoConnection(hostname, 27017)
  val collection = connection.getDB("hello_world").getCollection("world")

  val fields = DBObject("_id" -> true, "randomNumber" -> true)

  //uncomment to populate
  //for ( k <- 1 to 10000 )
  //  collection.save(DBObject("_id" -> k, "id" -> k, "randomNumber" -> random.nextInt(10000).toDouble))

  get("db") { implicit req =>
    json {
      val id = ThreadLocalRandom.current.nextInt(10000)
      val dbo = collection.findOne(DBObject("_id" -> id), fields)
      val randomNumber = Math.round(dbo.get("randomNumber").toString.toFloat)
      Output(id, randomNumber)
    }
  }
}

case class Output(id: Int, randomNumber: Int)

Add in code that was accidentally removed in merge conflict.

- Update import from EndpointProvider to HttpEndpointProvider
- Add back missing code from merge conflict in PR 1436


package uk.ac.wellcome.platform.api.models

import org.scalatest.{FunSpec, Matchers}

class WorksIncludesTest extends FunSpec with Matchers {

  it("should use default values if nothing is provided") {
    val includes = WorksIncludes(None)
    includes.identifiers shouldBe false
  }

  it("should default a missing value to false") {
    val includes = WorksIncludes("")
    includes.identifiers shouldBe false
  }

  it("should parse a present value as true") {
    val includes = WorksIncludes("identifiers")
    includes.identifiers shouldBe true
  }
}

package uk.ac.wellcome.platform.api.models

import org.scalatest.{FunSpec, Matchers}

class WorksIncludesTest extends FunSpec with Matchers {

  it("should use default values if nothing is provided") {
    val includes = WorksIncludes(None)
    includes.identifiers shouldBe false
  }

  it("should default a missing value to false") {
    val includes = WorksIncludes("")
    includes.identifiers shouldBe false
  }

  it("should parse a present value as true") {
    val includes = WorksIncludes("identifiers")
    includes.identifiers shouldBe true
  }

  it("should successfully validate a correct string") {
    val result = WorksIncludes.validate(queryParam = "identifiers")
    result.isLeft shouldBe true
  }

  it("should successfully validate if no query parameter is provided") {
    val result = WorksIncludes.validate(queryParam = None)
    result.isLeft shouldBe true
  }

  it("should successfully reject an correct string") {
    val result = WorksIncludes.validate(queryParam = "foo,bar")
    result shouldBe Right(List("foo", "bar"))
  }
}

Add some tests for WorksIncludes validation


package com.negrisoli.algorithms.implementation

object ManasaAndStones {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val tests = sc.nextInt();

    for (i <- 0 to tests - 1) {
      val size = sc.nextInt()
      val a = sc.nextInt()
      val b = sc.nextInt()

      println(compose(a, b, size).distinct.sorted.mkString(" "))
    }
  }

  def compose(a: Int, b: Int, size: Int): Array[Int] = {
    def iter(acc:Array[Int], sum:Int, i:Int): Array[Int] = {
      if (i == size - 1) acc :+ sum
      else iter(acc, sum + a, i + 1) ++ iter(acc,  b + sum, i + 1)
    }

    iter(Array(), 0, 0)
  }
}

package com.negrisoli.algorithms.implementation

object ManasaAndStones {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val tests = sc.nextInt();

    for (i <- 0 to tests - 1) {
      val size = sc.nextInt()
      val a = sc.nextInt()
      val b = sc.nextInt()

      println(compose(a, b, size).distinct.sorted.mkString(" "))
    }
  }

  def compose(a: Int, b: Int, size: Int): Array[Int] = {
    val l = Array.fill(size - 1)(a)

    var sums = new scala.collection.mutable.ListBuffer[Int]
    sums += l.sum
    for (i <- 0 to l.size - 1) {
      l(l.size - 1 - i) = b
      sums += l.sum
    }

    sums.toArray
  }

}

Improve memory leak of Manasa And Stones solution.


/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2002-2013, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

package scala

/** An interface containing operations for equality.
 *  The only method not already present in class `AnyRef` is `canEqual`.
 */
trait Equals extends Any {
  /** A method that should be called from every well-designed equals method
   *  that is open to be overridden in a subclass. See Programming in Scala,
   *  Chapter 28 for discussion and design.
   *
   *  @param    that    the value being probed for possible equality
   *  @return   true if this instance can possibly equal `that`, otherwise false
   */
  def canEqual(that: Any): Boolean

  /** The universal equality method defined in `AnyRef`.
   */
  def equals(that: Any): Boolean
}

/*                     __                                               *\
**     ________ ___   / /  ___     Scala API                            **
**    / __/ __// _ | / /  / _ |    (c) 2002-2013, LAMP/EPFL             **
**  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
** /____/\___/_/ |_/____/_/ | |                                         **
**                          |/                                          **
\*                                                                      */

package scala

/** An interface containing operations for equality.
 *  The only method not already present in class `AnyRef` is `canEqual`.
 */
trait Equals extends Any {
  /** A method that should be called from every well-designed equals method
   *  that is open to be overridden in a subclass. See
   *  [[http://www.artima.com/pins1ed/object-equality.html Programming in Scala,
   *  Chapter 28]] for discussion and design.
   *
   *  @param    that    the value being probed for possible equality
   *  @return   true if this instance can possibly equal `that`, otherwise false
   */
  def canEqual(that: Any): Boolean

  /** The universal equality method defined in `AnyRef`.
   */
  def equals(that: Any): Boolean
}

Add link to online version of Programming in Scala


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

addSbtPlugin("io.gatling"         % "gatling-build-plugin"  % "2.5.5")
addSbtPlugin("com.typesafe.sbt"   % "sbt-native-packager"   % "1.7.5")
addSbtPlugin("pl.project13.scala" % "sbt-jmh"               % "0.4.0")
addSbtPlugin("net.aichler"        % "sbt-jupiter-interface" % "0.7.0")
addSbtPlugin("com.typesafe.sbt"   % "sbt-site"              % "1.4.0")
addSbtPlugin("org.wartremover"    % "sbt-wartremover"       % "2.4.10")
addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"          % "0.9.21")

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

addSbtPlugin("io.gatling"         % "gatling-build-plugin"  % "2.6.0")
addSbtPlugin("com.typesafe.sbt"   % "sbt-native-packager"   % "1.7.5")
addSbtPlugin("pl.project13.scala" % "sbt-jmh"               % "0.4.0")
addSbtPlugin("net.aichler"        % "sbt-jupiter-interface" % "0.7.0")
addSbtPlugin("com.typesafe.sbt"   % "sbt-site"              % "1.4.0")
addSbtPlugin("org.wartremover"    % "sbt-wartremover"       % "2.4.10")
addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"          % "0.9.21")

Upgrade gatling-build-plugin 2.6.0 to compile with Scala 2.13.3


logLevel := Level.Warn

libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "1.1.0"
libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0"

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.4.0")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.1")
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.6")

// Deployment configuration
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")

logLevel := Level.Warn

libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "1.1.0"
libraryDependencies += "org.scala-js" %% "scalajs-env-jsdom-nodejs" % "1.1.0"

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.0")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.1")
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.6")

// Deployment configuration
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")

Update scalajs-compiler, scalajs-library, ... to 1.5.0