libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "1.0.0"
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.1.0")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0-M2")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.5.2")

val sbtSoftwareMillVersion = "1.9.7"
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion)
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion)

addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.1")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.2")

libraryDependencies += "org.scala-js" %% "scalajs-env-selenium" % "1.0.0"
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.1.1")
addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.1")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0-M2")
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.5.2")

val sbtSoftwareMillVersion = "1.9.7"
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-common" % sbtSoftwareMillVersion)
addSbtPlugin("com.softwaremill.sbt-softwaremill" % "sbt-softwaremill-publish" % sbtSoftwareMillVersion)

addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.4.1")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.2")

Update sbt-scalajs, scalajs-compiler to 1.1.1


addSbtPlugin("com.github.gseitz"  % "sbt-release"           % "1.0.13")
addSbtPlugin("com.jsuereth"       % "sbt-pgp"               % "2.0.1")
addSbtPlugin("org.scalameta"      % "sbt-scalafmt"          % "2.4.2")
addSbtPlugin("org.scoverage"      % "sbt-coveralls"         % "1.2.7")
addSbtPlugin("org.scoverage"      % "sbt-scoverage"         % "1.6.1")
addSbtPlugin("org.tpolecat"       % "tut-plugin"            % "0.6.13")

addSbtPlugin("com.github.gseitz"  % "sbt-release"           % "1.0.13")
addSbtPlugin("com.jsuereth"       % "sbt-pgp"               % "2.0.1")
addSbtPlugin("org.scalameta"      % "sbt-scalafmt"          % "2.4.2")
addSbtPlugin("net.ruippeixotog"   % "sbt-coveralls"         % "1.3.0")  // fork with scoverage/sbt-coveralls#128 merged in
addSbtPlugin("org.scoverage"      % "sbt-scoverage"         % "1.6.1")
addSbtPlugin("org.tpolecat"       % "tut-plugin"            % "0.6.13")

Update Coveralls to custom version supporting GitHub Actions


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

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

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

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

Downgrade Scala.js to 0.6.19 to fix Java 6


package controllers.change_of_address

import play.api.mvc._
import play.api.data._
import play.api.data.Forms._

import views._
import models.domain.{V5cSearchModel, AuthenticationModel}
import controllers.Mappings._

object Authentication extends Controller {

  def present = Action {
    Ok(html.change_of_address.authentication(authenticationForm))
  }

  def submit = Action { implicit request =>
    authenticationForm.bindFromRequest.fold(
      formWithErrors => BadRequest(html.change_of_address.authentication(formWithErrors)),
      ToAddress => Ok(views.html.change_of_address.v5c_search(v5cSearchForm))
    )
  }

  val authenticationForm = Form(
    mapping(
      "PIN" -> PIN(minLength = 6, maxLength = 6)
    )(AuthenticationModel.apply)(AuthenticationModel.unapply)
  )

  val v5cSearchForm = Form(
    mapping(
      "V5cReferenceNumber" -> V5cReferenceNumber(minLength = 11, maxLength = 11),
      "vehicleVRN" -> vehicleVRN(minLength = 2, maxLength = 8)
    )(V5cSearchModel.apply)(V5cSearchModel.unapply)
  )

}

package controllers.change_of_address

import play.api.mvc._
import play.api.data._
import play.api.data.Forms._

import views._
import models.domain.{V5cSearchModel, AuthenticationModel}
import controllers.Mappings._

object Authentication extends Controller {

  def present = Action {
    Ok(html.change_of_address.authentication(authenticationForm))
  }

  def submit = Action { implicit request =>
    authenticationForm.bindFromRequest.fold(
      formWithErrors => BadRequest(html.change_of_address.authentication(formWithErrors)),
      ToAddress => Redirect(routes.V5cSearch.present)
    )
  }

  val authenticationForm = Form(
    mapping(
      "PIN" -> PIN(minLength = 6, maxLength = 6)
    )(AuthenticationModel.apply)(AuthenticationModel.unapply)
  )

  val v5cSearchForm = Form(
    mapping(
      "V5cReferenceNumber" -> V5cReferenceNumber(minLength = 11, maxLength = 11),
      "vehicleVRN" -> vehicleVRN(minLength = 2, maxLength = 8)
    )(V5cSearchModel.apply)(V5cSearchModel.unapply)
  )

}

Fix broken test, should have been a redirect


package <%= package %>

import org.json4s.{DefaultFormats, Formats}
import org.scalatra.json._
import org.scalatra._

class <%= servletName %> extends ScalatraServlet with ScalatraBase with JacksonJsonSupport {

  protected implicit val jsonFormats: Formats = DefaultFormats

  case class Message(body: String)

  before() {
    contentType = formats("json")
  }

  get("/messages") {
    List(Message("Great job!"), Message("Scalatra project generated by Yeoman!"))
  }

}

package <%= package %>

import org.json4s.{DefaultFormats, Formats}
import org.scalatra.json._
import org.scalatra._

class <%= servletName %> extends ScalatraServlet with ScalatraBase with JacksonJsonSupport {

  protected implicit val jsonFormats: Formats = DefaultFormats

  case class Message(body: String)

  before() {
    contentType = formats("json")
  }

  get("/") {
  	contentType = "text/html"
  	"""

Check out RESTful API at http://localhost:8080/messages
  	"""
  }

  get("/messages") {
    List(Message("Great job!"), Message("Scalatra project generated by Yeoman!"))
  }

}

Add a small instruction to path /

Add a small instruction to path /


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

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

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.11")

// To sign the for Sonatype
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")

Add pgp to sign the release

Add pgp to sign the release


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

package io.rdbc.sapi

import scala.concurrent.Future

/** Provides access to a database [[Connection]].
  *
  * Implementors are encouraged to make the implementation of this trait thread-safe.
  */
trait ConnectionFactory {

  /** Returns a type converter registry that will be configured for connections produced by this factory */
  def typeConverterRegistry: TypeConverterRegistry

  /** Returns a future of a [[Connection]].
    *
    * Future can fail with subclasses of [[io.rdbc.api.exceptions.ConnectException]]. //TODO describe subclasses
    */
  def connection(): Future[Connection]
}

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

package io.rdbc.sapi

import scala.concurrent.Future

/** Provides access to a database [[Connection]].
  *
  * Implementors are encouraged to make the implementation of this trait thread-safe.
  */
trait ConnectionFactory {

  /** Returns a type converter registry that will be configured for connections produced by this factory */
  def typeConverterRegistry: TypeConverterRegistry

  /** Returns a future of a [[Connection]].
    *
    * Future can fail with subclasses of [[io.rdbc.api.exceptions.ConnectException]]. //TODO describe subclasses
    */
  def connection(): Future[Connection]

  /** Shuts down this connection factory.
    *
    * Returned future never fails - it completes on finished shutdown attempt.
    * After the factory is shut down it is illegal to request new connections from it.
    */
  def shutdown(): Future[Unit]
}

Add 'shutdown' method to connection factory


package org.phenoscape.kb

object MatrixRendererTest extends App {

  val innerMap: Map[Any, Boolean] = Map("y1" -> true, "y2" -> false, "y3" -> true)

  val outerMap: Map[Any, Map[Any, Boolean]] = Map("y1" -> innerMap, "y2" -> innerMap, "y3" -> innerMap)

  val outputString = Similarity.matrixRendererFromMapOfMaps(outerMap)

  println(outputString)

}

package org.phenoscape.kb

object MatrixRendererTest extends App {

  val innerMap: Map[Any, Boolean] = Map("y1" -> true, "y2" -> false, "y3" -> true)

  val outerMap: Map[Any, Map[Any, Boolean]] = Map("y1" -> innerMap, "y2" -> innerMap, "y3" -> innerMap)

  val outputString = AnatomicalEntity.matrixRendererFromMapOfMaps(DependencyMatrix(outerMap))

  println(outputString)

}

Fix the file path in test

Fix the file path in test


package me.shadaj.slinky.core

import me.shadaj.slinky.core.facade.{ComponentInstance, React}

import scala.language.implicitConversions
import scala.scalajs.js

class BuildingComponent[Props](e: ExternalComponent, props: Props, key: String, ref: js.Object => Unit, writer: Writer[Props]) {
  def apply(children: ComponentInstance*): ComponentInstance = {
    val written = writer.write(props)

    if (key != null) {
      written.asInstanceOf[js.Dynamic].updateDynamic("key")(key)
    }

    if (ref != null) {
      written.asInstanceOf[js.Dynamic].updateDynamic("ref")(ref: js.Function1[js.Object, Unit])
    }

    React.createElement(e.component, written, children: _*)
  }
}

object BuildingComponent {
  implicit def shortcut(bc: BuildingComponent[_]): ComponentInstance = {
    bc()
  }
}

trait ExternalComponent {
  type Props

  val component: js.Object

  def apply(p: Props, key: String = null, ref: js.Object => Unit = null)(implicit writer: Writer[Props]): BuildingComponent[Props] = {
    new BuildingComponent[Props](this, p, key, ref, writer)
  }
}

package me.shadaj.slinky.core

import me.shadaj.slinky.core.facade.{ComponentInstance, React}

import scala.language.implicitConversions
import scala.language.experimental.macros

import scala.reflect.macros.blackbox.Context
import scala.scalajs.js

class BuildingComponent[P](e: ExternalComponent, props: P, key: String, ref: js.Object => Unit) {
  def apply(children: ComponentInstance*)(implicit writer: Writer[P]): ComponentInstance = {
    val written = writer.write(props)

    if (key != null) {
      written.asInstanceOf[js.Dynamic].updateDynamic("key")(key)
    }

    if (ref != null) {
      written.asInstanceOf[js.Dynamic].updateDynamic("ref")(ref: js.Function1[js.Object, Unit])
    }

    React.createElement(e.component, written, children: _*)
  }
}

object BuildingComponent {
  implicit def make[P]: BuildingComponent[P] => ComponentInstance = macro BuildingComponentMacros.makeImpl[P]
}

object BuildingComponentMacros {
  // SUPER SKETCHY INTELLIJ HACK
  def makeImpl[P: c.WeakTypeTag](c: Context): c.Expr[BuildingComponent[P] => ComponentInstance] = {
    import c.universe._
    val propsType = implicitly[c.WeakTypeTag[P]].tpe
    c.Expr[BuildingComponent[P] => ComponentInstance](
      q"(bc: BuildingComponent[$propsType]) => bc.apply()(_root_.scala.Predef.implicitly[_root_.me.shadaj.slinky.core.Writer[$propsType]])"
    )
  }
}

abstract class ExternalComponent {
  type Props

  val component: js.Object

  def apply(p: Props, key: String = null, ref: js.Object => Unit = null): BuildingComponent[Props] = {
    new BuildingComponent(this, p, key, ref)
  }
}

Add macro hack to make no-children compile in IntelliJ and SBT


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

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

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


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

addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.5")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")
addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.2")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11")

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

addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.6")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")
addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.2")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.11.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11")

Update mdoc, sbt-mdoc to 2.3.6

Update mdoc, sbt-mdoc to 2.3.6


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.spark

import org.apache.spark.annotation.DeveloperApi
import org.apache.spark.sql.execution.SparkPlan

/**
 * Allows the execution of relational queries, including those expressed in SQL using Spark.
 *
 *  @groupname dataType Data types
 *  @groupdesc Spark SQL data types.
 *  @groupprio dataType -3
 *  @groupname field Field
 *  @groupprio field -2
 *  @groupname row Row
 *  @groupprio row -1
 */
package object sql {

  /**
   * Converts a logical plan into zero or more SparkPlans.
   */
  @DeveloperApi
  protected[sql] type Strategy = org.apache.spark.sql.catalyst.planning.GenericStrategy[SparkPlan]
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.spark

import org.apache.spark.annotation.DeveloperApi
import org.apache.spark.sql.execution.SparkPlan

/**
 * Allows the execution of relational queries, including those expressed in SQL using Spark.
 *
 *  @groupname dataType Data types
 *  @groupdesc Spark SQL data types.
 *  @groupprio dataType -3
 *  @groupname field Field
 *  @groupprio field -2
 *  @groupname row Row
 *  @groupprio row -1
 */
package object sql {

  /**
   * Converts a logical plan into zero or more SparkPlans.
   */
  @DeveloperApi
  protected[sql] type Strategy = org.apache.spark.sql.catalyst.planning.GenericStrategy[SparkPlan]

  /**
   * Type alias for [[DataFrame]]. Kept here for backward source compatibility for Scala.
   */
  @deprecated("1.3.0", "use DataFrame")
  type SchemaRDD = DataFrame
}

[SPARK-5551][SQL] Create type alias for SchemaRDD for source backward compatibility

Author: Reynold Xin <rxin@databricks.com>

Closes #4327 from rxin/schemarddTypeAlias and squashes the following commits:

e5a8ff3 [Reynold Xin] [SPARK-5551][SQL] Create type alias for SchemaRDD for source backward compatibility


package com.komanov.serialization.converters

import java.nio.ByteBuffer
import java.time.Instant

import boopickle.Default._
import com.komanov.serialization.domain._

/** https://github.com/ochrons/boopickle */
object BoopickleConverter extends SiteConverter {

  override def toByteArray(site: Site): Array[Byte] = {
    Pickle.intoBytes(site).array()
  }

  override def fromByteArray(bytes: Array[Byte]): Site = {
    Unpickle[Site].fromBytes(ByteBuffer.wrap(bytes))
  }

  implicit val instantPickler = transformPickler[Instant, Long](_.toEpochMilli, t => Instant.ofEpochMilli(t))

  implicit val pageComponentTypePickler = transformPickler[PageComponentType, String](_.name(), t => PageComponentType.valueOf(t))
  implicit val siteFlagPickler = transformPickler[SiteFlag, String](_.name(), t => SiteFlag.valueOf(t))
  implicit val siteTypePickler = transformPickler[SiteType, String](_.name(), t => SiteType.valueOf(t))

  implicit val entryPointPickler = compositePickler[EntryPoint]
    .addConcreteType[DomainEntryPoint]
    .addConcreteType[FreeEntryPoint]

  implicit val pageComponentDataPickler = compositePickler[PageComponentData]
    .addConcreteType[TextComponentData]
    .addConcreteType[ButtonComponentData]
    .addConcreteType[BlogComponentData]

}

package com.komanov.serialization.converters

import java.nio.ByteBuffer
import java.time.Instant
import java.util

import boopickle.Default._
import com.komanov.serialization.domain._

/** https://github.com/ochrons/boopickle */
object BoopickleConverter extends SiteConverter {

  override def toByteArray(site: Site): Array[Byte] = {
    val bb = Pickle.intoBytes(site)
    util.Arrays.copyOfRange(bb.array(), 0, bb.limit())
  }

  override def fromByteArray(bytes: Array[Byte]): Site = {
    Unpickle[Site].fromBytes(ByteBuffer.wrap(bytes))
  }

  implicit val instantPickler = transformPickler[Instant, Long](_.toEpochMilli, t => Instant.ofEpochMilli(t))

  implicit val pageComponentTypePickler = transformPickler[PageComponentType, String](_.name(), t => PageComponentType.valueOf(t))
  implicit val siteFlagPickler = transformPickler[SiteFlag, String](_.name(), t => SiteFlag.valueOf(t))
  implicit val siteTypePickler = transformPickler[SiteType, String](_.name(), t => SiteType.valueOf(t))

  implicit val entryPointPickler = compositePickler[EntryPoint]
    .addConcreteType[DomainEntryPoint]
    .addConcreteType[FreeEntryPoint]

  implicit val pageComponentDataPickler = compositePickler[PageComponentData]
    .addConcreteType[TextComponentData]
    .addConcreteType[ButtonComponentData]
    .addConcreteType[BlogComponentData]

}

Fix getting byte[] from ByteArray

Fix getting byte[] from ByteArray


package de.theunknownxy.jgui.layout

sealed trait Policy
case class Expanding()
case class Fixed(value: Float)
case class Ratio(value: Float)

package de.theunknownxy.jgui.layout

sealed trait Policy
case class Expanding(importance: Float)
case class Fixed(value: Float)

Remove the Ratio case class

Remove the Ratio case class


import sbt._, Keys._

object Dependencies {
  val servletApiDep = "jakarta.servlet" % "jakarta.servlet-api" % "5.0.0"

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.17.0"
  }

  def okHttp = "com.squareup.okhttp3" % "okhttp" % "4.10.0" :: Nil

  def integrationTestDeps = Def.setting((specs2Dep.value :: okHttp) map { _ % "test" })

  val commonsCodecVersion = "1.15"
  val scalaXmlVersion = "2.1.0"
  val commonsIoVersion = "2.11.0"
  val commonsFileUploadVersion = "1.4"
  val jettyVersion = "11.0.12"
  val nettyVersion = "4.1.84.Final"
  val scalatestVersion = "3.2.14"
  val scalatestScalacheckVersion = s"${scalatestVersion}.0"
  val json4sVersion = "4.0.6"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

import sbt._, Keys._

object Dependencies {
  val servletApiDep = "jakarta.servlet" % "jakarta.servlet-api" % "5.0.0"

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.17.0"
  }

  def okHttp = "com.squareup.okhttp3" % "okhttp" % "4.10.0" :: Nil

  def integrationTestDeps = Def.setting((specs2Dep.value :: okHttp) map { _ % "test" })

  val commonsCodecVersion = "1.15"
  val scalaXmlVersion = "2.1.0"
  val commonsIoVersion = "2.11.0"
  val commonsFileUploadVersion = "1.4"
  val jettyVersion = "11.0.12"
  val nettyVersion = "4.1.85.Final"
  val scalatestVersion = "3.2.14"
  val scalatestScalacheckVersion = s"${scalatestVersion}.0"
  val json4sVersion = "4.0.6"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

Update netty-codec-http, netty-handler, ... to 4.1.85.Final in main


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

package scala.tools.eclipse

import scala.tools.nsc.Global
import ch.epfl.lamp.fjbg.JType

trait JVMUtils { self : Global =>

  private lazy val codeGenerator =
    currentRun.phaseNamed(genJVM.phaseName).asInstanceOf[genJVM.JvmPhase].codeGenerator

  def javaName(sym : Symbol) : String = codeGenerator.javaName(sym)

  def javaNames(syms : List[Symbol]) : Array[String] = codeGenerator.javaNames(syms)

  def javaFlags(sym : Symbol) : Int = codeGenerator.javaFlags(sym)

  def javaType(t : Type) : JType = codeGenerator.javaType(t)

  def javaType(sym : Symbol) : JType = codeGenerator.javaType(sym)
}

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

package scala.tools.eclipse

import scala.tools.nsc.Global
import ch.epfl.lamp.fjbg.{ JMethodType, JObjectType, JType }

trait JVMUtils { self : Global =>

  private lazy val codeGenerator =
    currentRun.phaseNamed(genJVM.phaseName).asInstanceOf[genJVM.JvmPhase].codeGenerator

  def javaName(sym : Symbol) : String = codeGenerator.javaName(sym)

  def javaNames(syms : List[Symbol]) : Array[String] = codeGenerator.javaNames(syms)

  def javaFlags(sym : Symbol) : Int = codeGenerator.javaFlags(sym)

  def javaType(t: Type): JType = t match {
    case ErrorType => JType.UNKNOWN

    case m : MethodType =>
      val t = m.finalResultType
      new JMethodType(javaType(t), m.paramss.flatMap(_.map(javaType)).toArray)

    case p : PolyType =>
      val t = p.finalResultType
      javaType(t)

    case r : RefinedType =>
      JObjectType.JAVA_LANG_OBJECT
      //javaType(r.typeSymbol.tpe)

    case _ => codeGenerator.javaType(t)
  }

  def javaType(s: Symbol): JType =
    if (s.isMethod)
      new JMethodType(
        if (s.isClassConstructor) JType.VOID else javaType(s.tpe.resultType),
        s.tpe.paramTypes.map(javaType).toArray)
    else
      javaType(s.tpe)
}

Handle a few additional cases.

Handle a few additional cases.

git-svn-id: d518d5b67c3faf3e6f0db4ab9fe5fb399964ea1a@19511 5e8d7ff9-d8ef-0310-90f0-a4852d11357a


package eu.shiftforward.icfpc2015

import eu.shiftforward.icfpc2015.model.Input._
import eu.shiftforward.icfpc2015.model._
import eu.shiftforward.icfpc2015.solver.{ SmartSolver, Solver }
import spray.json._

import scala.io.Source

object SolverDebugger extends App {
  val solver: Solver = new SmartSolver

  val solutionTag: Option[String] = None

  val input = Source.fromFile(args(0)).mkString.parseJson.convertTo[Input]

  input.sourceSeeds.map { seed =>
    val units = input.orderedUnitsBySeed(seed)
    val grid = Grid(input.width, input.height).filled(input.filled: _*)
    val solution = solver.play(GameState(grid, units)).toList

    println(s"Solution with seed $seed: ${solution.map(_.ch).mkString}")

    Output(input.id, seed, solutionTag, solver.play(GameState(grid, units)).toList)
  }
}

package eu.shiftforward.icfpc2015

import eu.shiftforward.icfpc2015.model.Input._
import eu.shiftforward.icfpc2015.model._
import eu.shiftforward.icfpc2015.solver.{ SmartSolver, Solver }
import spray.json._

import scala.io.Source

object SolverDebugger extends App {
  val solver: Solver = new SmartSolver

  val solutionTag: Option[String] = None

  val input = Source.fromFile(args(0)).mkString.parseJson.convertTo[Input]

  val startTime = System.currentTimeMillis()

  input.sourceSeeds.map { seed =>
    val units = input.orderedUnitsBySeed(seed)
    val grid = Grid(input.width, input.height).filled(input.filled: _*)
    val solution = solver.play(GameState(grid, units)).toList

    println(s"Solution with seed $seed: ${solution.map(_.ch).mkString}")

    Output(input.id, seed, solutionTag, solver.play(GameState(grid, units)).toList)
  }

  val endTime = System.currentTimeMillis()

  println("Results obtained in " + (endTime - startTime) + " ms")

}

Add time benchmarks to the solver debugger


package com.rasterfoundry.common.utils

import com.typesafe.scalalogging.LazyLogging
import geotrellis.proj4._
import geotrellis.raster._
import geotrellis.raster.geotiff.GeoTiffRasterSource
import geotrellis.vector.Projected
import geotrellis.vector._

object CogUtils extends LazyLogging {

  def getTiffExtent(uri: String): Projected[MultiPolygon] = {
    val rasterSource = GeoTiffRasterSource(uri)
    Projected(
      MultiPolygon(
        rasterSource.extent
          .reproject(rasterSource.crs, WebMercator)
          .toPolygon()),
      3857
    )
  }

  def histogramFromUri(
      uri: String,
      buckets: Int = 80
  ): Option[Array[Histogram[Double]]] = {
    // Get the smallest overview and calculate histogram from that
    val rasterSource = GeoTiffRasterSource(uri)
    val bandCount = rasterSource.bandCount
    logger.debug(s"Base cell size is: ${rasterSource.cellSize}")
    // This is to workaround https://github.com/locationtech/geotrellis/issues/3269
    // where not all overviews are actually overviews
    val lastOverview =
      rasterSource.tiff.overviews.filter(_.bandCount == bandCount).last
    Some(lastOverview.tile.bands.map(_.histogramDouble(buckets)).toArray)
  }
}

package com.rasterfoundry.common.utils

import com.typesafe.scalalogging.LazyLogging
import geotrellis.proj4._
import geotrellis.raster._
import geotrellis.raster.geotiff.GeoTiffRasterSource
import geotrellis.vector.Projected
import geotrellis.vector._

object CogUtils extends LazyLogging {

  def getTiffExtent(uri: String): Projected[MultiPolygon] = {
    val rasterSource = GeoTiffRasterSource(uri)
    Projected(
      MultiPolygon(
        rasterSource.extent
          .reproject(rasterSource.crs, WebMercator)
          .toPolygon()),
      3857
    )
  }

  def histogramFromUri(
      uri: String,
      buckets: Int = 80
  ): Option[Array[Histogram[Double]]] = {
    // Get the smallest overview and calculate histogram from that
    val rasterSource = GeoTiffRasterSource(uri)
    val bandCount = rasterSource.bandCount
    logger.debug(s"Base cell size is: ${rasterSource.cellSize}")
    // This is to workaround https://github.com/locationtech/geotrellis/issues/3269
    // where not all overviews are actually overviews
    val lastOverview =
      rasterSource.tiff.overviews.filter(_.bandCount == bandCount).lastOption
    lastOverview.map(_.tile.bands.map(_.histogramDouble(buckets)).toArray)
  }
}

Use safe lastOption instead of last

Use safe lastOption instead of last


import sbt.Keys._
import sbt._

/**
 * This plugins adds Akka snapshot repositories when running a nightly build.
 */
object AkkaSnapshotRepositories extends AutoPlugin {

  override def trigger: PluginTrigger = allRequirements

  override def projectSettings: Seq[Def.Setting[_]] = {
    // If this is a cron job in Travis:
    // https://docs.travis-ci.com/user/cron-jobs/#detecting-builds-triggered-by-cron
    resolvers ++= (sys.env.get("TRAVIS_EVENT_TYPE").filter(_.equalsIgnoreCase("cron")) match {
      case Some(_) =>
        Seq(
          "akka-snapshot-repository".at("https://repo.akka.io/snapshots"),
          "akka-http-snapshot-repository".at("https://dl.bintray.com/akka/maven/")
        )
      case None => Seq.empty
    })
  }
}

import sbt.Keys._
import sbt._

/**
 * This plugins adds Akka snapshot repositories when running a nightly build.
 */
object AkkaSnapshotRepositories extends AutoPlugin {

  override def trigger: PluginTrigger = allRequirements

  override def projectSettings: Seq[Def.Setting[_]] = {
    // If this is a cron job in Travis:
    // https://docs.travis-ci.com/user/cron-jobs/#detecting-builds-triggered-by-cron
    resolvers ++= (sys.env.get("TRAVIS_EVENT_TYPE").filter(_.equalsIgnoreCase("cron")) match {
      case Some(_) =>
        Seq(
          "akka-snapshot-repository".at("https://repo.akka.io/snapshots"),
          "akka-http-snapshot-repository".at("https://dl.bintray.com/akka/snapshots/")
        )
      case None => Seq.empty
    })
  }
}

Fix the akka-http snapshots repo

Fix the akka-http snapshots repo

(cherry picked from commit e67a050301f84c5841b5a383684aa84b3fb87d95)


package se.gigurra.dcs.remote.util

import java.nio.file.{Files, Paths, StandardOpenOption}
import java.util.concurrent.atomic.AtomicLong
import com.twitter.finagle.util.DefaultTimer
import com.twitter.io.Charsets
import com.twitter.util.Duration
import scala.util.Try
import scala.collection.JavaConversions._

case class DataUseLogger(outputFilePath: String, dtFlush: Duration, enabled: Boolean) {

  private val atomicDelta = new AtomicLong(0L)
  private val path = Paths.get(outputFilePath)

  if (enabled) {
    DefaultTimer.twitter.schedule(dtFlush) {
      val delta = atomicDelta.getAndSet(0)
      val prevBytes = Try(Files.readAllLines(path, Charsets.Utf8).head.toLong).getOrElse(0L)
      val newVal = (prevBytes + delta).toString.getBytes(Charsets.Utf8)
      Files.write(path, newVal, StandardOpenOption.WRITE, StandardOpenOption.CREATE)
    }
  }

  def log(nBytes: Long): Unit = {
    atomicDelta.addAndGet(nBytes)
  }

}

package se.gigurra.dcs.remote.util

import java.nio.file.{Files, Paths, StandardOpenOption}
import java.util.concurrent.atomic.AtomicLong
import com.twitter.finagle.util.DefaultTimer
import com.twitter.io.Charsets
import com.twitter.util.Duration
import scala.util.Try
import scala.collection.JavaConversions._

case class DataUseLogger(outputFilePath: String, dtFlush: Duration, enabled: Boolean) {

  private val atomicDelta = new AtomicLong(0L)
  private val path = Paths.get(outputFilePath)

  if (enabled) {
    DefaultTimer.twitter.schedule(dtFlush) {
      val delta = atomicDelta.getAndSet(0)
      val prevBytes = Try(Files.readAllLines(path, Charsets.Utf8).head.toLong).getOrElse(0L)
      val newVal = ((prevBytes + delta).toString + "\n").getBytes(Charsets.Utf8)
      Files.write(path, newVal, StandardOpenOption.WRITE, StandardOpenOption.CREATE)
    }
  }

  def log(nBytes: Long): Unit = {
    atomicDelta.addAndGet(nBytes)
  }

}

Add newlines to traffic log files

Add newlines to traffic log files


package com.twitter.scalding.examples

import com.twitter.scalding._

class WordCountJob(args: Args) extends Job(args) {
  TextLine(args("input")).read.
    flatMap('line -> 'word) { line: String => line.split("\\s+") }.
    groupBy('word) { _.size }.
    write(Tsv(args("output")))
}

package com.twitter.scalding.examples

import com.twitter.scalding._

class WordCountJob(args: Args) extends Job(args) {
  TypedPipe.from(TextLine(args("input")))
    .flatMap { line: String => line.split("\\s+") }
    .map (_ -> 1L)
    .sumByKey
    .write(TypedTsv[(String, Long)](args("output")))
}

Move main simple example to be the typed API, and put the .'s at the start of lines like we usually do


package com.sageserpent.americium

import scala.collection.immutable.List

trait SeqEnrichment {
  implicit class RichSeq[Item](items: Seq[Item]) {
    def groupWhile(predicate: (Item, Item) => Boolean) = {
      if (items.isEmpty)
        Seq.empty[Seq[Item]]
      else {
        val Seq(head, tail @ _ *) = items
        val reversedGroupsInReverse =
          tail.foldLeft(List(List(head)))((groups, item) => {
            assert(groups.nonEmpty)
            groups match {
              case (headGroup @ (itemToMatch :: _)) :: tailGroups
                  if predicate(itemToMatch, item) =>
                (item :: headGroup) :: tailGroups
              case _ => List(item) :: groups
            }
          })
        reversedGroupsInReverse map (_.reverse) reverse
      }
    }
  }
}

package com.sageserpent.americium

import scala.collection.generic.CanBuildFrom
import scala.collection.immutable.List

trait SeqEnrichment {
  implicit class RichSeq[Container[Element] <: Seq[Element] forSome {
    type Element
  }, Item](items: Seq[Item]) {
    def groupWhile(predicate: (Item, Item) => Boolean)(
        implicit cbf: CanBuildFrom[List[Item], Item, Container[Item]])
      : Seq[Container[Item]] = {
      if (items.isEmpty)
        Seq.empty[Container[Item]]
      else {
        val Seq(head, tail @ _ *) = items
        val reversedGroupsInReverse =
          tail.foldLeft(List(List(head)))((groups, item) => {
            assert(groups.nonEmpty)
            groups match {
              case (headGroup @ (itemToMatch :: _)) :: tailGroups
                  if predicate(itemToMatch, item) =>
                (item :: headGroup) :: tailGroups
              case _ => List(item) :: groups
            }
          })
        reversedGroupsInReverse map (_.reverse) map { items =>
          val builder = cbf()
          items.foreach(builder += _)
          builder.result
        } reverse
      }
    }
  }
}

Use a builder to preserve the original collection type in the result of 'groupBy'.


package com.twitter.finagle.kestrel

import _root_.java.net.SocketAddress
import org.jboss.netty.buffer.ChannelBuffer
import com.twitter.finagle.builder.{Server => BuiltServer, ServerBuilder}
import protocol.Kestrel
import _root_.java.util.concurrent.{BlockingDeque, LinkedBlockingDeque}
import com.twitter.util.MapMaker

class Server(address: SocketAddress) {
  private[this] val serviceFactory = {
    val queues = MapMaker[ChannelBuffer, BlockingDeque[ChannelBuffer]] { config =>
      config.compute { key =>
        new LinkedBlockingDeque[ChannelBuffer]
      }
    }

    () => {
      new InterpreterService(new Interpreter(queues))
    }
  }

  private[this] val serverSpec =
    ServerBuilder()
      .name("schmestrel")
      .codec(Kestrel())
      .bindTo(address)

  private[this] var server: Option[BuiltServer] = None

  def start() {
    server = Some(serverSpec.build(serviceFactory))
  }

  def stop() {
    require(server.isDefined, "Server is not open!")

    server.foreach { server =>
      server.close()
      this.server = None
    }
  }
}

package com.twitter.finagle.kestrel

import _root_.java.net.SocketAddress
import org.jboss.netty.buffer.ChannelBuffer
import com.twitter.finagle.builder.{Server => BuiltServer, ServerBuilder}
import protocol.{Kestrel, Command, Response}
import _root_.java.util.concurrent.{BlockingDeque, LinkedBlockingDeque}
import com.twitter.util.{Future, MapMaker}
import com.twitter.finagle.{ServiceFactory, ClientConnection}

class Server(address: SocketAddress) {
  private[this] val serviceFactory = new ServiceFactory[Command, Response] {
    private[this] val queues = MapMaker[ChannelBuffer, BlockingDeque[ChannelBuffer]] { config =>
      config.compute { key =>
        new LinkedBlockingDeque[ChannelBuffer]
      }
    }

    def apply(conn: ClientConnection) = Future.value(new InterpreterService(new Interpreter(queues)))
    def close() = ()
  }

  private[this] val serverSpec =
    ServerBuilder()
      .name("schmestrel")
      .codec(Kestrel())
      .bindTo(address)

  private[this] var server: Option[BuiltServer] = None

  def start() {
    server = Some(serverSpec.build(serviceFactory))
  }

  def stop() {
    require(server.isDefined, "Server is not open!")

    server.foreach { server =>
      server.close()
      this.server = None
    }
  }
}

[split] Clean up kestrel server for new factory interface.


package modules.jwt.guice.modules

import modules.jwt.decoder.{JwtDecoder, JwtDecoderImpl}
import modules.jwt.encoder.{JwtEncoder, JwtEncoderImpl}
import modules.jwt.validator.{JwtValidator, JwtValidatorImpl}
import net.codingwell.scalaguice.ScalaModule

class JwtModule extends ScalaModule {

  override def configure() {
    bind[JwtEncoder].to[JwtEncoderImpl]
    bind[JwtDecoder].to[JwtDecoderImpl]
    bind[JwtValidator].to[JwtValidatorImpl]
  }
}

package modules.jwt.guice.modules

import com.google.inject.Provides
import com.typesafe.config.Config
import javax.inject.Named
import modules.jwt.decoder.{JwtDecoder, JwtDecoderImpl}
import modules.jwt.encoder.{JwtEncoder, JwtEncoderImpl}
import modules.jwt.validator.{JwtValidator, JwtValidatorImpl}
import net.codingwell.scalaguice.ScalaModule
import pdi.jwt.JwtAlgorithm

class JwtModule extends ScalaModule {

  override def configure() {
    bind[JwtEncoder].to[JwtEncoderImpl]
    bind[JwtDecoder].to[JwtDecoderImpl]
    bind[JwtValidator].to[JwtValidatorImpl]
  }

  @Provides
  def algorithm: JwtAlgorithm = {
    JwtAlgorithm.HS512
  }

  @Provides
  @Named("jwt.secretKey")
  def secretKey(config: Config): String = {
    config.getString("jwt.secretKey")
  }
}

Add injecting JWT secret key and algorithm


package play.core.server.servlet25

import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
import play.core.server.servlet.Play2GenericServletRequestHandler
import play.core.server.servlet.RichHttpServletRequest
import play.core.server.servlet.RichHttpServletResponse
import java.util.concurrent.{TimeoutException, ArrayBlockingQueue, TimeUnit}

class Play2Servlet25RequestHandler(servletRequest: HttpServletRequest, servletResponse: HttpServletResponse)
  extends Play2GenericServletRequestHandler(servletRequest, Option(servletResponse))
  with Helpers {

  val queue = new ArrayBlockingQueue[Boolean](1)

  protected override def onFinishService() = {
    val hasBeenComplete = queue.poll(Play2Servlet.syncTimeout, TimeUnit.MILLISECONDS)

    if (hasBeenComplete == null) {
      throw new TimeoutException("This request was timed out after " + Play2Servlet.syncTimeout + " ms")
    }
  }

  protected override def onHttpResponseComplete() = {
    queue.put(Boolean.TRUE)
  }

  protected override def getHttpRequest(): RichHttpServletRequest = {
    new RichHttpServletRequest {
      def getRichInputStream(): Option[java.io.InputStream] = {
        Option(servletRequest.getInputStream)
      }
    }
  }

  protected override def getHttpResponse(): RichHttpServletResponse = {
    new RichHttpServletResponse {
      def getRichOutputStream: Option[java.io.OutputStream] = {
        Option(servletResponse.getOutputStream)
      }

      def getHttpServletResponse: Option[HttpServletResponse] = {
        Option(servletResponse)
      }
    }
  }

}

package play.core.server.servlet25

import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
import play.core.server.servlet.Play2GenericServletRequestHandler
import play.core.server.servlet.RichHttpServletRequest
import play.core.server.servlet.RichHttpServletResponse
import java.util.concurrent.{TimeoutException, ArrayBlockingQueue, TimeUnit}

class Play2Servlet25RequestHandler(servletRequest: HttpServletRequest, servletResponse: HttpServletResponse)
  extends Play2GenericServletRequestHandler(servletRequest, Option(servletResponse))
  with Helpers {

  val queue = new ArrayBlockingQueue[Boolean](1)

  protected override def onFinishService() = {
    val hasBeenComplete = queue.poll(Play2Servlet.syncTimeout, TimeUnit.MILLISECONDS)

    // Scala magic: will get 'false' even if queue returns null in Java
    if (!hasBeenComplete) {
      throw new TimeoutException("This request was timed out after " + Play2Servlet.syncTimeout + " ms")
    }
  }

  protected override def onHttpResponseComplete() = {
    queue.put(true)
  }

  protected override def getHttpRequest(): RichHttpServletRequest = {
    new RichHttpServletRequest {
      def getRichInputStream(): Option[java.io.InputStream] = {
        Option(servletRequest.getInputStream)
      }
    }
  }

  protected override def getHttpResponse(): RichHttpServletResponse = {
    new RichHttpServletResponse {
      def getRichOutputStream: Option[java.io.OutputStream] = {
        Option(servletResponse.getOutputStream)
      }

      def getHttpServletResponse: Option[HttpServletResponse] = {
        Option(servletResponse)
      }
    }
  }

}

Fix compilation failure with Boolean.TRUE


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.0"),
      "com.github.ghik" %% "silencer-lib" % "1.3.0" % Provided,
    ),
    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
scalacOptions += "-P:silencer:pathFilters=src/main/scala/io/flow/generated/.*"

// 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.22"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "3.0.5" % Test,
      compilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.0"),
      "com.github.ghik" %% "silencer-lib" % "1.3.0" % Provided,
    ),
    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
scalacOptions += "-P:silencer:pathFilters=src/main/scala/io/flow/generated/.*"

// 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.23"

autocommit: Update configuration to record version 0.2.23


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

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

version := "0.2.0"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "io.flow" %% "lib-util" % "0.1.0",
      "io.flow" %% "apibuilder-validation" % "0.2.4",
      "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.2.1"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "io.flow" %% "lib-util" % "0.1.0",
      "io.flow" %% "apibuilder-validation" % "0.2.4",
      "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.2.1


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.3"

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

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

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

version := "0.1.37"

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.3"

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

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

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

version := "0.1.38"

autocommit: Update configuration to record version 0.1.38


name := "funalgebra"

scalaVersion := "2.10.3"

val scalazVersion = "7.0.5"

libraryDependencies ++= Seq(
  "org.scalaz" %% "scalaz-core" % scalazVersion,
  "org.scalaz" %% "scalaz-effect" % scalazVersion,
  "org.scalaz" %% "scalaz-concurrent" % scalazVersion,
  "org.scalaz" %% "scalaz-typelevel" % scalazVersion,
  "org.scalaz" %% "scalaz-xml" % scalazVersion,
  "org.scalaz" %% "scalaz-scalacheck-binding" % scalazVersion % "test"
)

scalacOptions += "-feature"

initialCommands in console := "import scalaz._, Scalaz._"

name := "funalgebra"

scalaVersion := "2.10.3"

val scalazVersion = "7.0.5"

libraryDependencies ++= Seq(
  "org.scalaz" %% "scalaz-core" % scalazVersion,
  "org.scalaz" %% "scalaz-effect" % scalazVersion,
  "org.scalaz" %% "scalaz-concurrent" % scalazVersion,
  "org.scalaz" %% "scalaz-typelevel" % scalazVersion,
  "org.scalaz" %% "scalaz-xml" % scalazVersion,
  "io.argonaut" %% "argonaut" % "6.0.1",
  "org.scalaz" %% "scalaz-scalacheck-binding" % scalazVersion % "test"
)

scalacOptions += "-feature"

scalacOptions += "-unchecked"

initialCommands in console := "import scalaz._, Scalaz._"

Add argonaut dependency to project

Add argonaut dependency to project


name := """keepit"""

version := "1.0-SNAPSHOT"

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

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
//  javaJdbc,
//  javaEbean,
  cache,
  javaWs
)

name := """keepit"""

version := "1.0-SNAPSHOT"

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

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
//  javaJdbc,
//  javaEbean,
  cache,
  javaWs,
  "org.webjars" % "bootstrap" % "3.2.0"
)

Add the dependency for using bootstrap.

Add the dependency for using bootstrap.


package jp.co.bizreach.elasticsearch4s

import org.scalatest._
import com.fasterxml.jackson.annotation.JsonIgnoreProperties

class JsonUtilsSpec extends FunSuite {

  test("deserialize normally"){
    val sample1 = JsonUtils.deserialize[Sample]("""{"name": "Naoki Takezoe"}""")
    assert(sample1.name === "Naoki Takezoe")

    val sample2 = JsonUtils.deserialize[Sample]("""{"name": "Naoki Takezoe", "age": 35}""")
    assert(sample2.name === "Naoki Takezoe")
  }

  test("deserialize single value array"){
    val sample1 = JsonUtils.deserialize[Sample]("""{"name": ["Naoki Takezoe"]}""")
    assert(sample1.name === "Naoki Takezoe")

    val sample2 = JsonUtils.deserialize[Sample2]("""{"name": ["Naoki Takezoe"]}""")
    assert(sample2.name === Array("Naoki Takezoe"))
  }

}

case class Sample(name: String)

case class Sample2(name: Array[String])

package jp.co.bizreach.elasticsearch4s

import org.joda.time.DateTime
import org.scalatest._
import com.fasterxml.jackson.annotation.JsonIgnoreProperties

class JsonUtilsSpec extends FunSuite {

  test("deserialize normally"){
    val sample1 = JsonUtils.deserialize[SimpleSample]("""{"name": "Naoki Takezoe"}""")
    assert(sample1.name === "Naoki Takezoe")

    // ignore unknown property
    val sample2 = JsonUtils.deserialize[SimpleSample]("""{"name": "Naoki Takezoe", "age": 35}""")
    assert(sample2.name === "Naoki Takezoe")
  }

  test("deserialize single value array"){
    // array to single property
    val sample1 = JsonUtils.deserialize[ArraySample]("""{"name": ["Naoki Takezoe"]}""")
    assert(sample1.name === "Naoki Takezoe")

    // array to array property
    val sample2 = JsonUtils.deserialize[ArraySample]("""{"name": ["Naoki Takezoe"]}""")
    assert(sample2.name === Array("Naoki Takezoe"))
  }

  test("deserialize date property"){
    // array to single property
    val sample1 = JsonUtils.deserialize[DateSample]("""{"date": "2015-02-25T21:10:12.456Z"}""")
    assert(sample1.date.toString() === "2015-02-25T21:10:12.456Z")

    // array to array property
    val sample2 = JsonUtils.deserialize[DateArraySample]("""{"date": "2015-02-25T21:10:12.456Z", "age": 35}""")
    assert(sample2.date.map(_.toString()) === Array("2015-02-25T21:10:12.456Z"))
  }
}

case class SimpleSample(name: String)

case class ArraySample(name: Array[String])

case class DateSample(date: DateTime)

case class DateArraySample(date: Array[DateTime])

Add testcase for DateTime conversion

Add testcase for DateTime conversion


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

resolvers += "iBiblio Maven" at "http://mirrors.ibiblio.org/maven2/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % System.getProperty("play.version", "2.4.1"))

addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")

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

resolvers += "iBiblio Maven" at "http://mirrors.ibiblio.org/maven2/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % System.getProperty("play.version", "2.4.6"))

addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")

Update play version to 2.4.6

Update play version to 2.4.6


addSbtPlugin("com.lightbend.paradox"     % "sbt-paradox"             % "0.9.2")
addSbtPlugin("com.typesafe.sbt"          % "sbt-site"                % "1.4.1")
addSbtPlugin("com.typesafe.sbt"          % "sbt-ghpages"             % "0.6.3")
addSbtPlugin("org.typelevel"             % "sbt-typelevel-ci-release" % "0.4.3")
addSbtPlugin("org.scoverage"             % "sbt-scoverage"           % "1.9.3")
addSbtPlugin("com.timushev.sbt"          % "sbt-updates"             % "0.6.1")
addSbtPlugin("pl.project13.scala"        % "sbt-jmh"                 % "0.4.3")
addSbtPlugin("de.heikoseeberger"         % "sbt-header"              % "5.6.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat"            % "0.1.20")
addSbtPlugin("org.scalameta"             % "sbt-mdoc"                % "2.2.24")

addSbtPlugin("com.lightbend.paradox"     % "sbt-paradox"             % "0.9.2")
addSbtPlugin("com.typesafe.sbt"          % "sbt-site"                % "1.4.1")
addSbtPlugin("com.typesafe.sbt"          % "sbt-ghpages"             % "0.6.3")
addSbtPlugin("org.typelevel"             % "sbt-typelevel-ci-release" % "0.4.3")
addSbtPlugin("org.scoverage"             % "sbt-scoverage"           % "1.9.3")
addSbtPlugin("com.timushev.sbt"          % "sbt-updates"             % "0.6.1")
addSbtPlugin("pl.project13.scala"        % "sbt-jmh"                 % "0.4.3")
addSbtPlugin("de.heikoseeberger"         % "sbt-header"              % "5.6.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat"            % "0.1.20")
addSbtPlugin("org.scalameta"             % "sbt-mdoc"                % "2.3.0")

Update mdoc, sbt-mdoc to 2.3.0

Update mdoc, sbt-mdoc to 2.3.0


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

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

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

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

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

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

Update sbt-idea-plugin to version 3.18.0

- This version removes the unused JVM argument for optimizing searching for indexable files in tests.
- The plugin is now compiled with the latest Scala 2.12.


package ciris.readers

import ciris.PropertySpec
import ciris.generators.DurationGenerators

import scala.concurrent.duration.{Duration, FiniteDuration}

final class DurationConfigReadersSpec extends PropertySpec with DurationGenerators {
  "DurationConfigReaders" when {
    "reading a Duration" should {
      "successfully read Duration values" in {
        forAll { duration: Duration ⇒
          val durationString =
            if (duration.toString startsWith "Duration.")
              duration.toString.drop(9)
            else duration.toString

          readValue[Duration](durationString) shouldBe Right(duration)
        }
      }

      "return a failure for other values" in {
        forAll { string: String ⇒
          whenever(fails(Duration(string))) {
            readValue[Duration](string) shouldBe a[Left[_, _]]
          }
        }
      }
    }

    "reading a FiniteDuration" should {
      "successfully read FiniteDuration values" in {
        forAll { finiteDuration: FiniteDuration ⇒
          readValue[FiniteDuration](finiteDuration.toString) shouldBe Right(finiteDuration)
        }
      }

      "return a failure for other values" in {
        forAll { string: String ⇒
          whenever(fails(Duration(string)) || !Duration(string).isFinite()) {
            readValue[FiniteDuration](string) shouldBe a[Left[_, _]]
          }
        }
      }
    }
  }
}

package ciris.readers

import ciris.PropertySpec
import ciris.generators.DurationGenerators

import scala.concurrent.duration.{Duration, FiniteDuration}

final class DurationConfigReadersSpec extends PropertySpec with DurationGenerators {
  "DurationConfigReaders" when {
    "reading a Duration" should {
      "successfully read Duration values" in {
        forAll { duration: Duration ⇒
          val durationString =
            if (duration.toString startsWith "Duration.")
              duration.toString.drop(9)
            else duration.toString

          val value = readValue[Duration](durationString)
          if (duration.isFinite)
            value.right.map(_.toNanos) shouldBe Right(duration.toNanos)
          else
            value shouldBe Right(duration)
        }
      }

      "return a failure for other values" in {
        forAll { string: String ⇒
          whenever(fails(Duration(string))) {
            readValue[Duration](string) shouldBe a[Left[_, _]]
          }
        }
      }
    }

    "reading a FiniteDuration" should {
      "successfully read FiniteDuration values" in {
        forAll { finiteDuration: FiniteDuration ⇒
          val value = readValue[FiniteDuration](finiteDuration.toString)
          value.right.map(_.toNanos) shouldBe Right(finiteDuration.toNanos)
        }
      }

      "return a failure for other values" in {
        forAll { string: String ⇒
          whenever(fails(Duration(string)) || !Duration(string).isFinite()) {
            readValue[FiniteDuration](string) shouldBe a[Left[_, _]]
          }
        }
      }
    }
  }
}

Improve reliance of Duration tests

Improve reliance of Duration tests


package ingraph.tests

import org.scalatest.FunSuite

class BiValidationTest extends FunSuite {

  //val testCases: Seq[LdbcSnbTestCase] = Seq(2, 3, 4, 6, 7, 8, 9, 12, 15, 17, 23, 24) map (new LdbcSnbTestCase("bi", _))
  val testCases: Seq[LdbcSnbTestCase] = Seq(2, 4, 6, 7, 8, 9, 12) map (new LdbcSnbTestCase("bi", _))

  testCases.foreach {
    tc =>
      test(s"${tc.name}") {
        val neo4jResults   = TestRunners.neo4jTestRunner(tc)
        val ingraphResults = TestRunners.ingraphTestRunner(tc)

        println("neo4j results:   " + neo4jResults  .map(x => x.toSeq.sortBy(_._1)))
        println("ingraph results: " + ingraphResults.map(x => x.toSeq.sortBy(_._1)))

//        println(tc.parameters.mkString("Parameters: (\n\t", "\n\t", "\n)"))
//        println(neo4jResult.mkString("Results: (\n\t", "\n\t", "\n)"))
        assert(neo4jResults == ingraphResults)
      }
  }

}

package ingraph.tests

import org.scalatest.FunSuite

class BiValidationTest extends FunSuite {

  //val testCases: Seq[LdbcSnbTestCase] = Seq(2, 3, 4, 6, 7, 8, 9, 12, 15, 17, 23, 24) map (new LdbcSnbTestCase("bi", _))
  val testCases: Seq[LdbcSnbTestCase] = Seq(2, 4, 6, 7, 8, 9, 12) map (new LdbcSnbTestCase("bi", _))

  testCases.foreach {
    tc =>
      test(s"${tc.name}") {
        val neo4jResults   = TestRunners.neo4jTestRunner(tc)
        val ingraphResults = TestRunners.ingraphTestRunner(tc)

        println("neo4j results:   " + neo4jResults  .map(x => x.toSeq.sortBy(_._1)))
        println("ingraph results: " + ingraphResults.map(x => x.toSeq.sortBy(_._1)))

//        println(tc.parameters.mkString("Parameters: (\n\t", "\n\t", "\n)"))
//        println(neo4jResult.mkString("Results: (\n\t", "\n\t", "\n)"))
        assert(ingraphResults == neo4jResults)
      }
  }

}

Swap results to get proper actual vs. expected order


package reaktor.scct

import org.specs.mock.Mockito
import org.specs.Specification

class EnvSpec extends Specification with Mockito {
  "Env" should {
    "provide Option[String]'s" in {
      val propName = "scct.test."+System.currentTimeMillis
      try {
        Env.sysOption(propName) mustEqual None
        System.setProperty(propName, "1")
        Env.sysOption(propName) mustEqual Some("1")
      } finally {
        System.setProperty(propName, null)
      }
    }
  }
}

package reaktor.scct

import org.specs.mock.Mockito
import org.specs.Specification

class EnvSpec extends Specification with Mockito {
  "Env" should {
    "provide Option[String]'s" in {
      val propName = "scct.test."+System.currentTimeMillis
      try {
        Env.sysOption(propName) mustEqual None
        System.setProperty(propName, "1")
        Env.sysOption(propName) mustEqual Some("1")
      } finally {
        System.clearProperty(propName)
      }
    }
  }
}

Fix systemproperty clearing in test.

Fix systemproperty clearing in test.


package com.twitter.util

/**
 * A stopwatch may be used to measure elapsed time.
 */
trait Stopwatch {
  type Elapsed = () => Duration

  /**
   * Start the stopwatch. The returned timer may be read any time,
   * returning the duration of time elapsed since start.
   */
  def start(): Elapsed
}

/**
 * The system [[Stopwatch]] measures elapsed time using `System.nanoTime`.
 *
 * Note that it works well with unit tests by respecting
 * time manipulation on [[Time]].
 */
object Stopwatch extends Stopwatch {

  private[this] val systemNanoFn = () => System.nanoTime()

  def start(): Elapsed = Time.localGetTime() match {
    case Some(local) =>
      val startAt: Time = local()
      () => local() - startAt
    case None =>
      val startAt: Long = systemNanoFn()
      () => Duration.fromNanoseconds(systemNanoFn() - startAt)
  }

  /**
   * A [[Stopwatch]] that always returns `dur` for the
   * elapsed [[Duration duration]].
   */
  def const(dur: Duration): Stopwatch = new Stopwatch {
    private[this] val fn = () => dur
    def start(): Elapsed = fn
  }
}

/**
 * A trivial implementation of [[Stopwatch]] for use as a null
 * object.
 */
object NilStopwatch extends Stopwatch {
  private[this] val fn = () => Duration.Bottom
  def start(): Elapsed = fn
}

package com.twitter.util

/**
 * A stopwatch may be used to measure elapsed time.
 */
trait Stopwatch {
  type Elapsed = () => Duration

  /**
   * Start the stopwatch. The returned timer may be read any time,
   * returning the duration of time elapsed since start.
   */
  def start(): Elapsed
}

/**
 * The system [[Stopwatch]] measures elapsed time using `System.nanoTime`.
 *
 * Note that it works well with unit tests by respecting
 * time manipulation on [[Time]].
 */
object Stopwatch extends Stopwatch {

  private[this] val systemNanoFn = () => Time.fromNanoseconds(System.nanoTime())

  def start(): Elapsed = {
    val timeFn = Time.localGetTime() match {
      case Some(local) => local
      case None => systemNanoFn
    }
    val startAt = timeFn()
    () => timeFn() - startAt
  }

  /**
   * A [[Stopwatch]] that always returns `dur` for the
   * elapsed [[Duration duration]].
   */
  def const(dur: Duration): Stopwatch = new Stopwatch {
    private[this] val fn = () => dur
    def start(): Elapsed = fn
  }
}

/**
 * A trivial implementation of [[Stopwatch]] for use as a null
 * object.
 */
object NilStopwatch extends Stopwatch {
  private[this] val fn = () => Duration.Bottom
  def start(): Elapsed = fn
}

Revert "finagle-exp: Make BackupRequestFilter allocate less"

RB_ID=645748


package com.twitter.util

/**
 * A stopwatch may be used to measure elapsed time.
 */
trait Stopwatch {
  type Elapsed = () => Duration

  /**
   * Start the stopwatch. The returned timer may be read any time,
   * returning the duration of time elapsed since start.
   */
  def start(): Elapsed
}

/**
 * The system [[Stopwatch]] measures elapsed time using `System.nanoTime`.
 *
 * Note that it works well with unit tests by respecting
 * time manipulation on [[Time]].
 */
object Stopwatch extends Stopwatch {

  private[this] val systemNanoFn = () => Time.fromNanoseconds(System.nanoTime())

  def start(): Elapsed = {
    val timeFn = Time.localGetTime() match {
      case Some(local) => local
      case None => systemNanoFn
    }
    val startAt = timeFn()
    () => timeFn() - startAt
  }

  /**
   * A [[Stopwatch]] that always returns `dur` for the
   * elapsed [[Duration duration]].
   */
  def const(dur: Duration): Stopwatch = new Stopwatch {
    private[this] val fn = () => dur
    def start(): Elapsed = fn
  }
}

/**
 * A trivial implementation of [[Stopwatch]] for use as a null
 * object.
 */
object NilStopwatch extends Stopwatch {
  private[this] val fn = () => Duration.Bottom
  def start(): Elapsed = fn
}

package com.twitter.util

/**
 * A stopwatch may be used to measure elapsed time.
 */
trait Stopwatch {
  type Elapsed = () => Duration

  /**
   * Start the stopwatch. The returned timer may be read any time,
   * returning the duration of time elapsed since start.
   */
  def start(): Elapsed
}

/**
 * The system [[Stopwatch]] measures elapsed time using `System.nanoTime`.
 *
 * Note that it works well with unit tests by respecting
 * time manipulation on [[Time]].
 */
object Stopwatch extends Stopwatch {

  private[this] val systemNanoFn = () => System.nanoTime()

  def start(): Elapsed = Time.localGetTime() match {
    case Some(local) =>
      val startAt: Time = local()
      () => local() - startAt
    case None =>
      val startAt: Long = systemNanoFn()
      () => Duration.fromNanoseconds(systemNanoFn() - startAt)
  }

  /**
   * A [[Stopwatch]] that always returns `dur` for the
   * elapsed [[Duration duration]].
   */
  def const(dur: Duration): Stopwatch = new Stopwatch {
    private[this] val fn = () => dur
    def start(): Elapsed = fn
  }
}

/**
 * A trivial implementation of [[Stopwatch]] for use as a null
 * object.
 */
object NilStopwatch extends Stopwatch {
  private[this] val fn = () => Duration.Bottom
  def start(): Elapsed = fn
}

Revert "Revert "finagle-exp: Make BackupRequestFilter allocate less""

Problem

The old version of this review occasionally used nanoTime with a Timer, which broke it, since nanoTime should only be used for durations.

Solution

nowMs is only used for durations, never for current time.

RB_ID=649078


import sbt._, Keys._

object Dependencies {
  val servletApiDep = "jakarta.servlet" % "jakarta.servlet-api" % "5.0.0"

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.13.0" cross CrossVersion.for3Use2_13
  }

  def okHttp = "com.squareup.okhttp3" % "okhttp" % "4.9.2" :: Nil

  def integrationTestDeps = Def.setting((specs2Dep.value :: okHttp) map { _ % "test" })

  val commonsCodecVersion = "1.15"
  val scalaXmlVersion = "2.0.1"
  val commonsIoVersion = "2.11.0"
  val commonsFileUploadVersion = "1.4"
  val jettyVersion = "11.0.7"
  val nettyVersion = "4.1.69.Final"
  val scalatestVersion = "3.2.10"
  val scalatestScalacheckVersion = s"${scalatestVersion}.0"
  val json4sVersion = "4.0.3"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

import sbt._, Keys._

object Dependencies {
  val servletApiDep = "jakarta.servlet" % "jakarta.servlet-api" % "5.0.0"

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.13.0" cross CrossVersion.for3Use2_13
  }

  def okHttp = "com.squareup.okhttp3" % "okhttp" % "4.9.2" :: Nil

  def integrationTestDeps = Def.setting((specs2Dep.value :: okHttp) map { _ % "test" })

  val commonsCodecVersion = "1.15"
  val scalaXmlVersion = "2.0.1"
  val commonsIoVersion = "2.11.0"
  val commonsFileUploadVersion = "1.4"
  val jettyVersion = "11.0.7"
  val nettyVersion = "4.1.70.Final"
  val scalatestVersion = "3.2.10"
  val scalatestScalacheckVersion = s"${scalatestVersion}.0"
  val json4sVersion = "4.0.3"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

Update netty-codec-http, netty-handler, ... to 4.1.70.Final


package org.allenai.common.webapp

import org.allenai.common.Version

import spray.http.StatusCodes
import spray.json._
import spray.json.DefaultJsonProtocol._
import spray.routing.Directives._
import spray.routing.Route

/** Class providing a spray route with common information, handling requests to the /info path.
  * Requests to the root of the path return a string with all the info keys separated by newlines,
  * while requests to subpaths return the value of the given key, or a 404 for invalid keys.
  *
  * @param info the info to serve
  */
class InfoRoute(val info: Map[String, String] = Map.empty) {
  def withVersion(version: Version): InfoRoute = {
    new InfoRoute(
      info +
      ("gitversion" -> version.gitVersion) +
      ("artifactversion" -> version.artifactVersion)) ++
      version.githubCommitUrl("allenai").map("githubUrl" -> _)
  }

  def withName(name: String): InfoRoute = new InfoRoute(info + ("name" -> name))

  // format: OFF
  def route: Route = get {
    pathPrefix("info") {
      pathEndOrSingleSlash {
        complete {
          info.toJson.prettyPrint
        }
      }
    } ~
    path("info" / Segment) { key =>
      complete {
        info.get(key) match {
          case Some(key) => key
          case None => (StatusCodes.NotFound, "Could not find info: " + key)
        }
      }
    }
  }
  // format: ON
}

package org.allenai.common.webapp

import org.allenai.common.Version

import spray.http.StatusCodes
import spray.json._
import spray.json.DefaultJsonProtocol._
import spray.routing.Directives._
import spray.routing.Route

/** Class providing a spray route with common information, handling requests to the /info path.
  * Requests to the root of the path return a string with all the info keys separated by newlines,
  * while requests to subpaths return the value of the given key, or a 404 for invalid keys.
  *
  * @param info the info to serve
  */
class InfoRoute(val info: Map[String, String] = Map.empty) {
  def withVersion(version: Version): InfoRoute = {
    new InfoRoute(
      info +
      ("gitVersion" -> version.gitVersion) +
      ("artifactVersion" -> version.artifactVersion)) ++
      version.githubCommitUrl("allenai").map("githubUrl" -> _)
  }

  def withName(name: String): InfoRoute = new InfoRoute(info + ("name" -> name))

  // format: OFF
  def route: Route = get {
    pathPrefix("info") {
      pathEndOrSingleSlash {
        complete {
          info.toJson.prettyPrint
        }
      }
    } ~
    path("info" / Segment) { key =>
      complete {
        info.get(key) match {
          case Some(key) => key
          case None => (StatusCodes.NotFound, "Could not find info: " + key)
        }
      }
    }
  }
  // format: ON
}

Use camel-case for info keys.

Use camel-case for info keys.


/* Copyright 2009-2018 EPFL, Lausanne */

package stainless
package frontends.scalac

import extraction.xlang.{trees => xt}
import scala.tools.nsc._

import stainless.frontend.{ UnsupportedCodeException, CallBack }

/** Extract each compilation unit and forward them to the Compiler callback */
trait StainlessExtraction extends SubComponent with CodeExtraction with FragmentChecker {
  import global._

  val phaseName = "stainless"

  implicit val ctx: inox.Context
  protected val callback: CallBack

  def newPhase(prev: scala.tools.nsc.Phase): StdPhase = new Phase(prev)

  class Phase(prev: scala.tools.nsc.Phase) extends StdPhase(prev) {
    def apply(u: CompilationUnit): Unit = {
      val file = u.source.file.absolute.path
      val checker = new Checker
      checker(u.body)
      if (!checker.hasErrors()) {
        val (unit, classes, functions) = extractUnit(u)
        callback(file, unit, classes, functions)
      } else
        // there seems to be some code that
        throw new UnsupportedCodeException(NoPosition, "Unsupported fragment detected")
    }
  }
}

/* Copyright 2009-2018 EPFL, Lausanne */

package stainless
package frontends.scalac

import extraction.xlang.{trees => xt}
import scala.tools.nsc._

import stainless.frontend.{ UnsupportedCodeException, CallBack }

/** Extract each compilation unit and forward them to the Compiler callback */
trait StainlessExtraction extends SubComponent with CodeExtraction with FragmentChecker {
  import global._

  val phaseName = "stainless"

  implicit val ctx: inox.Context
  protected val callback: CallBack

  def newPhase(prev: scala.tools.nsc.Phase): StdPhase = new Phase(prev)

  class Phase(prev: scala.tools.nsc.Phase) extends StdPhase(prev) {
    def apply(u: CompilationUnit): Unit = {
      val file = u.source.file.absolute.path
      val checker = new Checker
      checker(u.body)
      if (!checker.hasErrors()) {
        val (unit, classes, functions) = extractUnit(u)
        callback(file, unit, classes, functions)
      } /* else
        // there seems to be some code that
        throw new UnsupportedCodeException(NoPosition, "Unsupported fragment detected") */
    }
  }
}

Recomment throw as errors should have been reported


package uk.ac.wellcome.platform.transformer.transformers

import org.scalatest.Matchers
import uk.ac.wellcome.models.transformable.Transformable
import uk.ac.wellcome.models.work.internal.UnidentifiedWork

trait TransformableTestBase[T <: Transformable] extends Matchers {

  val transformer: TransformableTransformer[T]

  def transformToWork(transformable: T): UnidentifiedWork = {
    val triedMaybeWork = transformer.transform(transformable, version = 1)
    if (triedMaybeWork.isFailure) triedMaybeWork.failed.get.printStackTrace()
    triedMaybeWork.isSuccess shouldBe true
    triedMaybeWork.get.get
  }

  def assertTransformToWorkFails(transformable: T): Unit = {
    transformer
      .transform(transformable, version = 1)
      .isSuccess shouldBe false
  }
}

package uk.ac.wellcome.platform.transformer.transformers

import org.scalatest.Matchers
import uk.ac.wellcome.models.transformable.Transformable
import uk.ac.wellcome.models.work.internal.UnidentifiedWork

import scala.reflect.ClassTag

/** Utilities for transformer tests.
  *
  * @@AWLC: when I first wrote this code, I got the following error:
  *
  *     TransformableTestBase.scala:12:47: No ClassTag available for T
  *         val triedMaybeWork = transformer.transform(transformable, version = 1)
  *                                                    ↑
  *
  * The addition of the implicit ClassTag[T] is working around this error.
  * In general reflection is icky, but it's only in tests so I think this
  * is okay.
  */
trait TransformableTestBase[T <: Transformable] extends Matchers {

  val transformer: TransformableTransformer[T]

  def transformToWork(transformable: T)(implicit c: ClassTag[T]): UnidentifiedWork = {
    val triedMaybeWork = transformer.transform(transformable, version = 1)
    if (triedMaybeWork.isFailure) triedMaybeWork.failed.get.printStackTrace()
    triedMaybeWork.isSuccess shouldBe true
    triedMaybeWork.get.get
  }

  def assertTransformToWorkFails(transformable: T)(implicit c: ClassTag[T]): Unit = {
    transformer
      .transform(transformable, version = 1)
      .isSuccess shouldBe false
  }
}

Add an implicit class tag to work around errors


package notification.services

import play.api.Logger
import play.api.libs.ws.WSClient
import scala.concurrent.duration._

import scala.concurrent.{ExecutionContext, Future}

trait FastlyPurge {
  def softPurge(contentApiId: String): Future[Boolean]
}

class FastlyPurgeImpl(wsClient: WSClient, configuration: Configuration)(implicit ec: ExecutionContext) extends FastlyPurge {

  private val logger: Logger = Logger(this.getClass)

  def softPurge(contentApiId: String): Future[Boolean] = {
    val url = s"${configuration.fastlyApiEndpoint}/service/${configuration.fastlyService}/purge/Item/$contentApiId"

    wsClient.url(url)
      .addHttpHeaders("Fastly-Soft-Purge" -> "1")
      .addHttpHeaders("Fastly-key:" -> s"${configuration.fastlyKey}")
      .withRequestTimeout(durationToPair(2.seconds))
      .execute("PURGE")
      .map { resp =>
        logger.info(s"Soft purged $url got HTTP ${resp.status} back")
        if (resp.status == 200) {
          true
        } else {
          throw new Exception(s"Unable to soft purge url, got HTTP ${resp.status} for $url")
        }
      }
  }

}

package notification.services

import play.api.Logger
import play.api.libs.ws.WSClient
import scala.concurrent.duration._

import scala.concurrent.{ExecutionContext, Future}

trait FastlyPurge {
  def softPurge(contentApiId: String): Future[Boolean]
}

class FastlyPurgeImpl(wsClient: WSClient, configuration: Configuration)(implicit ec: ExecutionContext) extends FastlyPurge {

  private val logger: Logger = Logger(this.getClass)

  def softPurge(contentApiId: String): Future[Boolean] = {
    val url = s"${configuration.fastlyApiEndpoint}/service/${configuration.fastlyService}/purge/Item/$contentApiId"

    wsClient.url(url)
      .addHttpHeaders("Fastly-Soft-Purge" -> "1")
      .addHttpHeaders("Fastly-Key" -> s"${configuration.fastlyKey}")
      .withRequestTimeout(durationToPair(2.seconds))
      .execute("POST")
      .map { resp =>
        logger.info(s"Soft purged $url got HTTP ${resp.status} back ${resp.body}")
        if (resp.status == 200) {
          true
        } else {
          throw new Exception(s"Unable to soft purge url, got HTTP ${resp.status} for $url")
        }
      }
  }

}

Change PURGE to be POST

Change PURGE to be POST


package uk.ac.wellcome.platform.transformer.transformers.sierra

import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.models.work.internal.{LocationType, PhysicalLocation}
import uk.ac.wellcome.platform.transformer.source.{
  SierraItemData,
  SierraItemLocation
}

class SierraLocationTest extends FunSpec with Matchers {

  val transformer = new SierraLocation {}

  it("extracts location from item data") {
    val locationTypeCode = "sgmed"
    val locationType = LocationType("sgmed")
    val label = "A museum of mermaids"
    val itemData = SierraItemData(
      id = "i1234567",
      location = Some(SierraItemLocation(locationTypeCode, label))
    )

    val expectedLocation = PhysicalLocation(locationType, label)

    transformer.getLocation(itemData = itemData) shouldBe Some(expectedLocation)
  }

  it("returns None if the location field only contains empty strings") {
    val itemData = SierraItemData(
      id = "i1234567",
      location = Some(SierraItemLocation("", ""))
    )

    transformer.getLocation(itemData = itemData) shouldBe None
  }

  it("returns None if there is no location in the item data") {
    val itemData = SierraItemData(
      id = "i1234567"
    )

    transformer.getLocation(itemData = itemData) shouldBe None
  }
}

package uk.ac.wellcome.platform.transformer.transformers.sierra

import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.models.work.internal.{LocationType, PhysicalLocation}
import uk.ac.wellcome.platform.transformer.source.{
  SierraItemData,
  SierraItemLocation
}

class SierraLocationTest extends FunSpec with Matchers {

  val transformer = new SierraLocation {}

  it("extracts location from item data") {
    val locationTypeCode = "sgmed"
    val locationType = LocationType("sgmed")
    val label = "A museum of mermaids"
    val itemData = SierraItemData(
      id = "i1234567",
      location = Some(SierraItemLocation(locationTypeCode, label))
    )

    val expectedLocation = PhysicalLocation(locationType, label)

    transformer.getLocation(itemData = itemData) shouldBe Some(expectedLocation)
  }

  it("returns None if the location field only contains empty strings") {
    val itemData = SierraItemData(
      id = "i1234567",
      location = Some(SierraItemLocation("", ""))
    )

    transformer.getLocation(itemData = itemData) shouldBe None
  }

  it("returns None if the location field only contains the string 'none'") {
    val itemData = SierraItemData(
      id = "i1234567",
      location = Some(SierraItemLocation("none", "none"))
    )

    transformer.getLocation(itemData = itemData) shouldBe None
  }

  it("returns None if there is no location in the item data") {
    val itemData = SierraItemData(
      id = "i1234567"
    )

    transformer.getLocation(itemData = itemData) shouldBe None
  }
}

Add a test that a location of ("none", "none") is ignored


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.openmole.ide.plugin.environment.glite

import org.openmole.ide.core.model.data.IEnvironmentDataUI
import org.openmole.plugin.environment.glite.DIRACGliteEnvironment

class DiracEnvironmentDataUI(val name: String = "",
                             val voName: String = "",
                             val service: String = "",
                             val group: String = "",
                             val bdii: String = "",
                             val vomsURL: String = "",
                             val setup: String = "",
                             val fqan: Option[String] = None,
                             val cpuTime: Option[String] = None,
                             val openMOLEMemory: Option[Int] = Some(512)) extends IEnvironmentDataUI {

  def coreObject = new DIRACGliteEnvironment(voName, service, group, bdii, vomsURL, setup, fqan, cpuTime, openMOLEMemory)

  def coreClass = classOf[DIRACGliteEnvironment]

  def imagePath = "img/dirac.png"

  override def fatImagePath = "img/dirac_fat.png"

  def buildPanelUI = new DiracEnvironmentPanelUI(this)
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.openmole.ide.plugin.environment.glite

import org.openmole.ide.core.model.data.IEnvironmentDataUI
import org.openmole.plugin.environment.glite.DIRACGliteEnvironment

class DiracEnvironmentDataUI(val name: String = "",
                             val voName: String = "",
                             val service: String = "",
                             val group: String = "",
                             val bdii: String = "",
                             val vomsURL: String = "",
                             val setup: String = "",
                             val fqan: Option[String] = None,
                             val cpuTime: Option[String] = None,
                             val openMOLEMemory: Option[Int] = None) extends IEnvironmentDataUI {

  def coreObject = new DIRACGliteEnvironment(voName, service, group, bdii, vomsURL, setup, fqan, cpuTime, openMOLEMemory)

  def coreClass = classOf[DIRACGliteEnvironment]

  def imagePath = "img/dirac.png"

  override def fatImagePath = "img/dirac_fat.png"

  def buildPanelUI = new DiracEnvironmentPanelUI(this)
}

Set mem init value to None

Set mem init value to None


package uk.ac.wellcome.platform.transformer.sierra.transformers.sierra.subjects

import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.platform.transformer.sierra.generators.SierraDataGenerators

class SierraOrganisationSubjectsTest extends FunSpec with Matchers with SierraDataGenerators {
  it("returns an empty list if there are no instances of MARC tag 610") {
    val bibData = createSierraBibDataWith(varFields = List())
    transformer.getSubjectsWithOrganisation(bibData) shouldBe List()
  }

  val transformer = new SierraOrganisationSubjects {}
}

package uk.ac.wellcome.platform.transformer.sierra.transformers.sierra.subjects

import org.scalatest.{FunSpec, Matchers}
import uk.ac.wellcome.platform.transformer.sierra.generators.SierraDataGenerators
import uk.ac.wellcome.platform.transformer.sierra.source.{MarcSubfield, VarField}

class SierraOrganisationSubjectsTest extends FunSpec with Matchers with SierraDataGenerators {
  it("returns an empty list if there are no instances of MARC tag 610") {
    val bibData = createSierraBibDataWith(varFields = List())
    transformer.getSubjectsWithOrganisation(bibData) shouldBe List()
  }

  it("uses subfields a, b, c, d and e as the label") {
    val bibData = createSierraBibDataWith(
      varFields = List(
        VarField(
          marcTag = "610",
          indicator1 = "",
          indicator2 = "",
          subfields = List(
            MarcSubfield(tag = "a", content = "United States."),
            MarcSubfield(tag = "b", content = "Supreme Court,"),
            MarcSubfield(tag = "c", content = "Washington, DC."),
            MarcSubfield(tag = "d", content = "September 29, 2005,"),
            MarcSubfield(tag = "e", content = "depicted.")
          )
        )
      )
    )

    val subjects = transformer.getSubjectsWithOrganisation(bibData)
    subjects should have size 1

    subjects.head.label shouldBe "United States. Supreme Court, Washington, DC. September 29, 2005, depicted."
  }

  val transformer = new SierraOrganisationSubjects {}
}

Add a test for the subject label

Add a test for the subject label


package dotty.tools
package dotc

import core.Contexts.Context
import reporting.Reporter
import java.io.EOFException
import scala.annotation.tailrec

/** A compiler which stays resident between runs.
 *  Usage:
 *
 *  > scala dotty.tools.dotc.Resident <options> <initial files>
 *
 *  dotc> "more options and files to compile"
 *
 *  ...
 *
 *  dotc> :reset  // reset all options to the ones passed on the command line
 *
 *  ...
 *
 *  dotc> :q     // quit
 */
object Resident extends Driver {

  object residentCompiler extends Compiler

  override def newCompiler(): Compiler = ???

  override def sourcesRequired = false

  private val quit = ":q"
  private val reset = ":reset"

  private def getLine() = {
    Console.print(prompt)
    try scala.io.StdIn.readLine() catch { case _: EOFException => quit }
  }

  final override def process(args: Array[String], rootCtx: Context): Reporter = {
    @tailrec def loop(args: Array[String], prevCtx: Context): Reporter = {
      var (fileNames, ctx) = setup(args, prevCtx)
      doCompile(residentCompiler, fileNames)(ctx)
      var nextCtx = ctx
      var line = getLine()
      while (line == reset) {
        nextCtx = rootCtx
        line = getLine()
      }
      if (line.startsWith(quit)) ctx.typerState.reporter
      else loop(line split "\\s+", nextCtx)
    }
    loop(args, rootCtx)
  }
}

package dotty.tools
package dotc

import core.Contexts.Context
import reporting.Reporter
import java.io.EOFException
import scala.annotation.tailrec

/** A compiler which stays resident between runs.
 *  Usage:
 *
 *  > scala dotty.tools.dotc.Resident <options> <initial files>
 *
 *  dotc> "more options and files to compile"
 *
 *  ...
 *
 *  dotc> :reset  // reset all options to the ones passed on the command line
 *
 *  ...
 *
 *  dotc> :q     // quit
 */
object Resident extends Driver {

  @unshared object residentCompiler extends Compiler

  override def newCompiler(): Compiler = ???

  override def sourcesRequired = false

  private val quit = ":q"
  private val reset = ":reset"

  private def getLine() = {
    Console.print(prompt)
    try scala.io.StdIn.readLine() catch { case _: EOFException => quit }
  }

  final override def process(args: Array[String], rootCtx: Context): Reporter = {
    @tailrec def loop(args: Array[String], prevCtx: Context): Reporter = {
      var (fileNames, ctx) = setup(args, prevCtx)
      doCompile(residentCompiler, fileNames)(ctx)
      var nextCtx = ctx
      var line = getLine()
      while (line == reset) {
        nextCtx = rootCtx
        line = getLine()
      }
      if (line.startsWith(quit)) ctx.typerState.reporter
      else loop(line split "\\s+", nextCtx)
    }
    loop(args, rootCtx)
  }
}

Mark gloabl entry point @unshared

Mark gloabl entry point @unshared

The resident compiler is not supposed to be called from multiple
threads; mark as unshared to avoid spurious re-entrancy errors.


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

package rx.oanda.utils

import cats.data.Xor
import io.circe.DecodingFailure
import io.circe.parse._
import org.scalatest._

class HeartbeatDecoderSpec extends FlatSpec with Matchers {

  behavior of "The Heartbeat Decoder"

  it must "parse a hertbeat from valid json" in {
    val json =
      """
        |{"time":"1453849454039260"}
      """.stripMargin
    decode[Heartbeat](json) should matchPattern {
      case Xor.Right(Heartbeat(1453849454039260L)) ⇒
    }
  }

  it must "fail on invalid side" in {
    val json =
      """
        |{"timestamp":"suchbernd"}
      """.stripMargin
    decode[Heartbeat](json) should matchPattern {
      case Xor.Left(e: DecodingFailure) ⇒ //...
    }
  }

}

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

package rx.oanda.utils

import cats.data.Xor
import io.circe.DecodingFailure
import io.circe.parse._
import org.scalatest._

class HeartbeatDecoderSpec extends FlatSpec with Matchers {

  behavior of "The Heartbeat Decoder"

  it must "parse a heartbeat from valid json" in {
    val json =
      """
        |{"time":"1453849454039260"}
      """.stripMargin
    decode[Heartbeat](json) should matchPattern {
      case Xor.Right(Heartbeat(1453849454039260L)) ⇒
    }
  }

  it must "fail when timestamp is not a unix timestamp" in {
    val json =
      """
        |{"timestamp":"suchbernd"}
      """.stripMargin
    decode[Heartbeat](json) should matchPattern {
      case Xor.Left(e: DecodingFailure) ⇒ //...
    }
  }

}

Fix wrong spec descriptions in Heartbeat Decoder


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.92"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.8",
      "com.ning" % "async-http-client" % "1.9.39",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

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

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.8"

version := "0.0.93"

exportJars := true

lazy val root = project
  .in(file("."))
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.play" %% "play-json" % "2.5.8",
      "com.ning" % "async-http-client" % "1.9.39",
      "org.scalatest" %% "scalatest" % "2.2.6" % Test
    )
  )

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

autocommit: Update configuration to record version 0.0.93


organization := "tv.cntt"

name         := "netty-router"

version      := "1.10-SNAPSHOT"

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

scalaVersion := "2.11.2"

autoScalaLibrary := false

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

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

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

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

libraryDependencies += "tv.cntt" % "jauter" % "1.7"

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

organization := "tv.cntt"

name         := "netty-router"

version      := "1.10-SNAPSHOT"

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

scalaVersion := "2.11.2"

autoScalaLibrary := false

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

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

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

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

libraryDependencies += "tv.cntt" % "jauter" % "1.7"

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

Update Netty from 4.0.23 to 4.0.24

Update Netty from 4.0.23 to 4.0.24


name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

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

name := "lib-reference-scala"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

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

autocommit: Update configuration to record version 0.2.33


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

oneJarSettings

name := "api-build"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.6"

version := "0.1.91"

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

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