package algebra
package lattice

import scala.{specialized => sp}

/**
 * A bounded lattice is a lattice that additionally has one element
 * that is the bottom (zero, also written as ), and one element that is the top (one).
 *
 * This means that for any a in A:
 *
 *   join(zero, a) = a = meet(one, a)
 *
 * Or written using traditional notation:
 *
 *   (0 ∨ a) = a = (1 ∧ a)
 */
trait BoundedLattice[@sp(Boolean, Byte, Short, Int, Long, Float, Double) A] extends Any with Lattice[A] with BoundedMeetSemilattice[A] with BoundedJoinSemilattice[A]

trait BoundedLatticeFunctions {
  def zero[@sp(Boolean, Byte, Short, Int, Long, Float, Double) A](implicit ev: BoundedJoinSemilattice[A]): A =
    ev.zero

  def one[@sp(Boolean, Byte, Short, Int, Long, Float, Double) A](implicit ev: BoundedMeetSemilattice[A]): A =
    ev.one
}

object BoundedLattice extends LatticeFunctions with BoundedLatticeFunctions {

  /**
   * Access an implicit `BoundedLattice[A]`.
   */
  @inline final def apply[@sp(Boolean, Byte, Short, Int, Long, Float, Double) A](implicit ev: BoundedLattice[A]): BoundedLattice[A] = ev
}

package algebra
package lattice

import scala.{specialized => sp}

/**
 * A bounded lattice is a lattice that additionally has one element
 * that is the bottom (zero, also written as ⊥), and one element that
 * is the top (one, also written as ⊤).
 *
 * This means that for any a in A:
 *
 *   join(zero, a) = a = meet(one, a)
 *
 * Or written using traditional notation:
 *
 *   (0 ∨ a) = a = (1 ∧ a)
 */
trait BoundedLattice[@sp(Boolean, Byte, Short, Int, Long, Float, Double) A] extends Any with Lattice[A] with BoundedMeetSemilattice[A] with BoundedJoinSemilattice[A]

trait BoundedLatticeFunctions {
  def zero[@sp(Boolean, Byte, Short, Int, Long, Float, Double) A](implicit ev: BoundedJoinSemilattice[A]): A =
    ev.zero

  def one[@sp(Boolean, Byte, Short, Int, Long, Float, Double) A](implicit ev: BoundedMeetSemilattice[A]): A =
    ev.one
}

object BoundedLattice extends LatticeFunctions with BoundedLatticeFunctions {

  /**
   * Access an implicit `BoundedLattice[A]`.
   */
  @inline final def apply[@sp(Boolean, Byte, Short, Int, Long, Float, Double) A](implicit ev: BoundedLattice[A]): BoundedLattice[A] = ev
}

Add unicode notation for the top and bottom of bounded lattices.


 package io.vamp.persistence

 import io.vamp.common.ClassMapper

 import scala.concurrent.Future

 /**
  * Maps sqlserver to class mapper for lifter
  */
 class SQLServerPersistenceActorMapper extends ClassMapper {
   val name = "sqlserver"
   val clazz = classOf[SQLServerPersistenceActor]
 }

 /**
  * Support for Microsft sql server
  */
 class SQLServerPersistenceActor extends SqlPersistenceActor with SqlStatementProvider {

   protected def info() = Future.successful(representationInfo() + ("type" → "sqlserver") + ("url" → url))

   override def getInsertStatement(content: Option[String]): String =
     content.map { _ ⇒
       "insert into Artifacts (Version, Command, Type, Name, Definition) values (?, ?, ?, ?, ?)"
     }.getOrElse("insert into Artifacts (Version, Command, Type, Name) values (?, ?, ?, ?)")

   override def getSelectStatement(lastId: Long): String =
     s"SELECT ID, Command, Type, Name, Definition FROM Artifacts WHERE ID > $lastId ORDER BY ID ASC"

   // In Postgres the minvalue of a select statement fetch is 0
   override val statementMinValue: Int = 0
 }

package io.vamp.persistence

import io.vamp.common.ClassMapper

import scala.concurrent.Future

/**
* Maps sqlserver to class mapper for lifter
*/
class SQLServerPersistenceActorMapper extends ClassMapper {
 val name = "sqlserver"
 val clazz = classOf[SQLServerPersistenceActor]
}

/**
* Support for Microsoft sql server
*/
class SQLServerPersistenceActor extends SqlPersistenceActor with SqlStatementProvider {

 protected def info() = Future.successful(representationInfo() + ("type" → "sqlserver") + ("url" → url))

 override def getInsertStatement(content: Option[String]): String =
   content.map { _ ⇒
     "insert into Artifacts (Version, Command, Type, Name, Definition) values (?, ?, ?, ?, ?)"
   }.getOrElse("insert into Artifacts (Version, Command, Type, Name) values (?, ?, ?, ?)")

 override def getSelectStatement(lastId: Long): String =
   s"SELECT ID, Command, Type, Name, Definition FROM Artifacts WHERE ID > $lastId ORDER BY ID ASC"

 // In Sql Server the minvalue of a select statement fetch is 0
 override val statementMinValue: Int = 0

}

Add SQL Server support for VAMP persistence


import sbt._
import Keys._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._

object Dependencies {
  lazy val jaxbApi = "javax.xml.bind" % "jaxb-api" % "2.3.1" % "test"

  lazy val jodaTime = Seq(
    "joda-time" % "joda-time" % "2.12.1",
    "org.joda" % "joda-convert" % "2.2.2"
  )
  lazy val jackson = Seq(
    "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4.2"
  )
  lazy val scalaz_core = Def.setting(
    "org.scalaz" %%% "scalaz-core" % "7.3.6"
  )
  lazy val paranamer = "com.thoughtworks.paranamer" % "paranamer" % "2.8"
  lazy val scalatest = Def.setting(
    Seq("org.scalatest" %%% "scalatest-wordspec" % "3.2.14" % "test")
  )
  lazy val scalatestScalacheck = Def.setting(
    Seq("org.scalatestplus" %%% "scalacheck-1-17" % "3.2.14.0" % "test")
  )

  lazy val scalaXml = Def.setting {
    "org.scala-lang.modules" %%% "scala-xml" % "2.1.0"
  }
}

import sbt._
import Keys._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._

object Dependencies {
  lazy val jaxbApi = "javax.xml.bind" % "jaxb-api" % "2.3.1" % "test"

  lazy val jodaTime = Seq(
    "joda-time" % "joda-time" % "2.12.1",
    "org.joda" % "joda-convert" % "2.2.2"
  )
  lazy val jackson = Seq(
    "com.fasterxml.jackson.core" % "jackson-databind" % "2.14.0"
  )
  lazy val scalaz_core = Def.setting(
    "org.scalaz" %%% "scalaz-core" % "7.3.6"
  )
  lazy val paranamer = "com.thoughtworks.paranamer" % "paranamer" % "2.8"
  lazy val scalatest = Def.setting(
    Seq("org.scalatest" %%% "scalatest-wordspec" % "3.2.14" % "test")
  )
  lazy val scalatestScalacheck = Def.setting(
    Seq("org.scalatestplus" %%% "scalacheck-1-17" % "3.2.14.0" % "test")
  )

  lazy val scalaXml = Def.setting {
    "org.scala-lang.modules" %%% "scala-xml" % "2.1.0"
  }
}

Update jackson-databind to 2.14.0 in master


package com.johnsnowlabs.nlp.embeddings

import java.io.Closeable

import org.rocksdb._

private [embeddings] case class RocksDbIndexer(dbFile: String, autoFlashAfter: Option[Integer] = None) extends Closeable{
  val options = new Options()
  options.setCreateIfMissing(true)
  options.setCompressionType(CompressionType.LZ4_COMPRESSION)
  options.setWriteBufferSize(20 * 1 << 20)

  RocksDB.loadLibrary()
  val writeOptions = new WriteOptions()

  val db = RocksDB.open(options, dbFile)
  var batch = new WriteBatch()
  var batchSize = 0

  def flush() = {
    db.write(writeOptions, batch)
    batch.close()
    batch = new WriteBatch()
    batchSize = 0
  }

  def add(word: String, vector: Array[Float]) = {
    batch.put(word.getBytes, WordEmbeddingsIndexer.toBytes(vector))
    batchSize += 1

    if (autoFlashAfter.isDefined) {
      if (batchSize >= autoFlashAfter.get)
        flush()
    }
  }

  override def close(): Unit = {
    if (batchSize > 0)
      flush()

    db.close
  }
}

package com.johnsnowlabs.nlp.embeddings

import java.io.Closeable

import org.rocksdb._

private [embeddings] case class RocksDbIndexer(dbFile: String, autoFlashAfter: Option[Integer] = None) extends Closeable{
  val options = new Options()
  options.setCreateIfMissing(true)
  options.setCompressionType(CompressionType.NO_COMPRESSION)
  options.setWriteBufferSize(20 * 1 << 20)

  RocksDB.loadLibrary()
  val writeOptions = new WriteOptions()

  val db = RocksDB.open(options, dbFile)
  var batch = new WriteBatch()
  var batchSize = 0

  def flush() = {
    db.write(writeOptions, batch)
    batch.close()
    batch = new WriteBatch()
    batchSize = 0
  }

  def add(word: String, vector: Array[Float]) = {
    batch.put(word.getBytes, WordEmbeddingsIndexer.toBytes(vector))
    batchSize += 1

    if (autoFlashAfter.isDefined) {
      if (batchSize >= autoFlashAfter.get)
        flush()
    }
  }

  override def close(): Unit = {
    if (batchSize > 0)
      flush()

    db.close
  }
}

Disable RocksDB compression for windows compatibility


package sbt.internal.inc

import sbt.io.IO
import sbt.util.{ Level, Logger }

class IvyComponentCompilerSpec extends BridgeProviderSpecification {

  val scala282 = "2.8.2"
  val scala292 = "2.9.2"
  val scala210 = "2.10.5"
  val scala211 = "2.11.7"

  "IvyComponentCompiler" should "compile the bridge for Scala 2.8" in {
    IO.withTemporaryDirectory { tempDir =>
      getCompilerBridge(tempDir, Logger.Null, scala282) should exist
    }
  }

  it should "compile the bridge for Scala 2.9" in {
    IO.withTemporaryDirectory { tempDir =>
      getCompilerBridge(tempDir, Logger.Null, scala292) should exist
    }
  }

  it should "compile the bridge for Scala 2.10" in {
    IO.withTemporaryDirectory { tempDir =>
      getCompilerBridge(tempDir, Logger.Null, scala210) should exist
    }
  }

  it should "compile the bridge for Scala 2.11" in {
    IO.withTemporaryDirectory { tempDir =>
      getCompilerBridge(tempDir, Logger.Null, scala211) should exist
    }
  }

}

package sbt.internal.inc

import sbt.io.IO
import sbt.util.Logger

class IvyComponentCompilerSpec extends BridgeProviderSpecification {

  val scala282 = "2.8.2"
  val scala292 = "2.9.2"
  val scala210 = "2.10.5"
  val scala211 = "2.11.7"

  "IvyComponentCompiler" should "compile the bridge for Scala 2.8" in {
    IO.withTemporaryDirectory { tempDir =>
      getCompilerBridge(tempDir, Logger.Null, scala282) should exist
    }
  }

  it should "compile the bridge for Scala 2.9" in {
    IO.withTemporaryDirectory { tempDir =>
      getCompilerBridge(tempDir, Logger.Null, scala292) should exist
    }
  }

  it should "compile the bridge for Scala 2.10" in {
    IO.withTemporaryDirectory { tempDir =>
      getCompilerBridge(tempDir, Logger.Null, scala210) should exist
    }
  }

  it should "compile the bridge for Scala 2.11" in {
    IO.withTemporaryDirectory { tempDir =>
      getCompilerBridge(tempDir, Logger.Null, scala211) should exist
    }
  }

}

Fix command and definition of compiler bridge

The compiler bridge had a dependency on the scala compiler in the
version defined in the build definition. This means that when trying to
fetch the compiler bridge for, say, Scala 2.9.2, we would also pull in
the Scala compiler 2.10.5.

The compiler bridge now has a "provided" dependency on the Scala
compiler.


package algebra
package std

import algebra.ring.CommutativeRing

package object unit extends UnitInstances

trait UnitInstances {
  implicit val unitAlgebra: Order[Unit] with CommutativeRing[Unit] with BoundedSemilattice[Unit] =
    new UnitAlgebra
}

class UnitAlgebra extends Order[Unit] with CommutativeRing[Unit] with BoundedSemilattice[Unit] {
  def compare(x: Unit, y: Unit): Int = 0

  override def eqv(x: Unit, y: Unit): Boolean = true
  override def neqv(x: Unit, y: Unit): Boolean = false
  override def gt(x: Unit, y: Unit): Boolean = false
  override def lt(x: Unit, y: Unit): Boolean = false
  override def gteqv(x: Unit, y: Unit): Boolean = true
  override def lteqv(x: Unit, y: Unit): Boolean = true

  override def min(x: Unit, y: Unit): Unit = ()
  override def max(x: Unit, y: Unit): Unit = Unit

  def zero: Unit = ()
  def one: Unit = ()

  override def isZero(x: Unit)(implicit ev: Eq[Unit]): Boolean = true
  override def isOne(x: Unit)(implicit ev: Eq[Unit]): Boolean = true

  def plus(a: Unit, b: Unit): Unit = ()
  def negate(x: Unit): Unit = ()
  def times(a: Unit, b: Unit): Unit = ()
  override def pow(a: Unit, b: Int): Unit = ()

  def empty: Unit = ()
  def combine(x: Unit, y: Unit): Unit = ()
}

package algebra
package std

import algebra.ring.CommutativeRing

package object unit extends UnitInstances

trait UnitInstances {
  implicit val unitAlgebra: Order[Unit] with CommutativeRing[Unit] with BoundedSemilattice[Unit] =
    new UnitAlgebra
}

class UnitAlgebra extends Order[Unit] with CommutativeRing[Unit] with BoundedSemilattice[Unit] {
  def compare(x: Unit, y: Unit): Int = 0

  override def eqv(x: Unit, y: Unit): Boolean = true
  override def neqv(x: Unit, y: Unit): Boolean = false
  override def gt(x: Unit, y: Unit): Boolean = false
  override def lt(x: Unit, y: Unit): Boolean = false
  override def gteqv(x: Unit, y: Unit): Boolean = true
  override def lteqv(x: Unit, y: Unit): Boolean = true

  override def min(x: Unit, y: Unit): Unit = ()
  override def max(x: Unit, y: Unit): Unit = ()

  def zero: Unit = ()
  def one: Unit = ()

  override def isZero(x: Unit)(implicit ev: Eq[Unit]): Boolean = true
  override def isOne(x: Unit)(implicit ev: Eq[Unit]): Boolean = true

  def plus(a: Unit, b: Unit): Unit = ()
  def negate(x: Unit): Unit = ()
  def times(a: Unit, b: Unit): Unit = ()
  override def pow(a: Unit, b: Int): Unit = ()

  def empty: Unit = ()
  def combine(x: Unit, y: Unit): Unit = ()
}

Use () as a value instead of Unit

Use () as a value instead of Unit


package ch.usi.inf.l3.sana.core

trait PhaseFamily[P, R] {

  def default: R = ???

  def components: List[PartialFunction[P, R]]

  def family: P => R = components.reduce((x, y) => x orElse y) orElse {
    case _ => default
  }
}

trait TransformationFamily[P, R] extends PhaseFamily[P, R]

trait CheckerFamily[P] extends PhaseFamily[P, Unit]

package ch.usi.inf.l3.sana.core

trait PhaseFamily[P, R] {
  self =>

  def default: R = ???

  def components: List[PartialFunction[P, R]]

  def family: P => R = components.reduce((x, y) => x orElse y) orElse {
    case _ => self.default
  }
}

trait TransformationFamily[P, R] extends PhaseFamily[P, R]

trait CheckerFamily[P] extends PhaseFamily[P, Unit]

Use self to access default

Use self to access default


import stainless.annotation._
import stainless.collection._

object PreInPre {
  @induct
  def f(t: List[BigInt], st: BigInt) {
    require(t.head == st)
  }
}

import stainless.annotation._
import stainless.collection._

object PreInPre {

  @induct
  def f(t: List[BigInt], st: BigInt): Unit = {
    require(t.head == st)
    ()
  }

}

Fix silent extraction issue with Dotty

Fix silent extraction issue with Dotty


import io.luna.game.event.impl.CommandEvent

>>@[CommandEvent]("npc", RIGHTS_DEV) { (msg, plr) =>
  val args = msg.getArgs
  world.addNpc(args(0).toInt, plr.position)
}

>>@[CommandEvent]("object", RIGHTS_DEV) { (msg, plr) =>
  // TODO: Once object placement system is done
}

Remove "object" command, not necessary at the moment


package uk.ac.wellcome.platform.sierra_bib_merger.services

import akka.actor.ActorSystem
import com.google.inject.Inject
import uk.ac.wellcome.messaging.sns.NotificationMessage
import uk.ac.wellcome.messaging.sqs.SQSStream
import uk.ac.wellcome.sierra_adapter.models.SierraRecord
import uk.ac.wellcome.utils.JsonUtil._

import scala.concurrent.{ExecutionContext, Future}

class SierraBibMergerWorkerService @Inject()(
  system: ActorSystem,
  sqsStream: SQSStream[NotificationMessage],
  sierraBibMergerUpdaterService: SierraBibMergerUpdaterService
)(implicit ec: ExecutionContext) {

  sqsStream.foreach(this.getClass.getSimpleName, process)

  private def process(message: NotificationMessage): Future[Unit] =
    for {
      record <- Future.fromTry(fromJson[SierraRecord](message.Message))
      _ <- sierraBibMergerUpdaterService.update(record.toBibRecord)
    } yield ()

  def stop() = system.terminate()
}

package uk.ac.wellcome.platform.sierra_bib_merger.services

import akka.actor.ActorSystem
import com.google.inject.Inject
import uk.ac.wellcome.messaging.sns.NotificationMessage
import uk.ac.wellcome.messaging.sqs.SQSStream
import uk.ac.wellcome.models.transformable.sierra.SierraBibRecord
import uk.ac.wellcome.utils.JsonUtil._

import scala.concurrent.{ExecutionContext, Future}

class SierraBibMergerWorkerService @Inject()(
  system: ActorSystem,
  sqsStream: SQSStream[NotificationMessage],
  sierraBibMergerUpdaterService: SierraBibMergerUpdaterService
)(implicit ec: ExecutionContext) {

  sqsStream.foreach(this.getClass.getSimpleName, process)

  private def process(message: NotificationMessage): Future[Unit] =
    for {
      record <- Future.fromTry(fromJson[SierraBibRecord](message.Message))
      _ <- sierraBibMergerUpdaterService.update(record)
    } yield ()

  def stop() = system.terminate()
}

Sort out the Sierra bib merger

Sort out the Sierra bib merger


package formats

import models._
import play.api.libs.json._
import scala.language.implicitConversions

trait CommonJsonFormats {
   implicit def stringToError(s: String): Error = new Error(s)
   implicit def eitherWrites[A,B](implicit fma: Writes[A], fmb: Writes[B]): Writes[Either[A,B]] = new Writes[Either[A,B]] {
      def writes(o: Either[A, B]) = o match {
         case Left(value) => fma.writes(value)
         case Right(value) => fmb.writes(value)
      }
   }

   def typeWrites[T](w : Writes[T]): Writes[T] = {
      w.transform( js => js.as[JsObject] - "_type"  ++ Json.obj("type" ->  js \ "_type") )
   }
}

package formats

import models._
import play.api.libs.json._
import scala.language.implicitConversions

trait CommonJsonFormats {
   implicit def stringToError(s: String): Error = new Error(s)
   implicit def eitherWrites[A,B](implicit fma: Writes[A], fmb: Writes[B]): Writes[Either[A,B]] = new Writes[Either[A,B]] {
      def writes(o: Either[A, B]) = o match {
         case Left(value) => fma.writes(value)
         case Right(value) => fmb.writes(value)
      }
   }

   def typeWrites[T](w : Writes[T]): Writes[T] = {
      w.transform( js => js.as[JsObject] - "_type"  ++ Json.obj("type" ->  js \ "_type") )
   }

   implicit val shortlistRead = Json.reads[Shortlist]
}

Add json bind for shortlist

Add json bind for shortlist


package latis.ops

import latis.dm.Scalar
import scala.math.ScalaNumericAnyConversions
import latis.dm.Integer
import latis.dm.Real
import latis.dm.Text

/**
 * Operation to replace any occurrence of a given value in a Dataset with another.
 * Numeric values will be compared as doubles.
 */
//class ReplaceValueOperation(v1: AnyVal, v2: AnyVal) extends Operation {
class ReplaceValueOperation(v1: Scalar, s2: String) extends Operation {
  /*
   * TODO: allow change of type?
   * But we often get vs from an operation expression (string) so we don't know the intended type.
   * Also issues about converting the model early enough?
   * Keep original type for now.
   */
  //TODO: limit to range vars?

  override def applyToScalar(scalar: Scalar): Option[Scalar] = {
    //TODO: consider exception, type conversion, None?
    //TODO: consider order, v1 data will be converted to type of scalar
    if ((scalar.compare(v1)) == 0) Some(scalar.updatedValue(s2))
    else Some(scalar) //no-op
  }
}

object ReplaceValueOperation {
  //TODO: extend OperationFactory so we can construct from expression: replace(v1,v2)

  def apply(v1: Scalar, s2: String): ReplaceValueOperation = new ReplaceValueOperation(v1, s2)

  def apply(v1: Any, v2: Any): ReplaceValueOperation = ReplaceValueOperation(Scalar(v1), v2.toString)
}

package latis.ops

import latis.dm.Scalar
import scala.math.ScalaNumericAnyConversions
import latis.dm.Integer
import latis.dm.Real
import latis.dm.Text

/**
 * Operation to replace any occurrence of a given value in a Dataset with another.
 * Numeric values will be compared as doubles.
 */
//class ReplaceValueOperation(v1: AnyVal, v2: AnyVal) extends Operation {
class ReplaceValueOperation(v1: Scalar, s2: String) extends Operation {
  /*
   * TODO: allow change of type?
   * But we often get vs from an operation expression (string) so we don't know the intended type.
   * Also issues about converting the model early enough?
   * Keep original type for now.
   */
  //TODO: limit to range vars?

  override def applyToScalar(scalar: Scalar): Option[Scalar] = {
    //TODO: consider exception, type conversion, None?
    //TODO: consider order, v1 data will be converted to type of scalar
    if ((scalar.compare(v1)) == 0) Some(scalar.updatedValue(s2))
    else Some(scalar) //no-op
  }
}

object ReplaceValueOperation extends OperationFactory {

  override def apply(args: Seq[String]): ReplaceValueOperation = ReplaceValueOperation(args(0), args(1))

  def apply(v1: Scalar, s2: String): ReplaceValueOperation = new ReplaceValueOperation(v1, s2)

  def apply(v1: Any, v2: Any): ReplaceValueOperation = ReplaceValueOperation(Scalar(v1), v2.toString)
}

Extend OperationFactory so we can use "replace" in PIs and URLs


package uk.ac.wellcome.platform.ingestor

import com.typesafe.config.{Config, ConfigFactory}
import grizzled.slf4j.Logging
import uk.ac.wellcome.config.core.builders.AkkaBuilder
import uk.ac.wellcome.config.elasticsearch.builders.ElasticBuilder
import uk.ac.wellcome.config.messaging.builders.MessagingBuilder
import uk.ac.wellcome.json.JsonUtil._
import uk.ac.wellcome.models.work.internal.IdentifiedBaseWork
import uk.ac.wellcome.platform.ingestor.config.builders.IngestorConfigBuilder
import uk.ac.wellcome.platform.ingestor.services.IngestorWorkerService

import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext}

object Main extends App with Logging {
  val config: Config = ConfigFactory.load()

  implicit val executionContext: ExecutionContext =
    AkkaBuilder.buildExecutionContext()

  val workerService = new IngestorWorkerService(
    elasticClient = ElasticBuilder.buildHttpClient(config),
    ingestorConfig = IngestorConfigBuilder.buildIngestorConfig(config),
    messageStream =
      MessagingBuilder.buildMessageStream[IdentifiedBaseWork](config)
  )

  try {
    info("Starting worker.")

    val result = workerService.run()

    Await.result(result, Duration.Inf)
  } catch {
    case e: Throwable =>
      error("Fatal error:", e)
  } finally {
    info("Terminating worker.")
  }
}

package uk.ac.wellcome.platform.ingestor

akka.actor.ActorSystem
import com.typesafe.config.{Config, ConfigFactory}
import grizzled.slf4j.Logging
import uk.ac.wellcome.config.core.builders.AkkaBuilder
import uk.ac.wellcome.config.elasticsearch.builders.ElasticBuilder
import uk.ac.wellcome.config.messaging.builders.MessagingBuilder
import uk.ac.wellcome.json.JsonUtil._
import uk.ac.wellcome.models.work.internal.IdentifiedBaseWork
import uk.ac.wellcome.platform.ingestor.config.builders.IngestorConfigBuilder
import uk.ac.wellcome.platform.ingestor.services.IngestorWorkerService

import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext}

object Main extends App with Logging {
  val config: Config = ConfigFactory.load()

  implicit val actorSystem: ActorSystem =
    AkkaBuilder.buildActorSystem()
  implicit val executionContext: ExecutionContext =
    AkkaBuilder.buildExecutionContext()

  val workerService = new IngestorWorkerService(
    elasticClient = ElasticBuilder.buildHttpClient(config),
    ingestorConfig = IngestorConfigBuilder.buildIngestorConfig(config),
    messageStream =
      MessagingBuilder.buildMessageStream[IdentifiedBaseWork](config)
  )

  try {
    info("Starting worker.")

    val result = workerService.run()

    Await.result(result, Duration.Inf)
  } catch {
    case e: Throwable =>
      error("Fatal error:", e)
  } finally {
    info("Terminating worker.")
  }
}

Add a missing implicit to the ingestor

Add a missing implicit to the ingestor


package controllers

import javax.inject._
import play.api._
import play.api.mvc._
import play.api.libs.json._

// TODO: where should this case class go
case class ContestRequest(petId1: String, petId2: String, contestType: String)

@Singleton
class Application @Inject() extends Controller {

  // Note: The reason we specify parse.tolerantJson is to avoid Play automatically handling
  // the error case where application/json is missing from the header. We want to avoid this case
  // because Play returns an HTML error message, which is inconsistent with our JSON error messages
  def contest = Action(parse.tolerantJson) { request =>

      implicit val contestRequestReads = Json.reads[ContestRequest]

      // parse the request
      val result: JsResult[ContestRequest] = Json.fromJson[ContestRequest](request.body)

      println(result)

      result match {
        case success: JsSuccess[ContestRequest] => Ok("ok\n")
        case error: JsError => BadRequest("\"Your request is malformed\"\n")
      }

  }

}

package controllers

import javax.inject._
import play.api._
import play.api.mvc._
import play.api.libs.json._

// TODO: where should this case class go
case class ContestRequest(petId1: String, petId2: String, contestType: String)

@Singleton
class Application @Inject() extends Controller {

  def launchContest(request: ContestRequest): Result = {
    Ok("ok\n")
  }

  // Note: The reason we specify parse.tolerantJson is to avoid Play automatically handling
  // the error case where application/json is missing from the header. We want to avoid this case
  // because Play returns an HTML error message, which is inconsistent with our JSON error messages
  def contest = Action(parse.tolerantJson) { request =>

      implicit val contestRequestReads = Json.reads[ContestRequest]

      // parse the request
      val result: JsResult[ContestRequest] = Json.fromJson[ContestRequest](request.body)

      println(result)

      result match {
        case success: JsSuccess[ContestRequest] => launchContest(success.value)
        case error: JsError => BadRequest("\"Your request is malformed\"\n")
      }
  }

}

Add launchContest function in /contest

Add launchContest function in /contest


package net.sansa_stack.rdf.spark.qualityassessment.metrics.understandability

import org.apache.spark.rdd.RDD
import org.apache.jena.graph.{ Triple, Node }
import net.sansa_stack.rdf.spark.qualityassessment.utils.NodeUtils._

/**
 * @author Gezim Sejdiu
 */
object LabeledResources {
  implicit class LabeledResourcesFunctions(dataset: RDD[Triple]) extends Serializable {
    def assessLabeledResources() = {

      val triples = dataset.count().toDouble

      val subjects = dataset.filter(f => f.getSubject.isURI() && isInternal(f.getSubject) && isLabeled(f.getPredicate)).count().toDouble
      val predicates = dataset.filter(f => isInternal(f.getPredicate) && isLabeled(f.getPredicate)).count().toDouble
      val objects = dataset.filter(f => f.getObject.isURI() && isInternal(f.getObject) && isLabeled(f.getPredicate)).count.toDouble

      val labeledResources = subjects + predicates + objects

      val value = if (triples > 0.0)
        labeledResources / triples;
      else 0

      value
    }
  }
}

package net.sansa_stack.rdf.spark.qualityassessment.metrics.understandability

import net.sansa_stack.rdf.spark.qualityassessment.utils.NodeUtils._
import org.apache.jena.graph.{ Node, Triple }
import org.apache.spark.rdd.RDD

/**
 * @author Gezim Sejdiu
 */
object LabeledResources {

  def assessLabeledResources(dataset: RDD[Triple]): Double = {

    val triples = dataset.count().toDouble

    val subjects = dataset.filter(f =>
      f.getSubject.isURI() && isInternal(f.getSubject) &&
        isLabeled(f.getPredicate)).count().toDouble

    val predicates = dataset.filter(f =>
      isInternal(f.getPredicate) && isLabeled(f.getPredicate)).count().toDouble

    val objects = dataset.filter(f =>
      f.getObject.isURI() && isInternal(f.getObject) &&
        isLabeled(f.getPredicate)).count.toDouble

    val labeledResources = subjects + predicates + objects

    val value = if (triples > 0.0) {
      labeledResources / triples
    } else 0

    value
  }
}

Refactor understandability metrics and make Scala-style compliant


package cc.factorie.app.nlp

import cc.factorie._

/**
 * Author: martin
 * Date: 2/25/12
 *
 * On each line, there should be a space-separated label and word.
 * Sentences are separated by blank lines.
 */
object LoadOWPL {
  def fromFilename(file: String, labelMaker: (Token, String) => LabelVariable[String], takeOnly: Int = -1): Seq[Document] = {
    val doc = new Document("", "")
    var sentence = new Sentence(doc)
    var numSentences = 1
    for (line <- io.Source.fromFile(file).getLines) {
      if (line.trim == "") {
        sentence = new Sentence(doc)
        numSentences += 1
        if (takeOnly > -1 && numSentences > takeOnly)
          return Seq(doc)
      }
      else {
        val fields = line.split(" ")
        val label = fields(0)
        val word = fields(1)
        val token = new Token(sentence, word)
        token.attr += labelMaker(token, label)
        doc.appendString(" ")
      }
    }
    Seq(doc)
  }
}

package cc.factorie.app.nlp

import cc.factorie._

/**
 * Author: martin
 * Date: 2/25/12
 *
 * On each line, there should be a space-separated label and word.
 * Sentences are separated by blank lines.
 */
object LoadOWPL {
  def fromFilename(file: String, labelMaker: (Token, String) => LabelVariable[String], takeOnly: Int = -1): Seq[Document] = {
    val doc = new Document("", "")
    var sentence = new Sentence(doc)
    var numSentences = 1
    for (line <- io.Source.fromFile(file).getLines) {
      if (line.trim == "") {
        sentence = new Sentence(doc)
        numSentences += 1
        if (takeOnly > -1 && numSentences > takeOnly)
          return Seq(doc)
      }
      else {
        val fields = line.split(" ")
        val label = fields(0)
        val word = fields(1).substring(5)
        val token = new Token(sentence, word)
        token.attr += labelMaker(token, label)
        doc.appendString(" ")
      }
    }
    Seq(doc)
  }
}

Fix bug in loading wall street journal data


package uk.ac.wellcome.platform.idminter.fixtures

import com.twitter.finatra.http.EmbeddedHttpServer
import org.scalatest.Suite
import uk.ac.wellcome.monitoring.test.fixtures.CloudWatch
import uk.ac.wellcome.platform.idminter.{Server => AppServer}
import uk.ac.wellcome.test.fixtures.TestWith

trait Server extends CloudWatch { this: Suite =>
  def withServer[R](
    flags: Map[String, String],
    modifyServer: (EmbeddedHttpServer) => EmbeddedHttpServer = identity
  )(testWith: TestWith[EmbeddedHttpServer, R]) = {

    val server: EmbeddedHttpServer = modifyServer(
      new EmbeddedHttpServer(
        new AppServer(),
        flags = Map(
          "aws.region" -> "localhost"
        ) ++ flags ++ cloudWatchLocalFlags
      )
    )

    server.start()

    try {
      testWith(server)
    } finally {
      server.close()
    }
  }
}

package uk.ac.wellcome.platform.idminter.fixtures

import org.scalatest.Suite
import uk.ac.wellcome.monitoring.test.fixtures.CloudWatch
import uk.ac.wellcome.platform.idminter.{Server => AppServer}
import uk.ac.wellcome.test.fixtures.ServerFixtures

trait Server extends ServerFixtures with CloudWatch { this: Suite =>
  def newAppServer: () => AppServer = () => new AppServer()

  val defaultFlags: Map[String, String] = Map("aws.region" -> "localhost") ++ cloudWatchLocalFlags
}

Move the ID minter server fixture to use the base trait


name := "plotly-client"

version := "0.1-SNAPSHOT"

scalaVersion := "2.11.7"

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

libraryDependencies ++= Seq(
  "org.scalaj" %% "scalaj-http" % "2.2.1",
  "org.json4s" %% "json4s-native" % "3.3.0",
  "org.scalatest" %% "scalatest" % "2.2.4" % "test"
)

initialCommands := """
  |import co.theasi.plotly._
""".stripMargin

publishMavenStyle := true

// Publishing not enabled yet.
publishTo <<= version { (v: String) =>
  val nexus = "https://oss.sonatype.org/"
  if (v.trim.endsWith("SNAPSHOT"))
    Some("snapshots" at nexus + "content/repositories/snapshots")
  else
    Some("releases"  at nexus + "service/local/staging/deploy/maven2")
}

name := "plotly-client"

version := "0.1-SNAPSHOT"

scalaVersion := "2.11.7"

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

libraryDependencies ++= Seq(
  "org.scalaj" %% "scalaj-http" % "2.2.1",
  "org.json4s" %% "json4s-native" % "3.3.0",
  "org.scalatest" %% "scalatest" % "2.2.4" % "test"
)

initialCommands := """
  |import co.theasi.plotly._
""".stripMargin

publishMavenStyle := true

parallelExecution in Test := false

// Publishing not enabled yet.
publishTo <<= version { (v: String) =>
  val nexus = "https://oss.sonatype.org/"
  if (v.trim.endsWith("SNAPSHOT"))
    Some("snapshots" at nexus + "content/repositories/snapshots")
  else
    Some("releases"  at nexus + "service/local/staging/deploy/maven2")
}

Disable parallel execution in tests.

Disable parallel execution in tests.

This was apparently overloading the Plotly server, or possibly my laptop.


// vim: ts=2 sw=2 et
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.debiki.v0

import org.junit._
import Assert._
import org.yaml.{snakeyaml => y}

object DaoYamlTest {

  private val testOutDir = System.getProperty("build.testOutputDirectory")

  object Paths {
    val MmaDebate = testOutDir +"/v0/compactDebate/_debate.yaml"
  }
}

@Test
class DaoYamlTest {
  import DaoYamlTest._

  @Test
  def testLoad() {
    val dao: Dao = new DaoYaml
    val debate = dao.getDebate(Paths.MmaDebate)
    assert(debate.id == "test-debate")
    assert(debate.postCount == 26)
    assert(debate.ratingsOn("j").length == 1)
    assert(debate.ratingsOn("c").length == 2)
    //assert(debate.postScore("h") == 3)
  }

}

// vim: ts=2 sw=2 et
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.debiki.v0

import org.junit._
import Assert._
import org.yaml.{snakeyaml => y}

object DaoYamlTest {

  private val testOutDir = System.getProperty("build.testOutputDirectory")

  object Paths {
    val MmaDebate = testOutDir +"/v0/_debate.yaml"
  }
}

@Test
class DaoYamlTest {
  import DaoYamlTest._

  @Test
  def testLoad() {
    val dao: Dao = new DaoYaml
    val debate = dao.getDebate(Paths.MmaDebate)
    assert(debate.id == "test-debate")
    assert(debate.postCount == 26)
    assert(debate.ratingsOn("j").length == 1)
    assert(debate.ratingsOn("c").length == 2)
    //assert(debate.postScore("h") == 3)
  }

}

Fix broken test: bad file path.

Fix broken test: bad file path.


package code.service

import code.model.Project
import code.test.utils.BaseSuite
import net.liftweb.mapper.By

class ProjectServiceTest extends BaseSuite {
  describe("Project Service") {
    it("Display name of the top level project") {
      assert(ProjectService.getDisplayName(projectByName("top")) == "top")
    }

    it("Display name of the middle level project") {
      assert(ProjectService.getDisplayName(projectByName("middle")) == "top-middle")
    }

    it("Display name of the bottom level project") {
      assert(ProjectService.getDisplayName(projectByName("bottom")) == "top-middle-bottom")
    }

    it("Move bottom project to any parent project") {
      ProjectService.move(projectByName("bottom"), projectByName("any project"))

      assert(ProjectService.getDisplayName(projectByName("bottom")) == "top-any project-bottom")
    }

    it("Move bottom project to root") {
      ProjectService.moveToRoot(projectByName("bottom"))

      assert(ProjectService.getDisplayName(projectByName("bottom")) == "bottom")
    }

    it("The top level project is not empty") {
      assert(!ProjectService.isEmpty(projectByName("top")))
    }

    it("The bottom level project is empty") {
      assert(ProjectService.isEmpty(projectByName("bottom")))
    }

    it("Delete a bottom level project") {
      assert(ProjectService.delete(projectByName("bottom")))
    }

    it("Delete an active top level project") {
      ProjectService.delete(projectByName("top"))
      assert(!projectByName("top").active.get)
    }

    it("Try to delete an inactivated top level project") {
      val me = projectByName("top").active(false).saveMe()
      intercept[IllegalArgumentException] {
        ProjectService.delete(me)
      }
    }
  }

  given {
    traverse(
      project("top",
        project("any project"),
        project("middle",
          project("bottom")))) foreach(_.save())
  }

  def projectByName(n: String): Project = Project.find(By(Project.name, n)).openOrThrowException("Test entity must be presented!")

}

package code.service

import code.model.Project
import code.test.utils.BaseSuite
import net.liftweb.mapper.By

class ProjectServiceTest extends BaseSuite {
  describe("Project Service") {
    it("The top level project is not empty") {
      assert(!ProjectService.isEmpty(projectByName("top")))
    }

    it("The bottom level project is empty") {
      assert(ProjectService.isEmpty(projectByName("bottom")))
    }

    it("Delete a bottom level project") {
      assert(ProjectService.delete(projectByName("bottom")))
    }

    it("Delete an active top level project") {
      ProjectService.delete(projectByName("top"))
      assert(!projectByName("top").active.get)
    }

    it("Try to delete an inactivated top level project") {
      val me = projectByName("top").active(false).saveMe()
      intercept[IllegalArgumentException] {
        ProjectService.delete(me)
      }
    }
  }

  given {
    traverse(
      project("top",
        project("any project"),
        project("middle",
          project("bottom")))) foreach(_.save())
  }

  def projectByName(n: String): Project = Project.find(By(Project.name, n)).openOrThrowException("Test entity must be presented!")

}

Fix project service test compilation errors.


import configuration.Scenario
import java.io.FileNotFoundException
import org.json4s._
import org.json4s.native.JsonMethods._
import org.slf4j.LoggerFactory
import outputs.base.Output
import scala.Array
import scala.io.Source
import workflows.base.Workflow

/** Execute one or more scenarios defined in the specified configuration file. */
object Runner extends App {
  implicit val formats = DefaultFormats

  def logger = LoggerFactory.getLogger(this.getClass)

  val scenarios = parse(Source.fromFile(args(0)).mkString).extract[Array[Scenario]]

  if (scenarios.isEmpty) {
    logger.warn("No scenario found")
  } else {
    logger.info("Loaded " + scenarios.length + " scenario(s)")
  }

  for (scenario <- scenarios) {
    val workflow = Class.forName(scenario.workflow.name).newInstance().asInstanceOf[Workflow]
    val output = Class.forName(scenario.output.name).newInstance().asInstanceOf[Output]

    logger.info("Executing workflow " + scenario.workflow.name + " with output " + scenario.output.name)
    try {
      output.execute(scenario.output.args, workflow.run(scenario.workflow.args).toArray)
    } catch {
      case e: Exception => logger.error("Workflow " + scenario.workflow.name + " failed: " + e.toString)
    }
  }
}

import configuration.Scenario
import org.json4s._
import org.json4s.native.JsonMethods._
import org.slf4j.LoggerFactory
import outputs.base.Output
import scala.Array
import scala.io.Source
import workflows.base.Workflow

/** Execute one or more scenarios defined in the specified configuration file. */
object Runner extends App {
  implicit val formats = DefaultFormats

  def logger = LoggerFactory.getLogger(this.getClass)

  var scenarios = Array.empty[Scenario]

  if (args.length > 0) {
    scenarios = parse(Source.fromFile(args(0)).mkString).extract[Array[Scenario]]
  } else {
    scenarios = parse(sys.env("RUNNER_CONFIGURATION")).extract[Array[Scenario]]
  }

  if (scenarios.isEmpty) {
    logger.warn("No scenario found")
  } else {
    logger.info("Loaded " + scenarios.length + " scenario(s)")
  }

  for (scenario <- scenarios) {
    val workflow = Class.forName(scenario.workflow.name).newInstance().asInstanceOf[Workflow]
    val output = Class.forName(scenario.output.name).newInstance().asInstanceOf[Output]

    logger.info("Executing workflow " + scenario.workflow.name + " with output " + scenario.output.name)
    try {
      output.execute(scenario.output.args, workflow.run(scenario.workflow.args).toArray)
    } catch {
      case e: Exception => logger.error("Workflow " + scenario.workflow.name + " failed: " + e.toString)
    }
  }
}

Read configuration from ENV if no file is specified


publishMavenStyle := true

publishArtifact in Test := false

pomIncludeRepository := { x => false }

publishTo := {
  val artifactory = "http://commbank.artifactoryonline.com/commbank/"
  if (version.value.trim.endsWith("SNAPSHOT"))
    Some("snapshots" at artifactory + "plugins-snapshots")
  else
    Some("releases"  at artifactory + "plugins-releases")
}

pomExtra := <url>https://github.com/thoughtworks/sbteo</url>
  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <url>git@github.com:thoughtworks/sbteo.git</url>
    <connection>scm:git:git@github.com:thoughtworks/sbteo.git</connection>
  </scm>
  <developers>
    <developer>
      <id>PilchardFriendly</id>
      <name>Nick Drew</name>
      <url>http://github.com/PilchardFriendly</url>
    </developer>
  </developers>

publishMavenStyle := true

publishArtifact in Test := false

pomIncludeRepository := { x => false }

publishTo := {
  val artifactory = "http://commbank.artifactoryonline.com/commbank/"
  if (version.value.trim.endsWith("SNAPSHOT"))
    Some("snapshots" at artifactory + "plugins-snapshots")
  else
    Some("releases"  at artifactory + "plugins-releases")
}

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

pomExtra := <url>https://github.com/thoughtworks/sbteo</url>
  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <url>git@github.com:thoughtworks/sbteo.git</url>
    <connection>scm:git:git@github.com:thoughtworks/sbteo.git</connection>
  </scm>
  <developers>
    <developer>
      <id>PilchardFriendly</id>
      <name>Nick Drew</name>
      <url>http://github.com/PilchardFriendly</url>
    </developer>
  </developers>

Add release repo credential path

Add release repo credential path


scalacOptions := Seq(
  "-deprecation"
)

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

scalacOptions := Seq(
  "-deprecation"
)

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

Update http4s-blaze-client, http4s-circe to 0.21.21


name := "purescript-eval"

resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"

libraryDependencies ++= Seq(
  "io.argonaut" %% "argonaut" % "6.0.4",
  "org.specs2" %% "specs2-core" % "3.6.1" % "test"
)

compileOrder := CompileOrder.JavaThenScala

name := "purescript-eval"

resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"

javacOptions ++= Seq("-source", "1.7")

libraryDependencies ++= Seq(
  "io.argonaut" %% "argonaut" % "6.0.4",
  "org.specs2" %% "specs2-core" % "3.6.1" % "test",
  "com.oracle" % "truffle" % "0.7",
  "com.oracle" % "truffle-dsl-processor" % "0.7"
)

compileOrder := CompileOrder.JavaThenScala

Use published Truffle jars to make things easier


addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.4.0")

addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")

Revert "Update to sbt-bintray 0.4.0"

Revert "Update to sbt-bintray 0.4.0"


resolvers += "spray repo" at "http://repo.spray.io"

resolvers += Resolver.url("scala-js-releases",
  url("http://dl.bintray.com/content/scala-js/scala-js-releases"))(
    Resolver.ivyStylePatterns)

resolvers += Resolver.url("scala-js-snapshots",
  url("http://repo.scala-js.org/repo/snapshots/"))(
    Resolver.ivyStylePatterns)

addSbtPlugin("org.scala-lang.modules.scalajs" % "scalajs-sbt-plugin" % "0.3")

addSbtPlugin("com.lihaoyi" % "workbench" % "0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-start-script" % "0.10.0")

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

Add sbt-revolver to the list of required plugins


Set project dependencies to HEAD of the respective projects.


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.16-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.17-BETA",
			minSdkVersion in Android := "10",
			platformTarget in Android := "android-21",
			targetSdkVersion in Android := "21"
		)
}

Set project version to 0.3.17-BETA

Set project version to 0.3.17-BETA


addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.4")

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

addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.4")

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

Update scala-js plugin to 0.6.15

Update scala-js plugin to 0.6.15


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

addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"             % "0.9.29")
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.5.3")
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.7")

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

addSbtPlugin("ch.epfl.scala"      % "sbt-scalafix"             % "0.9.29")
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.5.3")
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.7")

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


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

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

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.2.4")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.12.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.8")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

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

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

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.2.4")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.12.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.9")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

Update sbt-native-packager to 1.9.9 in series/0.22


// Imports

import scalariform.formatter.preferences._

import de.johoop.findbugs4sbt.FindBugs._

import de.johoop.jacoco4sbt._

import JacocoPlugin._

// Global build settings

fork := true

// Scalariform - source code formatter

// disable automatic reformat on compile
// instead use 'scalariform-format' command in sbt
defaultScalariformSettings // instead of scalariformSettings

// list of preferences available at http://mdr.github.io/scalariform/
ScalariformKeys.preferences := FormattingPreferences()
  .setPreference(AlignSingleLineCaseStatements, true)
  .setPreference(DoubleIndentClassDeclaration, true)
  .setPreference(PreserveDanglingCloseParenthesis, true)

// FindBugs settings

findbugsSettings

findbugsReportType := Some(de.johoop.findbugs4sbt.ReportType.FancyHistHtml)

findbugsPriority := de.johoop.findbugs4sbt.Priority.Low

findbugsEffort := de.johoop.findbugs4sbt.Effort.Maximum

findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html")

// JacocoPlugin settings

jacoco.settings

// Imports

import scalariform.formatter.preferences._

import de.johoop.findbugs4sbt.FindBugs._

import de.johoop.jacoco4sbt._

import JacocoPlugin._

// Global build settings

// Scalariform - source code formatter

// disable automatic reformat on compile
// instead use 'scalariform-format' command in sbt
defaultScalariformSettings // instead of scalariformSettings

// list of preferences available at http://mdr.github.io/scalariform/
ScalariformKeys.preferences := FormattingPreferences()
  .setPreference(AlignSingleLineCaseStatements, true)
  .setPreference(DoubleIndentClassDeclaration, true)
  .setPreference(PreserveDanglingCloseParenthesis, true)

// FindBugs settings

findbugsSettings

findbugsReportType := Some(de.johoop.findbugs4sbt.ReportType.FancyHistHtml)

findbugsPriority := de.johoop.findbugs4sbt.Priority.Low

findbugsEffort := de.johoop.findbugs4sbt.Effort.Maximum

findbugsReportPath := Some(crossTarget.value / "findbugs" / "report.html")

// JacocoPlugin settings

jacoco.settings

Fix bug in SBT config

Fix bug in SBT config

Remove property that forks by default. This may cause problems in some
cases for certain applications, and this property should not be forced
in the global build configuration.


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

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

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

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")

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

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

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

addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

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

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

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

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")

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

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

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

addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

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


package fi.pyppe.ircbot.slave

import twitter4j.TwitterFactory
import scala.concurrent.{ExecutionContext, Future}

object Tweets {

  def statusText(id: Long)(implicit ec: ExecutionContext): Future[String] = Future {
    val status = TwitterFactory.getSingleton.showStatus(id)
    val user = s"@${status.getUser.getScreenName} (${status.getUser.getName})"
    val text = status.getText.replace("\n", " ")
    s"$user: $text"
  }

}

package fi.pyppe.ircbot.slave

import twitter4j.TwitterFactory
import scala.concurrent.{ExecutionContext, Future}

object Tweets {

  def statusText(id: Long)(implicit ec: ExecutionContext): Future[String] = Future {
    val status = TwitterFactory.getSingleton.showStatus(id)
    val user = s"@${status.getUser.getScreenName} (${status.getUser.getName})"
    val text = removeUrls(status.getText.replace("\n", " "))

    s"$user: $text"
  }

  private def removeUrls(str: String) = str.replaceAll(
    "https?://\\S+\\b",
    ""
  ).trim

}

Remove urls in Twitter statuses

Remove urls in Twitter statuses


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

package scala.tools.eclipse.util

import scala.tools.nsc.Settings

object IDESettings {
  def shownSettings(s : Settings) : List[Settings#Setting]= {
    import s._
    List(
      deprecation, g, optimise, target, unchecked,
      checkInit, noassertions, elidebelow, Xexperimental, future, XlogImplicits, Xmigration28, nouescape, plugin, disable, require, pluginsDir, pluginOptions,
      Xcloselim, Xdce, Xdetach, inline, Xlinearizer, Ynogenericsig, noimports, nopredefs, Yrecursion, selfInAnnots, Xsqueeze, refinementMethodDispatch, nospecialization,
      Xwarnfatal, Xwarninit, Xchecknull, Ywarndeadcode, Ybuildmanagerdebug)
  }
}

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

package scala.tools.eclipse.util

import scala.tools.nsc.Settings

object IDESettings {
  def shownSettings(s : Settings) : List[Settings#Setting]= {
    import s._
    List(
      deprecation, g, optimise, target, unchecked,
      checkInit, noassertions, elidebelow, Xexperimental, future, XlogImplicits, Xmigration28, nouescape, plugin, disable, require, pluginsDir, pluginOptions,
      Xcloselim, Xdce, inline, Xlinearizer, Ynogenericsig, noimports, nopredefs, Yrecursion, selfInAnnots, Xsqueeze, refinementMethodDispatch, nospecialization,
      Xwarnfatal, Xwarninit, Xchecknull, Ywarndeadcode, Ybuildmanagerdebug)
  }
}

Remove setting removed by the compiler. We really have to have something to obtain a list of relevant options from the compiler automatically, but now it does not seem feasible.


package dotty.tools
package dotc
package util

import scala.collection.mutable

trait FreshNameCreator {
  def newName(prefix: String = ""): String

  @deprecated("use newName(prefix)", "2.9.0")
  def newName(pos: scala.reflect.internal.util.Position, prefix: String): String = newName(prefix)
  @deprecated("use newName()", "2.9.0")
  def newName(pos: scala.reflect.internal.util.Position): String = newName()
}

object FreshNameCreator {
  class Default extends FreshNameCreator {
    protected var counter = 0
    protected val counters = mutable.AnyRefMap[String, Int]() withDefaultValue 0

    /**
     * Create a fresh name with the given prefix. It is guaranteed
     * that the returned name has never been returned by a previous
     * call to this function (provided the prefix does not end in a digit).
     */
    def newName(prefix: String): String = {
      val safePrefix = prefix.replaceAll("""[<>]""", """\$""")
      counters(safePrefix) += 1
      val counter = counters(safePrefix)
      if (prefix.isEmpty) "$" + counter + "$" else safePrefix + counter
    }
  }
}

package dotty.tools
package dotc
package util

import scala.collection.mutable

trait FreshNameCreator {
  def newName(prefix: String = ""): String
}

object FreshNameCreator {
  class Default extends FreshNameCreator {
    protected var counter = 0
    protected val counters = mutable.AnyRefMap[String, Int]() withDefaultValue 0

    /**
     * Create a fresh name with the given prefix. It is guaranteed
     * that the returned name has never been returned by a previous
     * call to this function (provided the prefix does not end in a digit).
     */
    def newName(prefix: String): String = {
      val safePrefix = prefix.replaceAll("""[<>]""", """\$""")
      counters(safePrefix) += 1
      val counter = counters(safePrefix)
      if (prefix.isEmpty) "$" + counter + "$" else safePrefix + counter
    }
  }
}

Remove unused methods depending on scala-reflect


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

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

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

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

Set project version to 0.0.5-BETA

Set project version to 0.0.5-BETA


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Update sbt-wartremover, wartremover to 2.4.11


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

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

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

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")

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

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

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

addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

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

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

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

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")

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

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

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

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

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

addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

Update sbt-scala-native-crossproject, ... to 1.2.0


import sbt._

import Keys._

import com.socrata.socratasbt._

object DataCoordinator extends Build {
  lazy val dataCoordinator = Project(
    "data-coordinator",
    file("."),
    settings = Defaults.defaultSettings ++ SocrataSbt.socrataBuildSettings ++ Seq(scalaVersion := "2.10.0")
  ) aggregate (allOtherProjects: _*)

  private def allOtherProjects =
    for {
      method <- getClass.getDeclaredMethods.toSeq
      if method.getParameterTypes.isEmpty && classOf[Project].isAssignableFrom(method.getReturnType) && method.getName != "dataCoordinator"
    } yield method.invoke(this).asInstanceOf[Project] : ProjectReference

  private def p(name: String, settings: { def settings: Seq[Setting[_]] }, dependencies: ClasspathDep[ProjectReference]*) =
    Project(name, file(name), settings = settings.settings) dependsOn(dependencies: _*)

  lazy val coordinatorLib = p("coordinatorlib", CoordinatorLib)

  lazy val perfTest = p("perftest", PerfTest,
    coordinatorLib)

  lazy val coordinator = p("coordinator", Coordinator,
    coordinatorLib)
}

import sbt._

object DataCoordinator extends Build {
  lazy val dataCoordinator = Project(
    "data-coordinator",
    file("."),
    settings = BuildSettings.buildSettings
  ) aggregate (allOtherProjects: _*)

  private def allOtherProjects =
    for {
      method <- getClass.getDeclaredMethods.toSeq
      if method.getParameterTypes.isEmpty && classOf[Project].isAssignableFrom(method.getReturnType) && method.getName != "dataCoordinator"
    } yield method.invoke(this).asInstanceOf[Project] : ProjectReference

  private def p(name: String, settings: { def settings: Seq[Setting[_]] }, dependencies: ClasspathDep[ProjectReference]*) =
    Project(name, file(name), settings = settings.settings) dependsOn(dependencies: _*)

  lazy val coordinatorLib = p("coordinatorlib", CoordinatorLib)

  lazy val perfTest = p("perftest", PerfTest,
    coordinatorLib)

  lazy val coordinator = p("coordinator", Coordinator,
    coordinatorLib)
}

Make the build depend on the build-settings


package hmda.api.processing.lar

import java.io.File
import hmda.api.processing.ActorSpec
import hmda.api.processing.lar.SingleLarValidation.CheckLar
import hmda.parser.fi.lar.LarCsvParser
import scala.io.Source

class SingleLarValidationSpec extends ActorSpec {

  val larValidation = system.actorOf(SingleLarValidation.props, "larValidation")

  val lines = Source.fromFile(new File("parser/src/test/resources/txt/THE_LYONS_NATIONAL_BANK.txt")).getLines()
  val lars = lines.drop(1).map(l => LarCsvParser(l))

  "LAR Validation" must {
    "validate all lars in sample files" in {
      lars.foreach { lar =>
        larValidation ! CheckLar(lar)
        expectMsg(Nil)
      }
    }
  }

}

package hmda.api.processing.lar

import java.io.File
import hmda.api.processing.ActorSpec
import hmda.api.processing.lar.SingleLarValidation.CheckLar
import hmda.parser.fi.lar.LarCsvParser
import scala.io.Source

class SingleLarValidationSpec extends ActorSpec {

  val larValidation = system.actorOf(SingleLarValidation.props, "larValidation")

  val lines = Source.fromFile(new File("parser/src/test/resources/txt/FirstTestBankData_clean_407_2017.txt")).getLines()
  val lars = lines.drop(1).map(l => LarCsvParser(l))

  "LAR Validation" must {
    "validate all lars in sample files" in {
      lars.foreach { lar =>
        larValidation ! CheckLar(lar)
        expectMsg(Nil)
      }
    }
  }

}

Update test file for Single Lar Validation Test


package scorex.transaction

import scorex.block.Block
import scorex.block.Block.BlockId
import scorex.utils.ScorexLogging

import scala.util.{Failure, Success, Try}

/**
  * Storage interface combining both history(blockchain/blocktree) and state
  */
trait BlockStorage extends ScorexLogging {

  val MaxRollback: Int

  val history: History

  def state: LagonakiState

  //Append block to current state
  def appendBlock(block: Block): Try[Unit] = synchronized {
    history.appendBlock(block).map { blocks =>
      blocks foreach { b =>
        state.processBlock(b) match {
          case Failure(e) =>
            log.error("Failed to apply block to state", e)
            removeAfter(block.referenceField.value)
            //TODO ???
            System.exit(1)
          case Success(m) =>
        }
      }
    }
  }

  //Should be used for linear blockchain only
  def removeAfter(signature: BlockId): Unit = synchronized {
    history match {
      case h: BlockChain =>
        val height = h.heightOf(signature).get
        while (!h.lastBlock.uniqueId.sameElements(signature)) h.discardBlock()
        state.rollbackTo(height)
      case _ =>
        throw new RuntimeException("Not available for other option than linear blockchain")
    }
  }

}

object BlockStorage {

  sealed trait Direction

  case object Forward extends Direction

  case object Reversed extends Direction

  /*
 * Block and direction to process it
 */
  type BlocksToProcess = Seq[Block]
}

package scorex.transaction

import scorex.block.Block
import scorex.block.Block.BlockId
import scorex.crypto.encode.Base58
import scorex.utils.ScorexLogging

import scala.util.{Failure, Success, Try}

/**
  * Storage interface combining both history(blockchain/blocktree) and state
  */
trait BlockStorage extends ScorexLogging {

  val MaxRollback: Int

  val history: History

  def state: LagonakiState

  //Append block to current state
  def appendBlock(block: Block): Try[Unit] = synchronized {
    history.appendBlock(block).map { blocks =>
      blocks foreach { b =>
        state.processBlock(b) match {
          case Failure(e) =>
            log.error("Failed to apply block to state", e)
            removeAfter(block.referenceField.value)
            //TODO ???
            System.exit(1)
          case Success(m) =>
        }
      }
    }
  }

  //Should be used for linear blockchain only
  def removeAfter(signature: BlockId): Unit = synchronized {
    history match {
      case h: BlockChain => h.heightOf(signature) match {
        case Some(height) =>
          while (!h.lastBlock.uniqueId.sameElements(signature)) h.discardBlock()
          state.rollbackTo(height)
        case None =>
          log.warn(s"RemoveAfter non-existing block ${Base58.encode(signature)}")
      }
      case _ =>
        throw new RuntimeException("Not available for other option than linear blockchain")
    }
  }

}

object BlockStorage {

  sealed trait Direction

  case object Forward extends Direction

  case object Reversed extends Direction

  /*
 * Block and direction to process it
 */
  type BlocksToProcess = Seq[Block]
}

Check that block exists in removeAfter

Check that block exists in removeAfter


package com.redislabs.provider.redis.util

import org.apache.commons.lang3.StringUtils
import redis.clients.jedis.{EntryID, Jedis}

/**
  * @author The Viet Nguyen
  */
object StreamUtils extends Logging {

  val EntryIdEarliest = new EntryID(0, 0)

  def createConsumerGroupIfNotExist(conn: Jedis, streamKey: String, groupName: String,
                                    offset: EntryID): Unit = {
    createConsumerGroupIfNotExistOrElse(conn, streamKey, groupName, offset) {
      // ignore existing group
    }
  }

  def createConsumerGroupIfNotExistOrElseReset(conn: Jedis, streamKey: String, groupName: String,
                                               offset: EntryID): Unit = {
    createConsumerGroupIfNotExistOrElse(conn, streamKey, groupName, offset) {
      conn.xgroupSetID(streamKey, groupName, offset)
    }
  }

  private def createConsumerGroupIfNotExistOrElse(conn: Jedis, streamKey: String, groupName: String,
                                                  offset: EntryID)(orElse: => Unit): Unit = {
    try {
      conn.xgroupCreate(streamKey, groupName, offset, true)
    } catch {
      case e: Exception if StringUtils.contains(e.getMessage, "already exists") =>
        logInfo(s"Consumer group exists: $groupName")
        orElse()
    }
  }
}

package com.redislabs.provider.redis.util

import org.apache.commons.lang3.StringUtils
import redis.clients.jedis.{EntryID, Jedis}

/**
  * @author The Viet Nguyen
  */
object StreamUtils extends Logging {

  val EntryIdEarliest = new EntryID(0, 0)

  def createConsumerGroupIfNotExist(conn: Jedis, streamKey: String, groupName: String,
                                    offset: EntryID, reset: Boolean = false): Unit = {
    try {
      conn.xgroupCreate(streamKey, groupName, offset, true)
    } catch {
      case e: Exception if StringUtils.contains(e.getMessage, "already exists") =>
        logInfo(s"Consumer group exists: $groupName")
        if (reset) {
          logInfo(s"Reset consumer group: $groupName")
          conn.xgroupSetID(streamKey, groupName, offset)
        }
    }
  }
}

Simplify reset existing consumer group

Simplify reset existing consumer group


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

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

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

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

Set project version to 0.0.20-BETA

Set project version to 0.0.20-BETA


addSbtPlugin("com.github.sbt"       % "sbt-pgp"                       % "2.1.2")
addSbtPlugin("org.scoverage"        % "sbt-scoverage"                 % "1.6.0")
addSbtPlugin("com.typesafe.sbt"     % "sbt-git"                       % "1.0.0")
addSbtPlugin("org.scala-js"         % "sbt-scalajs"                   % "1.5.0")
addSbtPlugin("org.portable-scala"   % "sbt-scalajs-crossproject"      % "1.0.0")
addSbtPlugin("org.portable-scala"   % "sbt-scala-native-crossproject" % "1.0.0")
addSbtPlugin("org.xerial.sbt"       % "sbt-sonatype"                  % "3.9.7")
addSbtPlugin("ohnosequences"        % "sbt-github-release"            % "0.7.0")
addSbtPlugin("com.eed3si9n"         % "sbt-buildinfo"                 % "0.10.0")
addSbtPlugin("org.scala-native"     % "sbt-scala-native"              % "0.4.0")

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

addSbtPlugin("com.github.sbt"       % "sbt-pgp"                       % "2.1.2")
addSbtPlugin("org.scoverage"        % "sbt-scoverage"                 % "1.6.0")
addSbtPlugin("com.typesafe.sbt"     % "sbt-git"                       % "1.0.0")
addSbtPlugin("org.scala-js"         % "sbt-scalajs"                   % "1.5.1")
addSbtPlugin("org.portable-scala"   % "sbt-scalajs-crossproject"      % "1.0.0")
addSbtPlugin("org.portable-scala"   % "sbt-scala-native-crossproject" % "1.0.0")
addSbtPlugin("org.xerial.sbt"       % "sbt-sonatype"                  % "3.9.7")
addSbtPlugin("ohnosequences"        % "sbt-github-release"            % "0.7.0")
addSbtPlugin("com.eed3si9n"         % "sbt-buildinfo"                 % "0.10.0")
addSbtPlugin("org.scala-native"     % "sbt-scala-native"              % "0.4.0")

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

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


addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.12")
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.9.0")
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.0.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.12")
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.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.4")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

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

Update sbt-scalajs, scalajs-compiler, ... to 1.10.0 in master


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

resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"
resolvers += "HMRC Releases" at "https://dl.bintray.com/hmrc/releases"

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

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

addSbtPlugin("uk.gov.hmrc" % "sbt-artifactory" % "1.0.0")

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

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

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

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

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

resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/"
resolvers += "HMRC Releases" at "https://dl.bintray.com/hmrc/releases"

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

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

addSbtPlugin("uk.gov.hmrc" % "sbt-artifactory" % "1.0.0")

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

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

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

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

Update sbt auto build version

[CU][DLS-1839]: Update sbt auto build version


package io.github.bamos

object Whitelist {
  val users = Seq(
    "adius",
    "adobe-research",
    "ajn123",
    "bamos",
    "bryangarza",
    "cmusatyalab",
    "darksigma",
    "docker",
    "jebes",
    "HackathonHackers",
    "hamiltont",
    "ObeliskIsHuge",
    "rhema",
    "snowplow",
    "tejasmanohar",
    "themattman",
    "VT-Magnum-Research",
    "WalnutiQ",
    "zmughal",
    "geotrellis",
    "twitter",
    "github",
    "facebook",
    "etsy",
    "square",
    "amplab",
    "fnothaft",
    "bigdatagenomics",
    "homebrew",
    "puppetlabs",
    "rails",
    "google",
    "okfn",
    "humblesoftware",
    "ecomfe",
    "mozilla",
    "spine",
    "jez",
    "haskell",
    "coreos",
    "scotty-web"
  ).map(_.toLowerCase)
}

package io.github.bamos

object Whitelist {
  val users = Seq(
    "adius",
    "adobe-research",
    "ajn123",
    "bamos",
    "bryangarza",
    "cmusatyalab",
    "darksigma",
    "docker",
    "jebes",
    "HackathonHackers",
    "hamiltont",
    "ObeliskIsHuge",
    "rhema",
    "snowplow",
    "tejasmanohar",
    "themattman",
    "VT-Magnum-Research",
    "WalnutiQ",
    "zmughal",
    "geotrellis",
    "twitter",
    "github",
    "facebook",
    "etsy",
    "square",
    "amplab",
    "fnothaft",
    "bigdatagenomics",
    "homebrew",
    "puppetlabs",
    "rails",
    "google",
    "okfn",
    "humblesoftware",
    "ecomfe",
    "mozilla",
    "spine",
    "jez",
    "haskell",
    "coreos",
    "scotty-web",
    "vishnuravi"
  ).map(_.toLowerCase)
}

Add my account to the whitelist

Add my account to the whitelist


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.6"

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

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

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.6"

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

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

autocommit: Update configuration to record version 0.2.89


name := "debiki-tck-dao"

organization := "com.debiki"

version := "0.0.2-SNAPSHOT"

scalaVersion := "2.10.0-RC1"

libraryDependencies ++= Seq(
  "junit" % "junit" % "4.7",
  //"org.specs2" %% "specs2" % "1.12.2"  —> unresolved dependency: //"org.specs2#specs2_2.10;1.12.2: not found"
  "org.specs2" % "specs2_2.10.0-RC1" % "1.12.2"
)

// See: https://groups.google.com/forum/?fromgroups=#!topic/simple-build-tool/bkF1IDZj4L0
ideaPackagePrefix := None

// vim: fdm=marker et ts=2 sw=2 tw=80 fo=tcqwn list

name := "debiki-tck-dao"

organization := "com.debiki"

version := "0.0.2-SNAPSHOT"

scalaVersion := "2.10.0"

libraryDependencies ++= Seq(
  "junit" % "junit" % "4.7",
  "org.specs2" %% "specs2" % "1.14"
)

// See: https://groups.google.com/forum/?fromgroups=#!topic/simple-build-tool/bkF1IDZj4L0
ideaPackagePrefix := None

// vim: fdm=marker et ts=2 sw=2 tw=80 fo=tcqwn list

Update from Scala 2.10.0-RC1 to 2.10.0.

Update from Scala 2.10.0-RC1 to 2.10.0.


name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.4"

crossScalaVersions := Seq("2.12.4", "2.11.12")

version := "0.1.15"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.7",
      "org.scalatest" %% "scalatest" % "3.0.4" % Test
    )
  )

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

name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.4"

crossScalaVersions := Seq("2.12.4", "2.11.12")

version := "0.1.16"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.6.7",
      "org.scalatest" %% "scalatest" % "3.0.4" % Test
    )
  )

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

autocommit: Update configuration to record version 0.1.16


name := "hadoop-aws"

organization := "io.grhodes"

version := "git describe --tags --dirty --always".!!.stripPrefix("v").trim

scalaVersion := "2.11.12"

licenses += ("Apache-2.0", url("http://opensource.org/licenses/apache-2.0"))

libraryDependencies ++= Seq(
  "com.google.guava" % "guava" % "11.0.2",
  "com.amazonaws" % "aws-java-sdk-s3" % "1.10.77",
  "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.7",
  "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7",
  "org.apache.hadoop" % "hadoop-common" % "2.7.5" % Configurations.Provided
)

name := "hadoop-aws"

organization := "io.grhodes"

version := "git describe --tags --dirty --always".!!.stripPrefix("v").trim

scalaVersion := "2.11.12"

licenses += ("Apache-2.0", url("http://opensource.org/licenses/apache-2.0"))

libraryDependencies ++= Seq(
  "com.google.guava" % "guava" % "11.0.2",
  "com.amazonaws" % "aws-java-sdk-s3" % "1.11.283",
  "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.7",
  "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7",
  "org.apache.hadoop" % "hadoop-common" % "2.7.5" % Configurations.Provided
)

Upgrade aws sdk to 1.11.X

Upgrade aws sdk to 1.11.X


package mesosphere.chaos.http

import javax.servlet.http.{HttpServletRequest, HttpServletResponse, HttpServlet}

/**
 * An HTTP servlets which outputs a {@code text/plain} {@code "pong"} response.
 *
 * PingServlet from com.codahale.metrics, with CORBS header added.
 */

class PingServlet extends HttpServlet {

  private final val CONTENT_TYPE = "text/plain"
  private final val CONTENT = "pong"
  private final val CACHE_CONTROL = "Cache-Control"
  private final val NO_CACHE = "must-revalidate,no-cache,no-store"
  private final val ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"
  private final val STAR = "*"

  protected override def doGet(req: HttpServletRequest, resp: HttpServletResponse) {
    resp.setStatus(HttpServletResponse.SC_OK)
    resp.setHeader(CACHE_CONTROL, NO_CACHE)
    resp.setHeader(ACCESS_CONTROL_ALLOW_ORIGIN, STAR)
    resp.setContentType(CONTENT_TYPE)

    val writer = resp.getWriter
    try {
      writer.println(CONTENT)
    }
    finally {
      writer.close()
    }
  }
}

package mesosphere.chaos.http

import javax.servlet.http.{HttpServletRequest, HttpServletResponse, HttpServlet}

/**
 * An HTTP servlets which outputs a {@code text/plain} {@code "pong"} response.
 *
 * PingServlet from com.codahale.metrics, with CORBS header added.
 */

class PingServlet extends HttpServlet {

  private final val CONTENT_TYPE = "text/plain"
  private final val CONTENT = "pong"
  private final val CACHE_CONTROL = "Cache-Control"
  private final val NO_CACHE = "must-revalidate,no-cache,no-store"
  private final val ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"
  private final val ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials"
  private final val TRUE = "true"
  private final val ORIGIN = "Origin"

  protected override def doGet(req: HttpServletRequest, resp: HttpServletResponse) {
    resp.setStatus(HttpServletResponse.SC_OK)
    resp.setHeader(CACHE_CONTROL, NO_CACHE)
    resp.setHeader(ACCESS_CONTROL_ALLOW_CREDENTIALS, TRUE)
    resp.setHeader(ACCESS_CONTROL_ALLOW_ORIGIN, req.getHeader(ORIGIN))
    resp.setContentType(CONTENT_TYPE)

    val writer = resp.getWriter
    try {
      writer.println(CONTENT)
    }
    finally {
      writer.close()
    }
  }
}

Make CORS work with authentication

Make CORS work with authentication

Review: https://rb.mesosphe.re/r/658


import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.11"

crossScalaVersions := Seq("2.11.11")

version := "0.3.29"

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

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

import play.PlayImport.PlayKeys._

name := "lib-play"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.11"

crossScalaVersions := Seq("2.11.11")

version := "0.3.30"

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

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

autocommit: Update configuration to record version 0.3.30


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.3"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.3" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.7.1" cross CrossVersion.full),
      "com.github.ghik" %% "silencer-lib" % "1.7.1" % Provided cross CrossVersion.full,
    ),
    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")
  }
}

// silence all warnings on autogenerated files
flowGeneratedFiles ++= Seq(
  "src/main/scala/io/flow/generated/.*".r,
)

// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"

version := "0.2.63"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion := "2.13.3"

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.2.3" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.7.1" cross CrossVersion.full),
      "com.github.ghik" %% "silencer-lib" % "1.7.1" % Provided cross CrossVersion.full,
    ),
    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")
  }
}

// silence all warnings on autogenerated files
flowGeneratedFiles ++= Seq(
  "src/main/scala/io/flow/generated/.*".r,
)

// Make sure you only exclude warnings for the project directories, i.e. make builds reproducible
scalacOptions += s"-P:silencer:sourceRoots=${baseDirectory.value.getCanonicalPath}"

version := "0.2.64"

autocommit: Update configuration to record version 0.2.64


sbtPlugin := true

name := "xsbt-idea"

organization := "org.sbtidea"

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

sbtPlugin := true

organization := "com.github.mpeltonen"

name := "sbt-idea"

version := "0.10.0-SNAPSHOT"

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

publishTo := Some(Resolver.file("GitHub Pages", file("../mpeltonen.github.com/maven/")))

Set artifact coordinates and publishing config


import com.github.retronym.SbtOneJar._
import sbt.Credentials

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

version := "0.1.87"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "io.flow" %% "lib-util" % "0.1.0",
      "io.flow" %% "apibuilder-validation" % "0.2.1",
      "com.typesafe.play" %% "play-json" % "2.6.10",
      "com.ning" % "async-http-client" % "1.9.40",
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    )
  )

resolvers += "Artifactory" at "https://flow.jfrog.io/flow/libs-release/"

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

import com.github.retronym.SbtOneJar._
import sbt.Credentials

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

version := "0.1.88"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "io.flow" %% "lib-util" % "0.1.0",
      "io.flow" %% "apibuilder-validation" % "0.2.1",
      "com.typesafe.play" %% "play-json" % "2.6.10",
      "com.ning" % "async-http-client" % "1.9.40",
      "org.scalatest" %% "scalatest" % "3.0.5" % Test
    )
  )

resolvers += "Artifactory" at "https://flow.jfrog.io/flow/libs-release/"

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


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

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.7")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

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

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


addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.0")
addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.11.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.19")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.0")
addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "0.11.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.6")

Upgrade to latest sbt native packager.

Upgrade to latest sbt native packager.


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

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

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.2.4")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.11.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.7")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

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

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

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.2.4")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.9.9")
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.12.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-twirl" % "1.5.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.7")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

Update sbt-http4s-org to 0.12.0 in series/0.22