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

package com.mediative.sangria.codegen
package starwars

import org.scalatest.{WordSpec, Matchers}

class StarWarsAnnotationSpec extends WordSpec with Matchers {
  "GraphQLDomain" should {
    "support the Star Wars schema and operations" in {
      sangria.introspection.introspectionQuery
      """
      import com.mediative.sangria.codegen.GraphQLDomain

      @GraphQLDomain(
        "samples/starwars/schema.graphql",
        "samples/starwars/MultiQuery.graphql"
      )
      object StarWarsDomain
      """ should compile
    }
  }
}

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

package com.mediative.sangria.codegen
package starwars

import org.scalatest.{WordSpec, Matchers}
import com.mediative.sangria.codegen.GraphQLDomain

@GraphQLDomain(
  "samples/starwars/schema.graphql",
  "samples/starwars/MultiQuery.graphql"
)
object StarWarsDomain

class StarWarsAnnotationSpec extends WordSpec with Matchers {
  "GraphQLDomain" should {
    "support the Star Wars schema and operations" in {
      import StarWarsDomain.HeroAndFriends

      val heroAndFriends = HeroAndFriends(
        hero = HeroAndFriends.Hero(
          name = Some("Luke"),
          friends = Some(List(Some(HeroAndFriends.Hero.Friends(Some("R2D2")))))
        )
      )
    }
  }
}

Change the annotation macro test to actually use expanded case classes


package org.typelevel.sbt

import sbt._, Keys._
import sbtghactions.GenerativePlugin
import sbtghactions.GitHubActionsPlugin
import sbtghactions.GenerativePlugin.autoImport._

object TypelevelCiReleasePlugin extends AutoPlugin {

  object autoImport {
    lazy val tlCiReleaseSnapshots = settingKey[Boolean](
      "Controls whether or not snapshots should be released (default: false)")
    lazy val tlCiReleaseBranches =
      settingKey[Seq[String]]("The branches in your repository to release from (default: [])")
  }

  import autoImport._

  override def requires = TypelevelSonatypePlugin && GitHubActionsPlugin &&
    GenerativePlugin

  override def trigger = noTrigger

  override def globalSettings =
    Seq(tlCiReleaseSnapshots := false, tlCiReleaseBranches := Seq())

  override def buildSettings = Seq(
    githubWorkflowEnv ++= Map(
      "SONATYPE_USERNAME" -> s"$${{ secrets.SONATYPE_USERNAME }}",
      "SONATYPE_PASSWORD" -> s"$${{ secrets.SONATYPE_PASSWORD }}"
    ),
    githubWorkflowPublishTargetBranches := {
      val seed =
        if (tlCiReleaseSnapshots.value)
          tlCiReleaseBranches.value.map(b => RefPredicate.Equals(Ref.Branch(b)))
        else
          Seq.empty

      RefPredicate.StartsWith(Ref.Tag("v")) +: seed
    },
    githubWorkflowTargetTags += "v*",
    githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("release")))
  )
}

package org.typelevel.sbt

import sbt._
import sbtghactions.GenerativePlugin
import sbtghactions.GitHubActionsPlugin
import sbtghactions.GenerativePlugin.autoImport._

object TypelevelCiReleasePlugin extends AutoPlugin {

  object autoImport {
    lazy val tlCiReleaseSnapshots = settingKey[Boolean](
      "Controls whether or not snapshots should be released (default: false)")
    lazy val tlCiReleaseBranches =
      settingKey[Seq[String]]("The branches in your repository to release from (default: [])")
  }

  import autoImport._

  override def requires = TypelevelSonatypePlugin && GitHubActionsPlugin &&
    GenerativePlugin

  override def trigger = noTrigger

  override def globalSettings =
    Seq(tlCiReleaseSnapshots := false, tlCiReleaseBranches := Seq())

  override def buildSettings = Seq(
    githubWorkflowEnv ++= Map(
      "SONATYPE_USERNAME" -> s"$${{ secrets.SONATYPE_USERNAME }}",
      "SONATYPE_PASSWORD" -> s"$${{ secrets.SONATYPE_PASSWORD }}"
    ),
    githubWorkflowPublishTargetBranches := {
      val seed =
        if (tlCiReleaseSnapshots.value)
          tlCiReleaseBranches.value.map(b => RefPredicate.Equals(Ref.Branch(b)))
        else
          Seq.empty

      RefPredicate.StartsWith(Ref.Tag("v")) +: seed
    },
    githubWorkflowTargetTags += "v*",
    githubWorkflowPublish := Seq(
      WorkflowStep.Sbt(
        List("release"),
        cond = Some( // NEVER release a tag on a non-tag workflow run
          "(startsWith(github.ref, 'refs/tags/v') && github.ref_type == 'tag') || (!startsWith(github.ref, 'refs/tags/v') && github.ref_type != 'tag')")
      )
    )
  )
}

Add failsafe for tag/push double-publish


/*
 * Copyright 2021 Typelevel
 *
 * 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 org.typelevel.sbt

import sbt._

object TypelevelCiReleasePlugin extends AutoPlugin {

  override def requires =
    TypelevelVersioningPlugin &&
      TypelevelMimaPlugin &&
      TypelevelCiPlugin &&
      TypelevelSonatypeCiReleasePlugin &&
      TypelevelCiSigningPlugin

  override def trigger = noTrigger

}

/*
 * Copyright 2021 Typelevel
 *
 * 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 org.typelevel.sbt

import sbt._

object TypelevelCiReleasePlugin extends AutoPlugin {

  override def requires =
    TypelevelVersioningPlugin &&
      TypelevelMimaPlugin &&
      TypelevelCiPlugin &&
      TypelevelSonatypeCiReleasePlugin &&
      TypelevelCiSigningPlugin &&
      TypelevelGitHubPlugin

  override def trigger = noTrigger

}

Add the GitHub plugin to the ci release stack


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

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

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

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

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

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

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


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

addSbtPlugin("com.typesafe"                      % "sbt-mima-plugin"       % "1.1.0")
addSbtPlugin("com.typesafe.sbt"                  % "sbt-osgi"              % "0.9.6")
addSbtPlugin("com.eed3si9n"                      % "sbt-buildinfo"         % "0.11.0")
addSbtPlugin("com.github.sbt"                    % "sbt-ci-release"        % "1.5.10")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings"      % "3.0.2")
addSbtPlugin("org.scala-js"                      % "sbt-scalajs"           % "1.10.1")
addSbtPlugin("org.scala-native"                  % "sbt-scala-native"      % "0.4.5")
addSbtPlugin("org.portable-scala"                % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala"                % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("com.codecommit"                    % "sbt-github-actions"    % "0.13.0")

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

addSbtPlugin("com.typesafe"                      % "sbt-mima-plugin"       % "1.1.0")
addSbtPlugin("com.typesafe.sbt"                  % "sbt-osgi"              % "0.9.6")
addSbtPlugin("com.eed3si9n"                      % "sbt-buildinfo"         % "0.11.0")
addSbtPlugin("com.github.sbt"                    % "sbt-ci-release"        % "1.5.10")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings"      % "3.0.2")
addSbtPlugin("org.scala-js"                      % "sbt-scalajs"           % "1.10.1")
addSbtPlugin("org.scala-native"                  % "sbt-scala-native"      % "0.4.6")
addSbtPlugin("org.portable-scala"                % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("org.portable-scala"                % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("com.codecommit"                    % "sbt-github-actions"    % "0.13.0")

Update junit-plugin, junit-runtime, ... to 0.4.6


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

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

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

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

Update sbt-wartremover, wartremover to 3.0.3


package com.anchortab.snippet

import scala.xml._

import net.liftweb._
  import common._
  import http._
    import LiftRules._
    import rest._
    import js._
      import JE._
      import JsExp._
  import util._
    import Helpers._
  import json._
    import JsonDSL._
    import Extraction._
  import mongodb._
    import BsonDSL._

class SimpleAnchorTabEvent(eventName:String) extends JsExp {
  import Serialization._

  implicit def typeHints = Serialization.formats(NoTypeHints)

  def toJsCmd = {
    Call("anchortab.event", eventName, decompose(this)).cmd.toJsCmd
  }
}
class AnchorTabEvent(eventName:String, parameters:JObject) extends JsCmd {
  def toJsCmd = {
    Call("anchortab.event", eventName, parameters).cmd.toJsCmd
  }
}

object Util extends Loggable {
  def snippetHandlers : SnippetPF = {
    case "ie-conditional" :: Nil => ieConditional _
    case "jquery" :: Nil => jquery _
  }

  def ieConditional(xhtml:NodeSeq) = {
    val ieVersion = S.attr("version") openOr "IE"
    Unparsed("<!--[if " + ieVersion + "]>") ++ xhtml ++ Unparsed("<![endif]-->")
  }

  def jquery(xhtml:NodeSeq) = {
    val jQueryUrl = Props.get("jquery.url")

    jQueryUrl.map { url =>
      ("script [src]" #> url).apply(xhtml)
    } openOr {
      xhtml
    }
  }
}

package com.anchortab.snippet

import scala.xml._

import net.liftweb._
  import common._
  import http._
    import LiftRules._
    import rest._
    import js._
      import JE._
      import JsExp._
  import util._
    import Helpers._
  import json._
    import JsonDSL._
    import Extraction._
  import mongodb._
    import BsonDSL._

class SimpleAnchorTabEvent(eventName:String) extends JsCmd {
  import Serialization._

  implicit def typeHints = Serialization.formats(NoTypeHints)

  def toJsCmd = {
    Call("anchortab.event", eventName, decompose(this)).cmd.toJsCmd
  }
}
class AnchorTabEvent(eventName:String, parameters:JObject) extends JsCmd {
  def toJsCmd = {
    Call("anchortab.event", eventName, parameters).cmd.toJsCmd
  }
}

object Util extends Loggable {
  def snippetHandlers : SnippetPF = {
    case "ie-conditional" :: Nil => ieConditional _
    case "jquery" :: Nil => jquery _
  }

  def ieConditional(xhtml:NodeSeq) = {
    val ieVersion = S.attr("version") openOr "IE"
    Unparsed("<!--[if " + ieVersion + "]>") ++ xhtml ++ Unparsed("<![endif]-->")
  }

  def jquery(xhtml:NodeSeq) = {
    val jQueryUrl = Props.get("jquery.url")

    jQueryUrl.map { url =>
      ("script [src]" #> url).apply(xhtml)
    } openOr {
      xhtml
    }
  }
}

Extend the correct class for SimpleAnchorTabEvent.


import Compatibility._

scalaVersion := appConfiguration.value.provider.scalaProvider.version

lazy val updateSbtClassifiersCheck = TaskKey[Unit]("updateSbtClassifiersCheck")

updateSbtClassifiersCheck := {

  val configReport = updateSbtClassifiers
    .value
    .configuration(Default)
    .getOrElse {
      throw new Exception(
        "default configuration not found in updateSbtClassifiers report"
      )
    }

  def artifacts(org: String, name: String) = configReport
    .modules
    .collect {
      case moduleReport
        if moduleReport.module.organization == org &&
             moduleReport.module.name == name =>
        moduleReport.artifacts
    }
    .toSeq
    .flatten

  def ensureHasArtifact(org: String, name: String) =
    assert(
      artifacts(org, name).exists(_._2.getName.endsWith("-sources.jar")),
      s"$org:$name not found"
    )

  ensureHasArtifact("org.scala-lang", "scala-library")
  ensureHasArtifact("io.get-coursier", "coursier_" + scalaBinaryVersion.value)
  ensureHasArtifact("io.get-coursier", "sbt-coursier")
}

import Compatibility._

scalaVersion := appConfiguration.value.provider.scalaProvider.version

lazy val updateSbtClassifiersCheck = TaskKey[Unit]("updateSbtClassifiersCheck")

updateSbtClassifiersCheck := {

  val defaultModules = updateSbtClassifiers
    .value
    .configuration(Default)
    .map(_.modules)
    .getOrElse(Nil)

  val compileModules = updateSbtClassifiers
    .value
    .configuration(Compile)
    .map(_.modules)
    .getOrElse(Nil)

  def artifacts(org: String, name: String) =
    (defaultModules ++ compileModules)
      .map { m =>
        println(s"Found module $m")
        m
      }
      .collect {
        case moduleReport
          if moduleReport.module.organization == org &&
               moduleReport.module.name == name =>
          moduleReport.artifacts
      }
      .toSeq
      .flatten

  def ensureHasArtifact(org: String, name: String) =
    assert(
      artifacts(org, name).exists(_._2.getName.endsWith("-sources.jar")),
      s"$org:$name not found"
    )

  ensureHasArtifact("org.scala-lang", "scala-library")
  ensureHasArtifact("io.get-coursier", "coursier_" + scalaBinaryVersion.value)
  ensureHasArtifact("io.get-coursier", "sbt-coursier")
}

Fix sbt 1.0 scripted test

Fix sbt 1.0 scripted test


package ducttape

import collection._
import ducttape.hyperdag._

//import ducttape.hyperdag._

object Types {

  class HashMultiMap[A,B] extends mutable.HashMap[A,mutable.Set[B]] with mutable.MultiMap[A,B];

  class Task(val name: String,
             val comments: Seq[String],
             val commands: Seq[String]) {}

  class IOEdge(val files: Map[String,String],     // var -> absolute path
               val params: Map[String,String]) {} // var -> value

  class Branch(val name: String) {}

  class HyperWorkflow(val dag: PackedDag[Task,Branch,IOEdge]) {}
}

package ducttape

import collection._
import ducttape.hyperdag._

//import ducttape.hyperdag._

object Types {
  class HashMultiMap[A,B] extends mutable.HashMap[A,mutable.Set[B]] with mutable.MultiMap[A,B];
}

Move live implementation of workflow to workflow.scala


package com.github.ksoichiro.er

import japgolly.scalajs.react.vdom.prefix_<^._
import japgolly.scalajs.react.{ReactComponentB, ReactDOM}
import org.scalajs.dom.document

import scala.scalajs.js
import scalacss.Defaults._
import scalacss.ScalaCssReact._

object EntryPoint extends js.JSApp {
  def main() = {
    AppStyles.addToDocument()
    val HelloMessage = ReactComponentB[Unit]("")
      .render(_ => <.div(AppStyles.title, "Hello world"))
      .build
    ReactDOM.render(HelloMessage(""), document.getElementById("demo"))
  }
}

package com.github.ksoichiro.er

import japgolly.scalajs.react.vdom.prefix_<^._
import japgolly.scalajs.react.{ReactComponentB, ReactDOM}
import org.scalajs.dom.document

import scala.scalajs.js
import scalacss.Defaults._
import scalacss.ScalaCssReact._

object EntryPoint extends js.JSApp {
  def main() = {
    AppStyles.addToDocument()
    val HelloMessage = ReactComponentB[Unit]("")
      .render(_ => <.div(AppStyles.title, "Hello world"))
      .buildU
    ReactDOM.render(HelloMessage(), document.getElementById("demo"))
  }
}

Change build to buildU for no arg component.


package test

import scala.xml.NodeSeq

class Foo {
  def competitors() {
    List("foo", "bar") match {
      case Nil => Nil
      case competitors =>
        def bindCompetitors(): scala.xml.NodeSeq =
          competitors.flatMap { competitor =>
            val l: Int = competitor.length
            l.foo.toString
          }
        Nil
    }
  }
}

package test

class Foo {
  def competitors() {
    List("foo", "bar") match {
      case Nil => Nil
      case competitors =>
        def bindCompetitors(): List[Nothing] =
          competitors.flatMap { competitor =>
            val l: Int = competitor.length
            l.foo.toString
          }
        Nil
    }
  }
}

Remove unnecessary xml dependency from test


latestVersion in ThisBuild := "0.9.1"
latestBinaryCompatibleVersion in ThisBuild := Some("0.9.1")
unreleasedModuleNames in ThisBuild := Set()

latestVersion in ThisBuild := "0.9.2"
latestBinaryCompatibleVersion in ThisBuild := Some("0.9.2")
unreleasedModuleNames in ThisBuild := Set()

Set latest version to 0.9.2

Set latest version to 0.9.2


package com.lynbrookrobotics.potassium.events

import com.lynbrookrobotics.potassium.Clock
import squants.Time

case class EventPolling(clock: Clock, period: Time)

class ContinuousEvent(condition: => Boolean)(implicit polling: EventPolling) {
  val onStartSource = new ImpulseEventSource
  val onEndSource = new ImpulseEventSource

  val onStart = onStartSource.event
  val onEnd = onEndSource.event

  private var tickingCallbacks: List[() => Unit] = List.empty
  private var isRunning = false

  polling.clock(polling.period) { dt =>
    if (condition) {
      tickingCallbacks.foreach(_.apply())

      if (!isRunning) {
        onStartSource.fire()

        isRunning = true
      }
    } else if (isRunning) {
      onEndSource.fire()
      isRunning = false
    }
  }

  def foreach(onTicking: () => Unit): Unit = {
    tickingCallbacks = onTicking :: tickingCallbacks
  }
}

package com.lynbrookrobotics.potassium.events

import com.lynbrookrobotics.potassium.Clock
import com.lynbrookrobotics.potassium.tasks.{ContinuousTask, Task}
import squants.Time

case class EventPolling(clock: Clock, period: Time)

class ContinuousEvent(condition: => Boolean)(implicit polling: EventPolling) {
  val onStartSource = new ImpulseEventSource
  val onEndSource = new ImpulseEventSource

  val onStart = onStartSource.event
  val onEnd = onEndSource.event

  private var tickingCallbacks: List[() => Unit] = List.empty
  private var isRunning = false

  polling.clock(polling.period) { dt =>
    if (condition) {
      tickingCallbacks.foreach(_.apply())

      if (!isRunning) {
        onStartSource.fire()

        isRunning = true
      }
    } else if (isRunning) {
      onEndSource.fire()
      isRunning = false
    }
  }

  def foreach(onTicking: () => Unit): Unit = {
    tickingCallbacks = onTicking :: tickingCallbacks
  }

  def foreach(task: ContinuousTask): Unit = {
    onStart.foreach(() => Task.executeTask(task))
    onEnd.foreach(() => Task.abortTask(task))
  }
}

Add ability to trigger a continuous task from a continuous event


package mesosphere.marathon.integration

import java.io.File

import mesosphere.marathon.integration.setup.{ ProcessKeeper, IntegrationFunSuite }
import org.scalatest.{ GivenWhenThen, BeforeAndAfter, Matchers }

class MarathonCommandLineHelpTest
    extends IntegrationFunSuite
    with Matchers
    with BeforeAndAfter
    with GivenWhenThen {

  after {
    ProcessKeeper.stopAllProcesses()
  }

  test("marathon --help shouldn't crash") {
    val cwd = new File(".")
    val process = ProcessKeeper.startMarathon(
      cwd, env = Map.empty, arguments = List("--help"),
      startupLine = "--help                                      Show help message")
    assert(process.exitValue() == 0)
  }

}

package mesosphere.marathon.integration

import java.io.File

import mesosphere.marathon.integration.setup.{ ProcessKeeper, IntegrationFunSuite }
import org.scalatest.{ GivenWhenThen, BeforeAndAfter, Matchers }

class MarathonCommandLineHelpTest
    extends IntegrationFunSuite
    with Matchers
    with BeforeAndAfter
    with GivenWhenThen {

  after {
    ProcessKeeper.stopAllProcesses()
  }

  test("marathon --help shouldn't crash") {
    val cwd = new File(".")
    val process = ProcessKeeper.startMarathon(
      cwd, env = Map.empty, arguments = List("--help"),
      startupLine = "Show help message")
    assert(process.exitValue() == 0)
  }
}

Fix Integration that checks for help message: do not expect a certain amount of tab characters.


package org.scalajs.jasmine

import scala.scalajs.js
import java.util.regex.Pattern

trait JasmineExpectation extends js.Object {
  def toBe(exp: js.Any): Unit
  def toEqual(exp: js.Any): Unit
  def toMatch(exp: Pattern): Unit
  def toMatch(exp: String): Unit = toMatch(Pattern.compile(exp))
  def toBeDefined(): Unit
  def toBeUndefined(): Unit
  def toBeNull(): Unit
  def toBeTruthy(): Unit
  def toBeFalsy(): Unit
  def toContain(exp: js.Any): Unit
  def toBeGreaterThan(exp: Double): Unit
  def toBeLessThan(exp: Double): Unit
  def toBeCloseTo(exp: Double): Unit
  def toThrow(): Unit
  val not: JasmineExpectation
}

package org.scalajs.jasmine

import scala.scalajs.js
import java.util.regex.Pattern

trait JasmineExpectation extends js.Object {
  def toBe(exp: js.Any): Unit
  def toEqual(exp: js.Any): Unit
  def toMatch(exp: Pattern): Unit
  def toMatch(exp: String): Unit = toMatch(Pattern.compile(exp))
  def toBeDefined(): Unit
  def toBeUndefined(): Unit
  def toBeNull(): Unit
  def toBeTruthy(): Unit
  def toBeFalsy(): Unit
  def toContain(exp: js.Any): Unit
  def toBeGreaterThan(exp: Double): Unit
  def toBeLessThan(exp: Double): Unit
  def toBeCloseTo(exp: Double, precision: Int = 2): Unit
  def toThrow(): Unit
  val not: JasmineExpectation
}

Add optional argument to Jasmine's toBeCloseTo matcher


package uk.gov.digital.ho.proving.financialstatus.api

import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.{JsonSerializer, SerializerProvider}

class CustomSerializer extends JsonSerializer[BigDecimal] {

  override def serialize(value: BigDecimal , jgen: JsonGenerator, provider: SerializerProvider ) {
    // put your desired money style here
    jgen.writeString(value.setScale(2, BigDecimal.RoundingMode.HALF_UP).toString())
  }

}

package uk.gov.digital.ho.proving.financialstatus.api

import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.{JsonSerializer, SerializerProvider}

class CustomSerializer extends JsonSerializer[BigDecimal] {

  override def serialize(value: BigDecimal , jgen: JsonGenerator, provider: SerializerProvider ) {
    // Set the default BigDecimal serialization to 2 decimal places
    jgen.writeString(value.setScale(2, BigDecimal.RoundingMode.HALF_UP).toString())
  }

}

Add custome serializer for scala's BIgDecimal


package ccf.session

import scala.actors.Actor
import ccf.transport.Connection

class SessionActor(connection: Connection, clientId: ClientId, version: Version, session: Session) extends Actor {
  start
  def this(connection: Connection, clientId: ClientId, version: Version) = {
    this(connection, clientId, version, Session(connection, version, clientId, 0, Set()))
  }
  def act { loop(session) }
  private def loop(s: Session) { react {
    case msg: Message => {
      val nextSession = handleMessage(s, msg)
      loop(nextSession)
    }
    case Shutdown => exit
  }}
  private def handleMessage(session: Session, msg: Message): Session = session.send(msg) match {
    case (nextSession: Session, result: Either[Failure, Success]) => { sender ! result; nextSession }
  }
}

package ccf.session

import scala.actors.Actor
import ccf.transport.Connection

class SessionActor(connection: Connection, clientId: ClientId, version: Version, session: Session) extends Actor {
  start
  def this(connection: Connection, clientId: ClientId, version: Version) = {
    this(connection, clientId, version, Session(connection, version, clientId, 0, Set()))
  }
  def act { loop(session) }
  private def loop(s: Session) { react {
    case msg: Message => {
      val nextSession = handleMessage(s, msg)
      loop(nextSession)
    }
    case Shutdown => exit
  }}
  private def handleMessage(session: Session, msg: Message): Session = session.send(msg) match {
    case (nextSession: Session, result: Either[Failure, Success]) => {
      sender ! result
      nextSession
    }
  }
}

Split code to two lines for clarity

session: Split code to two lines for clarity

Style where ';' is used to put several lines of code into same line is
harder to read, especialle when we already have quite a long matcher in
the same line.

Signed-off-by: Aki Saarinen <2c8035bb80cf98a391872dcbe797b269d759f6d9@reaktor.fi>


/*
 * Copyright 2013-2020 http4s.org
 *
 * SPDX-License-Identifier: Apache-2.0
 */

package org.http4s.client.asynchttpclient

import java.util.concurrent.atomic.AtomicInteger
import _root_.io.netty.handler.codec.http.cookie.Cookie
import org.asynchttpclient.cookie.CookieStore
import org.asynchttpclient.uri.Uri

private[asynchttpclient] class NoOpCookieStore extends CookieStore {
  private def empty: java.util.List[Cookie] = java.util.Collections.emptyList[Cookie]

  override def add(uri: Uri, cookie: Cookie): Unit = ()
  override def get(uri: Uri): java.util.List[Cookie] = empty
  override def getAll(): java.util.List[Cookie] = empty
  override def remove(pred: java.util.function.Predicate[Cookie]): Boolean = false
  override def clear(): Boolean = false
  override def evictExpired(): Unit = ()

  private val counter = new AtomicInteger(0)
  override def count(): Int = counter.get
  override def decrementAndGet(): Int = counter.decrementAndGet()
  override def incrementAndGet(): Int = counter.incrementAndGet()
}

Add missing header from merge

Add missing header from merge


import sbt._
import Keys._

object Settings {
  lazy val organizationName: String = "com.busymachines"

  lazy val bmCommonsHomepage: String = "https://github.com/busymachines/busymachines-commons"

  def commonSettings: Seq[Setting[_]] =
    Seq(
      organization in ThisBuild := organizationName,
      homepage := Some(url(bmCommonsHomepage)),
      scalaVersion := Dependencies.mainScalaVersion,
      //      crossScalaVersions := Dependencies.seqOfCrossScalaVersions
    ) ++ scalaCompilerSettings

  def scalaCompilerSettings: Seq[Setting[_]] = Seq(
    scalacOptions ++= Seq(
      "-Ywarn-unused-import",
      "-Ypartial-unification",
      "-deprecation"
    )
  )
}

import sbt._
import Keys._

object Settings {
  lazy val organizationName: String = "com.busymachines"

  lazy val bmCommonsHomepage: String = "https://github.com/busymachines/busymachines-commons"

  def commonSettings: Seq[Setting[_]] =
    Seq(
      organization in ThisBuild := organizationName,
      homepage := Some(url(bmCommonsHomepage)),
      scalaVersion := Dependencies.mainScalaVersion,
      //      crossScalaVersions := Dependencies.seqOfCrossScalaVersions,

      /**
        * akka http is binary compatible both with 2.5.4 (which we have), but it is openly dependent on 2.4.19
        * that's why we can safely force our version in order to avoid those super annoying eviction warnings
        */
      dependencyOverrides += Dependencies.akkaStream,
      dependencyOverrides += Dependencies.akkaActor,
    ) ++ scalaCompilerSettings

  def scalaCompilerSettings: Seq[Setting[_]] = Seq(
    scalacOptions ++= Seq(
      "-Ywarn-unused-import",
      "-Ypartial-unification",
      "-deprecation"
    )
  )
}

Add dependency overrides to akka 2.5.X so that sbt doesn't issue false warnings


package bad.robot.temperature

import java.io.File
import java.net.InetAddress

import bad.robot.temperature.TemperatureMachineThreadFactory._
import bad.robot.temperature.ds18b20.SensorFile._
import bad.robot.temperature.ds18b20.{SensorFile, SensorReader}
import bad.robot.temperature.rrd.{Rrd, RrdFile}
import bad.robot.temperature.server.Server

import scala.concurrent.duration._
import scala.language.postfixOps

object Main extends App {

  val Port = 11900

  SensorFile.find().headOption match {
    case Some(file) => start(file)
    case _          => println(FailedToFindFile(BaseFolder).message)
  }

  private def start(file: File) = {
    print("RRD initialising...")
    if (!RrdFile.exists) RrdFile(30 seconds).create() else println("Ok")

    print("Starting monitoring...")
    Scheduler(30 seconds, createThreadPool("reading-thread")).start(Measurement(SensorReader(file), Rrd()))
    Scheduler(90 seconds, createThreadPool("graphing-thread")).start(GenerateGraph(Duration(24, "hours")))
    Scheduler(100 seconds, createThreadPool("xml-export-thread")).start(XmlExport(Duration(24, "hours")))
    println("Ok")

    println(s"Server started on http://${InetAddress.getLocalHost.getHostAddress}:$Port")
    Server(Port).start()
  }
}

package bad.robot.temperature

import java.io.File
import java.net.InetAddress

import bad.robot.temperature.TemperatureMachineThreadFactory._
import bad.robot.temperature.ds18b20.SensorFile._
import bad.robot.temperature.ds18b20.{SensorFile, SensorReader}
import bad.robot.temperature.rrd.{Rrd, RrdFile}
import bad.robot.temperature.server.Server

import scala.concurrent.duration._
import scala.language.postfixOps

object Main extends App {

  val Port = 11900

  val location = sys.props.getOrElse("sensor.location", BaseFolder)

  SensorFile.find(location).headOption match {
    case Some(file) => start(file)
    case _          => println(FailedToFindFile(location).message)
  }

  private def start(file: File) = {
    print("RRD initialising...")
    if (!RrdFile.exists) RrdFile(30 seconds).create() else println("Ok")

    print("Starting monitoring...")
    Scheduler(30 seconds, createThreadPool("reading-thread")).start(Measurement(SensorReader(file), Rrd()))
    Scheduler(90 seconds, createThreadPool("graphing-thread")).start(GenerateGraph(Duration(24, "hours")))
    Scheduler(100 seconds, createThreadPool("xml-export-thread")).start(XmlExport(Duration(24, "hours")))
    println("Ok")

    println(s"Server started on http://${InetAddress.getLocalHost.getHostAddress}:$Port")
    Server(Port).start()
  }
}

Set system property for the location of the sensor files. Easier when running locally (without a sensor)


import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {

  // Add ScalaToolsSnapshots
  lazy val snapshots = ScalaToolsSnapshots

  // Add plugin
  lazy val liftsbt = "net.liftweb" % "lift-sbt" % "2.4-SNAPSHOT"
  lazy val bnd4sbt = "com.weiglewilczek.bnd4sbt" % "bnd4sbt" % "1.0.2"
}

import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {

  // Add ScalaToolsSnapshots
  lazy val snapshots = ScalaToolsSnapshots

  // Add plugin
  lazy val liftsbt = "net.liftweb" % "lift-sbt" % "2.5-SNAPSHOT"
  lazy val bnd4sbt = "com.weiglewilczek.bnd4sbt" % "bnd4sbt" % "1.0.2"
}

Update to use 2.5-SNAPSHOT of lift-sbt plugin


package tests
package objectSignatures

class A[T]
{
  val a: String = "asd"
  def method3() = "asd"
}

object A

trait C

object Base

object A2 extends A[String] with C

// We are not going to add final below
// final object B

package tests
package objectSignatures

class A[T]
{
  val a: String = "asd"
  def method3() = "asd"
}

object A

trait C

object Base

object A2 extends A[String] with C

object <

object >

// We are not going to add final below
// final object B

Add testcases to check uniqueness of page links for symbols with special characters


import sbt._, Keys._

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

  val specs2Dep = Def.setting {
    "org.specs2" %% "specs2-core" % "4.16.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.9"
  val nettyVersion = "4.1.77.Final"
  val scalatestVersion = "3.2.12"
  val scalatestScalacheckVersion = s"${scalatestVersion}.0"
  val json4sVersion = "4.0.5"
  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.16.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.9"
  val nettyVersion = "4.1.78.Final"
  val scalatestVersion = "3.2.12"
  val scalatestScalacheckVersion = s"${scalatestVersion}.0"
  val json4sVersion = "4.0.5"
  val asyncHttpClientVersion = "1.8.17"
  val javaxActivationVersion = "1.1.1"
}

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


import com.google.appengine.api.datastore.dev.LocalDatastoreService
import com.google.appengine.tools.development.ApiProxyLocalImpl
import com.google.apphosting.api.ApiProxy
import com.google.apphosting.api.ApiProxy.Environment
import java.io.File

object DatastoreService {
	class GaeEnvironment(private val requestNamespace:String) extends Environment {
		def this() = this("")
		def getAppId = "Quotidian Specs"
		def getVersionId = "1.0"
		def getRequestNamespace = requestNamespace
		def getAuthDomain = "gmail.com"
		def isLoggedIn = throw new UnsupportedOperationException()
		def getEmail = ""
		def isAdmin = throw new UnsupportedOperationException()
		def getAttributes = new java.util.HashMap[String,Object]()
	}
	val proxy = new ApiProxyLocalImpl(new File("./target/")){ }
	val service = proxy.getService("datastore_v3").asInstanceOf[LocalDatastoreService]
	def start = {
		proxy.setProperty(LocalDatastoreService.NO_STORAGE_PROPERTY,true.toString)
		ApiProxy.setEnvironmentForCurrentThread(new GaeEnvironment)
		ApiProxy.setDelegate(proxy)
	}
	def stop = {
		service.clearProfiles
		proxy.stop
		service.stop
		ApiProxy.setDelegate(null)
		ApiProxy.setEnvironmentForCurrentThread(null)
		ApiProxy.clearEnvironmentForCurrentThread()
	}
}

import com.google.appengine.api.datastore.dev.LocalDatastoreService
import com.google.appengine.tools.development.ApiProxyLocalImpl
import com.google.apphosting.api.ApiProxy
import com.google.apphosting.api.ApiProxy.Environment
import java.io.File
import java.util.zip.{Checksum,CRC32}
import org.apache.lucene.index._
import org.apache.lucene.store._
import quotidian.search._

object DatastoreService {
	class GaeEnvironment(private val requestNamespace:String) extends Environment {
		def this() = this("")
		def getAppId = "Quotidian Specs"
		def getVersionId = "1.0"
		def getRequestNamespace = requestNamespace
		def getAuthDomain = "gmail.com"
		def isLoggedIn = throw new UnsupportedOperationException()
		def getEmail = ""
		def isAdmin = throw new UnsupportedOperationException()
		def getAttributes = new java.util.HashMap[String,Object]()
	}
	val proxy = new ApiProxyLocalImpl(new File("./target/")){ }
	val service = proxy.getService("datastore_v3").asInstanceOf[LocalDatastoreService]
	def start = {
		proxy.setProperty(LocalDatastoreService.NO_STORAGE_PROPERTY,true.toString)
		ApiProxy.setEnvironmentForCurrentThread(new GaeEnvironment)
		ApiProxy.setDelegate(proxy)
	}
	def stop = {
		service.clearProfiles
		proxy.stop
		service.stop
		ApiProxy.setDelegate(null)
		ApiProxy.setEnvironmentForCurrentThread(null)
		ApiProxy.clearEnvironmentForCurrentThread()
	}
}

Add lucene and checksum packages to imports


androidBuildAar

githubProject := "toolbelt"

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

libraryDependencies ++=
    "com.android.support" % "recyclerview-v7" % "23.2.1" ::
    "com.android.support" % "support-v4" % "23.2.1" ::
    "com.android.support" % "support-v13" % "23.2.1" ::
    Nil

minSdkVersion := "13"

name := "Toolbelt"

organization := "io.taig.android"

platformTarget := "android-23"

publishArtifact in ( Compile, packageDoc ) := false

scalaVersion := "2.11.8"

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

targetSdkVersion := "23"

typedResources := false

version := "0.4.6"

androidBuildAar

githubProject := "toolbelt"

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

libraryDependencies ++=
    "com.android.support" % "recyclerview-v7" % "23.3.0" ::
    "com.android.support" % "support-v4" % "23.3.0" ::
    "com.android.support" % "support-v13" % "23.3.0" ::
    Nil

minSdkVersion := "13"

name := "Toolbelt"

organization := "io.taig.android"

platformTarget := "android-23"

publishArtifact in ( Compile, packageDoc ) := false

scalaVersion := "2.11.8"

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

targetSdkVersion := "23"

typedResources := false

version := "0.4.6"

Upgrade to android support library 23.3.0


sbtPlugin := true

organization := "com.theomn.sbt"

name := "sbt-babeljs"

version := "1.0.0-SNAPSHOT"

scalaVersion := "2.10.5"

libraryDependencies ++= Seq(
  "com.typesafe" % "jstranspiler" % "1.0.0",
  "org.webjars" % "mkdirp" % "0.3.5",
  "org.webjars" % "when-node" % "3.2.2",
  "org.webjars" % "babel" % "4.7.16-1-SNAPSHOT"
)

resolvers ++= Seq(
  "Typesafe Releases Repository" at "http://repo.typesafe.com/typesafe/releases/",
  Resolver.url("sbt snapshot plugins", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns),
  Resolver.sonatypeRepo("snapshots"),
  "Typesafe Snapshots Repository" at "http://repo.typesafe.com/typesafe/snapshots/",
  Resolver.mavenLocal
)

addSbtPlugin("com.typesafe.sbt" %% "sbt-js-engine" % "1.0.2")

publishMavenStyle := false

publishTo := {
  if (isSnapshot.value) Some(Classpaths.sbtPluginSnapshots)
  else Some(Classpaths.sbtPluginReleases)
}

scriptedSettings

scriptedLaunchOpts <+= version apply { v => s"-Dproject.version=$v" }

sbtPlugin := true

organization := "com.theomn.sbt"

name := "sbt-babeljs"

version := "1.0.0-SNAPSHOT"

scalaVersion := "2.10.5"

libraryDependencies ++= Seq(
  "com.typesafe" % "jstranspiler" % "1.0.0",
  "org.webjars"  % "mkdirp" % "0.3.5",
  "org.webjars"  % "when-node" % "3.2.2",
  "org.webjars"  % "babel" % "4.7.16-1-SNAPSHOT"
)

resolvers ++= Seq(
  "Typesafe Releases Repository" at "https://repo.typesafe.com/typesafe/maven-releases/"
)

addSbtPlugin("com.typesafe.sbt" %% "sbt-js-engine" % "1.1.2")

publishMavenStyle := false

publishTo := {
  if (isSnapshot.value) Some(Classpaths.sbtPluginSnapshots)
  else Some(Classpaths.sbtPluginReleases)
}

scriptedSettings

scriptedLaunchOpts <+= version apply { v => s"-Dproject.version=$v" }

Upgrade to sbt js engine 1.1.2

Upgrade to sbt js engine 1.1.2


import sbt.Keys._
import ReleaseTransformations._

lazy val root = (project in file(".")).
  settings(
    name := "units-of-information",
    version := "0.1",
    scalaVersion := "2.11.8",
    scalacOptions in Test ++= Seq("-Yrangepos"),
    autoAPIMappings := true,
    exportJars := true,
    libraryDependencies += "org.specs2" %% "specs2-core" % "3.8.5" % Test,
    publishTo := {
      val nexus = "https://repo.randm.ch/repository/maven-"
      if (isSnapshot.value)
        Some("snapshots" at nexus + "snapshots")
      else
        Some("releases"  at nexus + "releases")
    }
  )

import sbt.Keys._
import ReleaseTransformations._

lazy val root = (project in file(".")).
  settings(
    name := "units-of-information",
    version := "0.1",
    scalaVersion := "2.11.8",
    scalacOptions in Test ++= Seq("-Yrangepos"),
    autoAPIMappings := true,
    exportJars := true,
    libraryDependencies += "org.specs2" %% "specs2-core" % "3.8.5" % Test,
    publishTo := {
      val nexus = "https://repo.randm.ch/repository/maven-"
      if (isSnapshot.value)
        Some("snapshots" at nexus + "snapshots")
      else
        Some("releases"  at nexus + "releases")
    },
    credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
  )

Add credentials for publishing to Maven repository


name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

version := "0.3.8"

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

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

name := "apibuilder-validation"

organization := "io.flow"

scalaVersion in ThisBuild := "2.12.8"

crossScalaVersions := Seq("2.12.8")

version := "0.3.9"

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

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

autocommit: Update configuration to record version 0.3.9


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

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

autocommit: Update configuration to record version 0.1.40


name              := "system-testing"

version           := "0.3.0-SNAPSHOT"

organization      := "edu.nus"

scalaVersion      := "2.10.5"

publishMavenStyle := true

libraryDependencies += "org.scalatest" % "scalatest_2.10" % "2.2.4" % "test"

libraryDependencies += "com.typesafe" % "config" % "1.2.1"

libraryDependencies += "io.argonaut" %% "argonaut" % "6.0.4"

libraryDependencies += "joda-time" % "joda-time" % "2.8.2"

libraryDependencies += "com.github.scopt" %% "scopt" % "3.3.0"

resolvers += Resolver.sonatypeRepo("public")

Add scopt from Sonatype, for processing command line options


enablePlugins( AndroidLib )

autoScalaLibrary := false

githubProject := "donut-progress"

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

libraryDependencies ++=
    "com.android.support" % "appcompat-v7" % "25.1.0" ::
    Nil

minSdkVersion := "7"

name := "donut-progress"

organization := "io.taig.android"

platformTarget := "android-24"

publishArtifact in ( Compile, packageDoc ) := false

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

targetSdkVersion := "24"

typedResources := false

version := "1.0.10"

enablePlugins( AndroidLib )

autoScalaLibrary := false

githubProject := "donut-progress"

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

libraryDependencies ++=
    "com.android.support" % "appcompat-v7" % "27.1.1" ::
    Nil

minSdkVersion := "7"

name := "donut-progress"

organization := "io.taig.android"

platformTarget := "android-27"

publishArtifact in ( Compile, packageDoc ) := false

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

targetSdkVersion := "27"

typedResources := false

version := "1.0.10"

Upgrade to android platform 27

Upgrade to android platform 27


import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

version := "0.0.3"

exportJars := true

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

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

import com.github.retronym.SbtOneJar._

oneJarSettings

name := "api-lint"

organization := "io.flow"

scalaVersion in ThisBuild := "2.11.7"

version := "0.0.3"

exportJars := true

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

Upgrade org.scalatest.scalatest from 2.2.5 => 2.2.6


package uk.ac.wellcome.finatra.messaging

import com.google.inject.Provides
import com.twitter.inject.TwitterModule
import javax.inject.Singleton
import uk.ac.wellcome.messaging.sqs.SQSConfig

import scala.concurrent.duration._

object SQSConfigModule extends TwitterModule {
  private val queueUrl =
    flag[String]("aws.sqs.queue.url", "", "URL of the SQS Queue")
  val waitTime = flag(
    "aws.sqs.waitTime",
    20,
    "Time to wait (in seconds) for a message to arrive on the queue before returning")
  val maxMessages =
    flag("aws.sqs.maxMessages", 10, "Maximum number of SQS messages to return")

  @Singleton
  @Provides
  def providesSQSConfig(): SQSConfig =
    SQSConfig(queueUrl(), waitTime() seconds, maxMessages())
}

package uk.ac.wellcome.finatra.messaging

import com.google.inject.Provides
import com.twitter.inject.TwitterModule
import javax.inject.Singleton
import uk.ac.wellcome.messaging.sqs.SQSConfig

import scala.concurrent.duration._

object SQSConfigModule extends TwitterModule {
  private val queueUrl =
    flag[String]("aws.sqs.queue.url", "", "URL of the SQS Queue")
  val waitTime = flag(
    "aws.sqs.waitTime",
    20,
    "Time to wait (in seconds) for a message to arrive on the queue before returning")
  val maxMessages =
    flag("aws.sqs.maxMessages", 10, "Maximum number of SQS messages to return")

  val parallelism =
    flag("aws.sqs.parallelism", 10, "Number of messages to process in parallel")

  @Singleton
  @Provides
  def providesSQSConfig(): SQSConfig =
    SQSConfig(queueUrl(), waitTime() seconds, maxMessages(), parallelism())
}

Add parallelism flag for sqs config

Add parallelism flag for sqs config


package org.broadinstitute.sting.queue.function.scattergather

import java.io.File
import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline.{Output, Input}

class CreateTempDirsFunction extends CommandLineFunction {
  @Input(doc="Original inputs to the scattered function")
  var originalInputs: Set[Any] = Set.empty[Any]

  @Output(doc="Temporary directories to create")
  var tempDirectories: List[File] = Nil

  def commandLine = "mkdir%s".format(repeat(" '", tempDirectories, "'"))
}

package org.broadinstitute.sting.queue.function.scattergather

import java.io.File
import org.broadinstitute.sting.queue.function.CommandLineFunction
import org.broadinstitute.sting.commandline.{Output, Input}

class CreateTempDirsFunction extends CommandLineFunction {
  @Input(doc="Original inputs to the scattered function")
  var originalInputs: Set[Any] = Set.empty[Any]

  @Output(doc="Temporary directories to create")
  var tempDirectories: List[File] = Nil

  def commandLine = "mkdir -pv%s".format(repeat(" '", tempDirectories, "'"))
}

Create intermediate directories and don't error if the directory already exists.

git-svn-id: 4561c0a8f080806b19201efb9525134c00b76d40@3899 348d0f76-0448-11de-a6fe-93d51630548a


package core.interceptor

import common.Logger
import core.guice.injection.Injecting.injector
import javax.inject.Inject
import org.aopalliance.intercept.{MethodInterceptor, MethodInvocation}

import scala.concurrent.Await
import scala.concurrent.duration.Duration.Inf

class InterceptorService @Inject() extends MethodInterceptor with Logger {
  override def invoke(invocation: MethodInvocation): AnyRef = {
    val classesAndArgs = invocation.getMethod.getParameterAnnotations.flatMap(_.zipWithIndex.flatMap {
      case (annotation, index) =>
        annotation.asInstanceOf[InterceptorArg].classes.flatMap {
          clazz =>
            List[(Class[_], Int)]((clazz, index))
        }
    }).toList
    val args = invocation.getArguments
    for (classAndArg <- classesAndArgs) {
      val (clazz, argIndex) = classAndArg
      log.debug(s"Handle $clazz with argument index $argIndex")
      Await.result(
        injector.getInstance(clazz).asInstanceOf[Interceptor[AnyRef, AnyRef]].handle(args(argIndex)),
        Inf
      ) match {
        case Left(error) =>
          log.debug(s"Handled with error: $error")
          return error
        case Right(value) =>
          log.debug(s"Handled with value: $value")
          value.foreach(args(argIndex) = _)
      }
    }
    log.debug(s"Proceed to the next interceptor in the chain")
    invocation.proceed()
  }
}

package core.interceptor

import common.Logger
import core.guice.injection.Injecting.injector
import javax.inject.Inject
import org.aopalliance.intercept.{MethodInterceptor, MethodInvocation}

import scala.concurrent.Await
import scala.concurrent.duration.Duration.Inf

class InterceptorService @Inject() extends MethodInterceptor with Logger {
  override def invoke(invocation: MethodInvocation): AnyRef = {
    val classesAndArgs = invocation.getMethod.getParameterAnnotations.flatMap(_.zipWithIndex.flatMap {
      case (annotation, index) =>
        annotation.asInstanceOf[InterceptorArg].classes.flatMap {
          clazz =>
            List[(Class[_], Int)]((clazz, index))
        }
    }).toList
    val args = invocation.getArguments
    for (classAndArg <- classesAndArgs) {
      val (clazz, argIndex) = classAndArg
      log.debug(s"Handle $clazz with argument index $argIndex")
      Await.result(
        injector.getInstance(clazz).asInstanceOf[Interceptor[AnyRef, AnyRef]].handle(args(argIndex)),
        Inf
      ) match {
        case Left(result) =>
          log.debug(s"Handled with result: $result")
          return result
        case Right(arg) =>
          log.debug(s"Handled with arg: $arg")
          arg.foreach(args(argIndex) = _)
      }
    }
    log.debug(s"Proceed to the next interceptor in the chain")
    invocation.proceed()
  }
}

Rename Either result according to Interceptor trait


/*
 * Copyright (C) 2011 Romain Reuillon
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.openmole.misc.tools.io

import collection.JavaConversions._

object Prettifier {

  implicit def objectPrettifer(o: Any) = new {
    def prettify = Prettifier.prettify(o)
  }

  def prettify(o: Any): String =
    o match {
      case null ⇒ "null"
      case o: Array[_] ⇒ "[" + o.map { prettify }.mkString(", ") + "]"
      case o: Iterable[_] ⇒ "[" + o.map { prettify }.mkString(", ") + "]"
      case o: java.lang.Iterable[_] ⇒ "[" + o.map { prettify }.mkString(", ") + "]"
      case o ⇒ o.toString
    }
}

/*
 * Copyright (C) 2011 Romain Reuillon
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.openmole.misc.tools.io

import collection.JavaConversions._

object Prettifier extends Logger {

  implicit def objectPrettifer(o: Any) = new {
    def prettify = Prettifier.prettify(o)
  }

  def prettify(o: Any): String =
    try o match {
      case null ⇒ "null"
      case o: Array[_] ⇒ "[" + o.map { prettify }.mkString(", ") + "]"
      case o: Iterable[_] ⇒ "[" + o.map { prettify }.mkString(", ") + "]"
      case o: java.lang.Iterable[_] ⇒ "[" + o.map { prettify }.mkString(", ") + "]"
      case o ⇒ o.toString
    } catch {
      case t: Throwable =>
        logger.log(WARNING, "Error durring pretification", t)
        o.toString
    }
}

Return to string in case of exception durring pretification.


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

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

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

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

Set project version to 0.1.12-BETA

Set project version to 0.1.12-BETA


addSbtPlugin("com.nrinaudo"       % "kantan.sbt-kantan"  % "2.7.1")
addSbtPlugin("com.nrinaudo"       % "kantan.sbt-scalajs" % "2.7.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh"            % "0.4.0")

addSbtPlugin("com.nrinaudo"       % "kantan.sbt-kantan"  % "2.7.3")
addSbtPlugin("com.nrinaudo"       % "kantan.sbt-scalajs" % "2.7.3")
addSbtPlugin("pl.project13.scala" % "sbt-jmh"            % "0.4.0")

Update kantan.sbt-kantan, ... to 2.7.3

Update kantan.sbt-kantan, ... to 2.7.3


import sbt._
import Keys._
import sbtassembly.AssemblyKeys._
import sbtassembly._

object LSpaceBuild extends Build{
  val lSpaceConfigPath = Option(System.getProperty("LSPACE_CONFIG_PATH"))
    .getOrElse("/etc/lspace/")

  lazy val scalaSettings = Seq(
    scalaVersion := "2.11.7",
    version := "0.0.1-WORKSHOP",
    scalacOptions ++= Seq("-Xlint", "-deprecation", "-Xfatal-warnings"),
    libraryDependencies ++= Seq(
      "org.specs2" %% "specs2-core" % "3.7" % "test",
      "org.scalacheck" %% "scalacheck" % "1.13.0" % "test"
    ),
    scalacOptions in Test ++= Seq("-Yrangepos")
  )

  assemblyMergeStrategy in assembly := {
    case x if x.endsWith("project.clj") => MergeStrategy.discard // Leiningen build files
    case x if x.toLowerCase.startsWith("meta-inf") => MergeStrategy.discard // More bumf
    case _ => MergeStrategy.first
  }

  Resolver.sonatypeRepo("public")

  lazy val l_space = project
    .settings(scalaSettings: _*)

  lazy val root = (project in file("."))
    .aggregate(l_space)
}

import sbt._
import Keys._
import sbtassembly.AssemblyKeys._
import sbtassembly._

object ApplicationBuild extends Build {
  override lazy val settings = super.settings ++ Seq(
    scalaVersion := "2.11.7"
  )
}

object LSpaceBuild extends Build{
  val lSpaceConfigPath = Option(System.getProperty("LSPACE_CONFIG_PATH"))
    .getOrElse("/etc/lspace/")

  lazy val scalaSettings = Seq(
    scalaVersion := "2.11.7",
    version := "0.0.1-WORKSHOP",
    scalacOptions ++= Seq("-Xlint", "-deprecation", "-Xfatal-warnings"),
    libraryDependencies ++= Seq(
      "org.specs2" %% "specs2-core" % "3.7" % "test",
      "org.scalacheck" %% "scalacheck" % "1.13.0" % "test"
    ),
    scalacOptions in Test ++= Seq("-Yrangepos")
  )

  assemblyMergeStrategy in assembly := {
    case x if x.endsWith("project.clj") => MergeStrategy.discard // Leiningen build files
    case x if x.toLowerCase.startsWith("meta-inf") => MergeStrategy.discard // More bumf
    case _ => MergeStrategy.first
  }

  Resolver.sonatypeRepo("public")

  lazy val l_space = project
    .settings(scalaSettings: _*)

  lazy val root = (project in file("."))
    .aggregate(l_space)
}

Fix global scala version -________-

Fix global scala version -________-


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

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

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

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

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

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

// Build fat JAR file
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")

// Check vulnerabilities in JAR's
addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "4.0.0")

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

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

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

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

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

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

// Build fat JAR file
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")

// Check vulnerabilities in JAR's
addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "4.0.0")

Update sbt-wartremover, wartremover to 2.4.20


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

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

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

libraryDependencies += "net.databinder" %% "dispatch-http" % "0.8.10"

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

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

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

libraryDependencies += "net.databinder" %% "dispatch-http" % "0.8.10"

Bump to latest ghpages and newer jekyll integration.


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

resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.8.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.0")

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

resolvers += Classpaths.sbtPluginReleases

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

Add coursier plugin to speed up build

Add coursier plugin to speed up build

Summary: Problem/Solution:

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

Result:

Build time down to 40 mins on average now.

JIRA Issues: CSL-4742

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


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

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

Update sbt-wartremover, wartremover to 2.4.15


package tifmo.document

import tifmo.dcstree.Relation

object RelQuantifierAFew
  extends Relation
  with RelUpUpEntailing
  with RelWithNonEmptyIntersection
  with RelConservative

package tifmo.document

import tifmo.dcstree.Relation

case object RelQuantifierAFew
  extends Relation
  with RelUpUpEntailing
  with RelWithNonEmptyIntersection
  with RelConservative

Change RelQuantifierFew to a case class

Change RelQuantifierFew to a case class

Former-commit-id: 69ee331f19b7c03a55f526f342b9d9c2e511fff0


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

libraryDependencies ++= Seq(
  "org.webjars.bower" % "bootstrap-sass" % "3.3.6",
  "org.webjars" %% "webjars-play" % "2.6.2"
)

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

lazy val playVersion = settingKey[String]("Play version in relation to current Scala Version")

playVersion := {
  CrossVersion.partialVersion(scalaVersion.value) match {
    case Some((2, 10)) => "2.4.0-2"
    case Some((2, n)) if n > 10 => "2.6.2"
  }
}

libraryDependencies ++= Seq(
  "org.webjars.bower" % "bootstrap-sass" % "3.3.6",
  "org.webjars" %% "webjars-play" % playVersion.value
)

Determine Play's version depending on Scala Version


package de.fuberlin.wiwiss.silk.workbench.lift.comet

import de.fuberlin.wiwiss.silk.workbench.learning.CurrentLearningTask
import de.fuberlin.wiwiss.silk.util.task.{Finished, Started, Status}
import de.fuberlin.wiwiss.silk.workbench.workspace.CurrentStatusListener
import de.fuberlin.wiwiss.silk.workbench.lift.snippet.StartLearningDialog
import de.fuberlin.wiwiss.silk.workbench.lift.util.{JS, DynamicButton}

/**
 * Button to control the learning process.
 */
class StartLearningButton extends DynamicButton {

  override protected val dontCacheRendering = true

  label = "Start"

  /**
   * Called when the button has been pressed.
   */
  override protected def onPressed() = {
    //TODO check if cache is being loaded

    if (!CurrentLearningTask().status.isRunning)
      StartLearningDialog.openCmd
    else {
      CurrentLearningTask().cancel()
      JS.Empty
    }
  }

  /**
   * Listens to changes of the current learning task.
   */
  private val learningTaskListener = new CurrentStatusListener(CurrentLearningTask) {
    override def onUpdate(status: Status) {
      status match {
        case _: Started => label = "Stop"
        case _: Finished => label = "Start"
        case _ =>
      }
    }
  }
}

package de.fuberlin.wiwiss.silk.workbench.lift.comet

import de.fuberlin.wiwiss.silk.workbench.learning.CurrentLearningTask
import de.fuberlin.wiwiss.silk.util.task.{Finished, Started, Status}
import de.fuberlin.wiwiss.silk.workbench.lift.snippet.StartLearningDialog
import de.fuberlin.wiwiss.silk.workbench.lift.util.{JS, DynamicButton}
import de.fuberlin.wiwiss.silk.workbench.workspace.{User, CurrentStatusListener}

/**
 * Button to control the learning process.
 */
class StartLearningButton extends DynamicButton {

  override protected val dontCacheRendering = true

  label = "Start"

  /**
   * Called when the button has been pressed.
   */
  override protected def onPressed() = {
    if(User().linkingTask.cache.status.isRunning) {
      JS.Message("Cache not loaded yet.")
    } else if(User().linkingTask.alignment.positive.size < 1 || User().linkingTask.alignment.negative.size < 1) {
      JS.Message("Positive and negative reference links are needed in order to learn a link specification")
    } else if (!CurrentLearningTask().status.isRunning)
      StartLearningDialog.openCmd
    else {
      CurrentLearningTask().cancel()
      JS.Empty
    }
  }

  /**
   * Listens to changes of the current learning task.
   */
  private val learningTaskListener = new CurrentStatusListener(CurrentLearningTask) {
    override def onUpdate(status: Status) {
      status match {
        case _: Started => label = "Stop"
        case _: Finished => label = "Start"
        case _ =>
      }
    }
  }
}

Learning: Check if cache is loaded and reference links are present before starting


package ophir.model

/** A value parameter to a function. */
case class ValueParam(

  /** Variable name */
  name: String

  /** The type of this value parameter. */
  , resultType: TypeEntity

  /** The devault value of this value parameter, if it has been defined. */
  , defaultValue: Option[String]

  /** Whether this value parameter is implicit. */
  , isImplicit: Boolean

) {

  /** The human-readable representation of this param. */
  override def toString = (
    if (isImplicit) "implicit " else ""
  ) + name + ": " + resultType.toString + (defaultValue match {
    case Some(dv) => " = " + dv
    case None => ""
  })
}

case class ValueParams(
  params: List[ValueParam]
) {
  override def toString = params map (_.toString) mkString ("(", ", ", ")")
}

package ophir.model

/** A value parameter to a function. */
case class ValueParam(

  /** Variable name */
  name: String

  /** The type of this value parameter. */
  , resultType: TypeEntity

  /** The devault value of this value parameter, if it has been defined. */
  , defaultValue: Option[String]

  /** Whether this value parameter is implicit. */
  , isImplicit: Boolean

) {

  /** The human-readable representation of this param. */
  override def toString = (
    if (isImplicit) "implicit " else ""
  ) + name + ": " + resultType.toString + (defaultValue match {
    case Some(dv) => " = " + dv
    case None => ""
  })
}

case class ValueParams(
  params: List[ValueParam]
) {

  def isEmpty = params.isEmpty

  override def toString =
    if (params.size > 0) params map (_.toString) mkString ("(", ", ", ")")
    else ""
}

Fix functions with empty value params (properties)


package xsbti

	import java.io.File
	import scala.collection.mutable.ArrayBuffer

class TestCallback extends AnalysisCallback
{
	val sourceDependencies = new ArrayBuffer[(File, File, Boolean)]
	val binaryDependencies = new ArrayBuffer[(File, String, File, Boolean)]
	val products = new ArrayBuffer[(File, File, String)]
	val apis = new ArrayBuffer[(File, xsbti.api.SourceAPI)]

	def sourceDependency(dependsOn: File, source: File, inherited: Boolean) { sourceDependencies += ((dependsOn, source, inherited)) }
	def binaryDependency(binary: File, name: String, source: File, inherited: Boolean) { binaryDependencies += ((binary, name, source, inherited)) }
	def generatedClass(source: File, module: File, name: String) { products += ((source, module, name)) }

	def api(source: File, sourceAPI: xsbti.api.SourceAPI) { apis += ((source, sourceAPI)) }
	def problem(category: String, pos: xsbti.Position, message: String, severity: xsbti.Severity, reported: Boolean) {}
}

package xsbti

import java.io.File
import scala.collection.mutable.ArrayBuffer
import xsbti.api.SourceAPI

class TestCallback extends AnalysisCallback
{
	val sourceDependencies = new ArrayBuffer[(File, File, Boolean)]
	val binaryDependencies = new ArrayBuffer[(File, String, File, Boolean)]
	val products = new ArrayBuffer[(File, File, String)]
	val apis: scala.collection.mutable.Map[File, SourceAPI] = scala.collection.mutable.Map.empty

	def sourceDependency(dependsOn: File, source: File, inherited: Boolean) { sourceDependencies += ((dependsOn, source, inherited)) }
	def binaryDependency(binary: File, name: String, source: File, inherited: Boolean) { binaryDependencies += ((binary, name, source, inherited)) }
	def generatedClass(source: File, module: File, name: String) { products += ((source, module, name)) }

	def api(source: File, sourceAPI: SourceAPI): Unit = {
		assert(!apis.contains(source), s"The `api` method should be called once per source file: $source")
		apis(source) = sourceAPI
	}
	def problem(category: String, pos: xsbti.Position, message: String, severity: xsbti.Severity, reported: Boolean) {}
}

Fix unstable existential type names bug.

Fix the problem with unstable names synthesized for existential
types (declared with underscore syntax) by renaming type variables
to a scheme that is guaranteed to be stable no matter where given
the existential type appears.

The sheme we use are De Bruijn-like indices that capture both position
of type variable declarion within single existential type and nesting
level of nested existential type. This way we properly support nested
existential types by avoiding name clashes.

In general, we can perform renamings like that because type variables
declared in existential types are scoped to those types so the renaming
operation is local.

There's a specs2 unit test covering instability of existential types.
The test is included in compiler-interface project and the build
definition has been modified to enable building and executing tests
in compiler-interface project. Some dependencies has been modified:

  * compiler-interface project depends on api project for testing
    (test makes us of SameAPI)
  * dependency on junit has been introduced because it's needed
    for `@RunWith` annotation which declares that specs2 unit
    test should be ran with JUnitRunner

SameAPI has been modified to expose a method that allows us to
compare two definitions.

This commit also adds `ScalaCompilerForUnitTesting` class that allows
to compile a piece of Scala code and inspect information recorded
callbacks defined in  `AnalysisCallback` interface. That class uses
existing ConsoleLogger for logging. I considered doing the same for
ConsoleReporter. There's LoggingReporter defined which would fit our
usecase but it's defined in compile subproject that compiler-interface
doesn't depend on so we roll our own.

ScalaCompilerForUnit testing uses TestCallback from compiler-interface
subproject for recording information passed to callbacks. In order
to be able to access TestCallback from compiler-interface
subproject I had to tweak dependencies between interface and
compiler-interface so test classes from the former are visible in the
latter. I also modified the TestCallback itself to accumulate apis in
a HashMap instead of a buffer of tuples for easier lookup.

An integration test has been added which tests scenario
mentioned in #823.

This commit fixes #823.


resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven"

addSbtPlugin("com.eed3si9n"       %   "sbt-unidoc"              % "0.3.2")
addSbtPlugin("com.github.gseitz"  %   "sbt-release"             % "1.0.0")
addSbtPlugin("com.jsuereth"       %   "sbt-pgp"                 % "1.0.0")
addSbtPlugin("org.scoverage"      %   "sbt-scoverage"           % "1.5.0")
addSbtPlugin("com.timushev.sbt"   %   "sbt-updates"             % "0.1.9")
addSbtPlugin("com.typesafe.sbt"   %   "sbt-ghpages"             % "0.5.4")
addSbtPlugin("com.updateimpact"   %   "updateimpact-sbt-plugin" % "2.1.1")
addSbtPlugin("org.xerial.sbt"     %   "sbt-sonatype"            % "0.5.1")
addSbtPlugin("com.codacy"         %   "sbt-codacy-coverage"     % "1.3.8")

Remove a resolver that points to a non-HTTPS URL.

It doesn't seem to be needed anyway, as JGit is in Central.


package quotidian.search

import org.apache.lucene.store.IndexOutput
import java.util.zip.{Checksum,CRC32}

class DatastoreIndexOutput(private val directory:DatastoreDirectory, private var file:DatastoreFile) extends IndexOutput {
	def this(directory:DatastoreDirectory) = this(directory,DatastoreFile())
	def close:Unit = directory.save(file)
	def flush:Unit = { /* nothing to do here */ }
	def getFilePointer():Long = file.position
	def length:Long = file.length
	def seek(pos:Long):Unit = file = file.seek(pos)
	def writeByte(b:Byte):Unit = file = file.write(b)
	def writeBytes(bytes:Array[Byte],offset:Int,length:Int):Unit = file = file.write(bytes,offset,length)
}

package quotidian.search

import org.apache.lucene.store.IndexOutput
import java.util.zip.{Checksum,CRC32}

class DatastoreIndexOutput(private val directory:DatastoreDirectory, private var file:DatastoreFile) extends IndexOutput {
	def this(directory:DatastoreDirectory) = this(directory,DatastoreFile())
	def close:Unit = flush
	def flush:Unit = directory.save(file)
	def getFilePointer():Long = file.position
	def length:Long = file.length
	def seek(pos:Long):Unit = file = file.seek(pos)
	def writeByte(b:Byte):Unit = file = file.write(b)
	def writeBytes(bytes:Array[Byte],offset:Int,length:Int):Unit = file = file.write(bytes,offset,length)
}

Save on flush and on close

Save on flush and on close


package com.codahale.jerkson.ser

import org.codehaus.jackson.JsonGenerator
import org.codehaus.jackson.map.{SerializerProvider, JsonSerializer}
import org.codehaus.jackson.annotate.JsonIgnore
import org.codehaus.jackson.map.annotate.JsonCachable
import java.lang.reflect.Modifier

@JsonCachable
class CaseClassSerializer[A <: Product](klass: Class[_]) extends JsonSerializer[A] {
  private val nonIgnoredFields = klass.getDeclaredFields.filterNot { f =>
    f.getAnnotation(classOf[JsonIgnore]) != null ||
      (f.getModifiers & Modifier.TRANSIENT) != 0 ||
      f.getName.contains("$")
  }

  private val methods = klass.getDeclaredMethods
                                .filter { _.getParameterTypes.isEmpty }
                                .map { m => m.getName -> m }.toMap

  def serialize(value: A, json: JsonGenerator, provider: SerializerProvider) {
    json.writeStartObject()
    for (field <- nonIgnoredFields) {
      val methodOpt = methods.get(field.getName)
      val fieldValue: Object = methodOpt.map { _.invoke(value) }.getOrElse(field.get(value))
      if (fieldValue != None) {
        val fieldName = methodOpt.map { _.getName }.getOrElse(field.getName)
        provider.defaultSerializeField(fieldName, fieldValue, json)
      }
    }
    json.writeEndObject()
  }
}

package com.codahale.jerkson.ser

import org.codehaus.jackson.JsonGenerator
import org.codehaus.jackson.map.{SerializerProvider, JsonSerializer}
import org.codehaus.jackson.annotate.{JsonIgnore, JsonIgnoreProperties}
import org.codehaus.jackson.map.annotate.JsonCachable
import java.lang.reflect.Modifier

@JsonCachable
class CaseClassSerializer[A <: Product](klass: Class[_]) extends JsonSerializer[A] {
  val jsonIgnoreProperties = Option(klass.getAnnotation(classOf[JsonIgnoreProperties]))
  val jsonIgnoreArray = jsonIgnoreProperties map {_.value} getOrElse Array[String]()

  private val nonIgnoredFields = klass.getDeclaredFields.filterNot { f =>
    f.getAnnotation(classOf[JsonIgnore]) != null ||
    jsonIgnoreArray.contains(f.getName) ||
      (f.getModifiers & Modifier.TRANSIENT) != 0 ||
      f.getName.contains("$")
  }

  private val methods = klass.getDeclaredMethods
                                .filter { _.getParameterTypes.isEmpty }
                                .map { m => m.getName -> m }.toMap

  def serialize(value: A, json: JsonGenerator, provider: SerializerProvider) {
    json.writeStartObject()
    for (field <- nonIgnoredFields) {
      val methodOpt = methods.get(field.getName)
      val fieldValue: Object = methodOpt.map { _.invoke(value) }.getOrElse(field.get(value))
      if (fieldValue != None) {
        val fieldName = methodOpt.map { _.getName }.getOrElse(field.getName)
        provider.defaultSerializeField(fieldName, fieldValue, json)
      }
    }
    json.writeEndObject()
  }
}

Support Jackson @JsonIgnoreProperties in addition to @JsonIgnore


package org.webjars.play

import controllers.AssetsMetadata
import play.api.http.HttpErrorHandler
import play.api.{Configuration, Environment}

/**
 * Compile-time DI components
 */
trait WebJarComponents {

  def configuration: Configuration
  def environment: Environment
  def errorHandler: HttpErrorHandler
  def assetsMetadata: AssetsMetadata

  lazy val webJarsUtil = new WebJarsUtil(configuration, environment)

  lazy val webJarAssets = new WebJarAssets(errorHandler, assetsMetadata)

}

package org.webjars.play

import controllers.AssetsMetadata
import play.api.http.HttpErrorHandler
import play.api.{Configuration, Environment}

/**
 * Compile-time DI components
 */
trait WebJarComponents {

  def configuration: Configuration
  def environment: Environment
  def httpErrorHandler: HttpErrorHandler
  def assetsMetadata: AssetsMetadata

  lazy val webJarsUtil = new WebJarsUtil(configuration, environment)

  lazy val webJarAssets = new WebJarAssets(httpErrorHandler, assetsMetadata)

}

Rename error handler method in components trait

The components provided out-of-the-box with Play all use
httpErrorHandler as the name for the method that refers to
a HttpErrorHandler. WebJars-Play should follow the same pattern
in order to avoid confusion, and to allow tools like MacWire
to work properly.


package scoverage

import java.io.FileWriter

/** @author Stephen Samuel */
object Invoker {

  def invoked(id: Int, path: String) = {
    val writer = new FileWriter(path, true)
    writer.append(id.toString)
    writer.append(';')
    writer.close()
  }
}

package scoverage

import java.io.FileWriter

/** @author Stephen Samuel */
object Invoker {

  /**
   * We record that the given id has been invoked by appending its id to the coverage
   * data file.
   * This will happen concurrently on as many threads as the application is using,
   * but appending small amounts of data to a file is atomic on both POSIX and Windows
   * if it is a single write of a small enough string.
   *
   * @see http://stackoverflow.com/questions/1154446/is-file-append-atomic-in-unix
   * @see http://stackoverflow.com/questions/3032482/is-appending-to-a-file-atomic-with-windows-ntfs
   */
  def invoked(id: Int, path: String) = {
    val writer = new FileWriter(path, true)
    writer.append(id.toString + ';')
    writer.close()
  }
}

Fix race condition on Windows by consolidating two file writes


package glint.indexing

/**
  * An indexer that uses a cyclic model where keys would be distributed n mod m
  */
class CyclicIndexer(models: Int, keys: Long) extends Indexer[Long] {
  override def index(key: Long): Long = {
    Math.ceil((key % models) * (keys / models)).toLong + Math.floor(key / models).toLong
  }
}

package glint.indexing

/**
  * An indexer that uses a cyclic model where keys would be distributed n mod m
  */
class CyclicIndexer(models: Int, keys: Long) extends Indexer[Long] {
  override def index(key: Long): Long = {
    val model = key % models
    val indexInModel = (key - model) / models

    // Due to the cyclic nature of the keys, the first few models will obtain more keys than the rest
    // To model this accurately we first compute how many bigger models there will be
    // Then we compute the bigger model size and the smaller model size (these should always differ by 1)
    val biggerModels = keys % models
    val biggerModelSize = Math.ceil(keys.toDouble / models).toLong
    val smallerModelSize = Math.floor(keys.toDouble / models).toLong

    if (model < biggerModels) {
      // If our selected model is in the first set of models (the bigger one), we use the bigger model size to compute
      // its offset
      indexInModel + model * biggerModelSize
    } else {
      // Otherwise, it is in the later set of models and we need to add all the bigger size models and only a few
      // smaller models to it to find the correct offset
      indexInModel + (model - biggerModels) * smallerModelSize + (biggerModels * biggerModelSize)
    }
  }
}

Fix rounding issues on cyclic indexer

Fix rounding issues on cyclic indexer


package quotidian.web.controller

import basic.persistence.Persister
import org.apache.lucene.document.Document
import org.apache.lucene.index.Term
import org.apache.lucene.search.{FuzzyQuery,IndexSearcher,Query,TermQuery}
import org.apache.lucene.store.Directory
import quotidian.Logging
import quotidian.model.Quote

abstract class SearchController extends Logging {
	protected def persister:Persister
	protected def directory:Directory
	def searcher = new IndexSearcher(directory)
	private lazy val contextTerm = new Term(Quote.Context)
	private lazy val sourceTerm = new Term(Quote.Source)
	private lazy val textTerm = new Term(Quote.Text)
	def searchContext(context:String):Array[Quote] = search(new FuzzyQuery(contextTerm.createTerm(context)))
	def searchSource(source:String):Array[Quote] = search(new FuzzyQuery(sourceTerm.createTerm(source)))
	def searchText(text:String):Array[Quote] = search(new FuzzyQuery(textTerm.createTerm(text)))
	private def search(query:Query):Array[Quote] = {
		val s = searcher
		val scoreDocs = s.search(query,10).scoreDocs
		for {
			scoreDoc <- scoreDocs
			doc = DocumentWrapper(s.doc(scoreDoc.doc))
		} yield Quote(doc(Quote.Id).get,doc(Quote.Text).get,doc(Quote.Source).getOrElse(""),doc(Quote.Context).getOrElse(""))
	}
}

package quotidian.web.controller

import org.apache.lucene.analysis.standard.StandardAnalyzer
import org.apache.lucene.queryParser.QueryParser
import org.apache.lucene.search.{IndexSearcher,Query}
import org.apache.lucene.store.Directory
import quotidian.Logging
import quotidian.model.Quote

abstract class SearchController extends Logging {
	protected def directory:Directory
	def searcher = new IndexSearcher(directory)
	private lazy val parser = new QueryParser(Quote.Text,new StandardAnalyzer())
	def searchContext(context:String):Array[Quote] = search(Quote.Context + ":" + context)
	def searchSource(source:String):Array[Quote] = search(Quote.Source + ":" + source)
	def searchText(text:String):Array[Quote] = search(Quote.Text + ":" + text)
	def search(query:String):Array[Quote] = {
		val parser = new QueryParser(Quote.Text,new StandardAnalyzer())
		search(parser.parse(query))
	}
	private def search(query:Query):Array[Quote] = {
		val s = searcher
		val scoreDocs = s.search(query,10).scoreDocs
		for {
			scoreDoc <- scoreDocs
			doc = DocumentWrapper(s.doc(scoreDoc.doc))
		} yield Quote(doc(Quote.Id).get,doc(Quote.Text).get,doc(Quote.Source).getOrElse(""),doc(Quote.Context).getOrElse(""))
	}
}

Use QueryParser rather than creating Querys

Removed Term and Query imports and stopped creating those objects in
favor of using Lucene's query parser.


/* NSC -- new Scala compiler
 * Copyright 2005-2013 LAMP/EPFL
 * @author  Martin Odersky
 */
package dotty.tools
package dotc

import core.Contexts.Context
import reporting.Reporter

/* To do:
 *   - simplify hk types
 *   - Don't open package objects from class files if they are present in source
 *   - Revise the way classes are inherited - when not followed by [...] or (...),
 *     assume the unparameterized type and forward type parameters as we do now for the synthetic head class.
 */
object Main extends Driver {
  def resident(compiler: Compiler): Reporter = unsupported("resident") /*loop { line =>
    val command = new CompilerCommand(line split "\\s+" toList, new Settings(scalacError))
    compiler.reporter.reset()
    new compiler.Run() compile command.files
  }*/

  override def newCompiler(): Compiler = new Compiler

  override def doCompile(compiler: Compiler, fileNames: List[String])(implicit ctx: Context): Reporter = {
    if (new config.Settings.Setting.SettingDecorator[Boolean](ctx.base.settings.resident).value(ctx))
      resident(compiler)
    else
      super.doCompile(compiler, fileNames)
  }
}

/* NSC -- new Scala compiler
 * Copyright 2005-2013 LAMP/EPFL
 * @author  Martin Odersky
 */
package dotty.tools
package dotc

import core.Contexts.Context
import reporting.Reporter

/* To do:
s *   - Revise the way classes are inherited - when not followed by [...] or (...),
 *     assume the unparameterized type and forward type parameters as we do now for the synthetic head class.
 */
object Main extends Driver {
  def resident(compiler: Compiler): Reporter = unsupported("resident") /*loop { line =>
    val command = new CompilerCommand(line split "\\s+" toList, new Settings(scalacError))
    compiler.reporter.reset()
    new compiler.Run() compile command.files
  }*/

  override def newCompiler(): Compiler = new Compiler

  override def doCompile(compiler: Compiler, fileNames: List[String])(implicit ctx: Context): Reporter = {
    if (new config.Settings.Setting.SettingDecorator[Boolean](ctx.base.settings.resident).value(ctx))
      resident(compiler)
    else
      super.doCompile(compiler, fileNames)
  }
}

Drop task of simplifying hk types.

Drop task of simplifying hk types.

See examplation in 2nd commit of branch aborted/simplify-hk.


package com.example.http4s

import org.http4s.jetty.{JettyBuilder, JettyServer}
import org.http4s.server.ServerBuilder
import org.http4s.server.blaze.{BlazeBuilder, BlazeServer}
import org.http4s.tomcat.{TomcatBuilder, TomcatServer}

import org.log4s.getLogger

/**
 * http4s' server builders let you run the same configuration on multiple backends.
 */
abstract class Example[B <: ServerBuilder[B]] extends App {
  private[this] val logger = getLogger

  // Extract common configuration into functions of ServerBuilder => ServerBuilder.
  // With type parameterization, it allows composition with backend-specific
  // extensions.
  def baseConfig(builder: B): B = builder
    .withHost("127.0.0.1")
    .withPort(8080)
    .mountService(ExampleService.service, "/http4s")

  def builder: B

  val server = builder.run

  // Shut down the server with the process terminates.
  sys.addShutdownHook {
    logger.info(s"Shutting down server")
    server.shutdownNow()
  }

  // Block until shutdown.
  synchronized { wait() }
}

object JettyExample extends Example[JettyBuilder] {
  def builder = baseConfig(JettyServer)
}

object TomcatExample extends Example[TomcatBuilder] {
  def builder = baseConfig(TomcatServer)
}

object BlazeExample extends Example[BlazeBuilder] {
  def builder = baseConfig(BlazeServer).withNio2(false)
}

package com.example.http4s

import org.http4s.jetty.{JettyBuilder, JettyServer}
import org.http4s.server.ServerBuilder
import org.http4s.server.blaze.{BlazeBuilder, BlazeServer}
import org.http4s.tomcat.{TomcatBuilder, TomcatServer}

import org.log4s.getLogger

/**
 * http4s' server builders let you run the same configuration on multiple backends.
 */
abstract class Example[B <: ServerBuilder[B]] extends App {
  private val logger = getLogger

  // Extract common configuration into functions of ServerBuilder => ServerBuilder.
  // With type parameterization, it allows composition with backend-specific
  // extensions.
  def baseConfig(builder: B): B = builder
    .withHost("127.0.0.1")
    .withPort(8080)
    .mountService(ExampleService.service, "/http4s")

  def builder: B

  val server = builder.run

  // Shut down the server with the process terminates.
  sys.addShutdownHook {
    logger.info(s"Shutting down server")
    server.shutdownNow()
  }

  // Block until shutdown.
  synchronized { wait() }
}

object JettyExample extends Example[JettyBuilder] {
  def builder = baseConfig(JettyServer)
}

object TomcatExample extends Example[TomcatBuilder] {
  def builder = baseConfig(TomcatServer)
}

object BlazeExample extends Example[BlazeBuilder] {
  def builder = baseConfig(BlazeServer).withNio2(false)
}

Fix IllegalAccessException in delayed init of logger in example.


package reaktor.scct.report

import java.io.File
import io.Source

class SourceLoader(baseDir:File) {
  def linesFor(sourceFile: String) = {
    val src = Source.fromFile(new File(baseDir, sourceFile))
    toLines(src)
  }

  def toLines(source: Source) = {
    def toLines(acc: List[String]): List[String] = {
      if (source.isEmpty) {
        acc.reverse
      } else {
        val line = source.takeWhile(_ != '\n').mkString
        toLines(line+"\n" :: acc)
      }
    }
    toLines(List())
  }
}

package reaktor.scct.report

import java.io.File
import io.Source

class SourceLoader(baseDir:File) {
  def linesFor(sourceFile: String) = {
    val src = Source.fromFile(new File(baseDir, sourceFile), "UTF-8")
    toLines(src)
  }

  def toLines(source: Source) = {
    def toLines(acc: List[String]): List[String] = {
      if (source.isEmpty) {
        acc.reverse
      } else {
        val line = source.takeWhile(_ != '\n').mkString
        toLines(line+"\n" :: acc)
      }
    }
    toLines(List())
  }
}

Read Scala files with UTF-8 encoding.

Read Scala files with UTF-8 encoding.


package io.mediachain.signatures

import java.security.cert.X509Certificate
import javax.security.auth.x500.X500Principal

object CertificateUtil {

  def canonicalName(cert: X509Certificate): String =
    cert.getSubjectX500Principal.getName(X500Principal.CANONICAL)

}

package io.mediachain.signatures

import java.security.cert.X509Certificate
import javax.security.auth.x500.X500Principal

import org.bouncycastle.asn1.x500.X500Name
import org.bouncycastle.asn1.x500.style.{BCStyle, IETFUtils}

object CertificateUtil {

  def canonicalName(cert: X509Certificate): String =
    cert.getSubjectX500Principal.getName(X500Principal.CANONICAL)

  def commonNames(cert: X509Certificate): List[String] = {
    val name = new X500Name(cert.getSubjectX500Principal.getName)
    val rdns = name.getRDNs(BCStyle.CN)
    rdns.map(IETFUtils.valueToString).toList
  }
}

Add helper to get Common Names from certificate


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

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

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

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

Set project version to 0.1.7-BETA

Set project version to 0.1.7-BETA


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

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

Update sbt-jmh plugin to 0.2.10

Update sbt-jmh plugin to 0.2.10


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

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

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

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

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

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

// But use -SNAPSHOT, because there's no -RC2 in the Typesafe or local repo: (right now, buggy build)
addSbtPlugin("play" % "sbt-plugin" % "2.0-SNAPSHOT")

Use sbt-plugin 2.0-SNAPSHOT, not 2.0-RC2

Right now, the build otherwise fails: there's no 2.0-RC2 in the Typesafe
or local repo.