<commit_before>import sbt._
import Keys._
import bintray.Plugin._
import bintray.Keys._
import com.typesafe.sbt.SbtSite.site
import com.typesafe.sbt.site.SphinxSupport.Sphinx
import pl.project13.scala.sbt.JmhPlugin
import sbtassembly.Plugin._
import AssemblyKeys._
import sbtbuildinfo.Plugin._
import scoverage.ScoverageSbtPlugin

object Scrooge extends Build {
  val branch = Process("git" :: "rev-parse" :: "--abbrev-ref" :: "HEAD" :: Nil).!!.trim
  val suffix = if (branch == "master") "" else "-SNAPSHOT"

  val libVersion = "4.7.0" + suffix

  // To build the develop branch you need to publish util, and finagle locally:
  // 'git checkout develop; sbt publishLocal' to publish SNAPSHOT versions of these projects.
  val utilVersion = "6.34.0" + suffix
  val finagleVersion = "6.35.0" + suffix

  val libthriftVersion = "0.5.0-1"

  def util(which: String) = "com.twitter" %% ("util-"+which) % utilVersion
  def finagle(which: String) = "com.twitter" %% ("finagle-"+which) % finagleVersion

  val compileThrift = TaskKey[Seq[File]](
    "compile-thrift", "generate thrift needed for tests")

  val dumpClasspath = TaskKey[File](
    "dump-classpath", "generate a file containing the full classpath")

  val dumpClasspathSettings: Seq[Setting[_]] = Seq(
    dumpClasspath <<= (
      baseDirectory,
      fullClasspath in Runtime
    ) map { (base, cp) =>
      val file = new File((base / ".classpath.txt").getAbsolutePath)
      val out = new java.io.FileWriter(file)
      try out.write(cp.files.absString) finally out.close()
      file
    }
  )

  val testThriftSettings: Seq[Setting[_]] = Seq(
    sourceGenerators in Test <+= ScroogeRunner.genTestThrift,
    ScroogeRunner.genTestThriftTask
  )

  val sharedSettingsWithoutScalaVersion = Seq(
    version := libVersion,
    organization := "com.twitter",

    resolvers ++= Seq(
      "sonatype-public" at "https://oss.sonatype.org/content/groups/public"
    ),

    ScoverageSbtPlugin.ScoverageKeys.coverageHighlighting := true,

    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "2.2.4" % "test",
      "org.scalacheck" %% "scalacheck" % "1.12.2" % "test",
      "junit" % "junit" % "4.12" % "test"
    ),
    resolvers += "twitter-repo" at "https://maven.twttr.com",

    scalacOptions := Seq(
      "-target:jvm-1.8",
      "-deprecation",
      "-unchecked",
      "-feature", "-Xlint",
      "-encoding", "utf8",
      "-Ypatmat-exhaust-depth", "40"
    ),

    // Sonatype publishing
    publishArtifact in Test := false,
    pomIncludeRepository := { _ => false },
    publishMavenStyle := true,
    pomExtra :=
      <url>https://github.com/twitter/scrooge</url>
      <licenses>
        <license>
          <name>Apache License, Version 2.0</name>
          <url>http://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
      </licenses>
      <scm>
        <url>git@github.com:twitter/scrooge.git</url>
        <connection>scm:git:git@github.com:twitter/scrooge.git</connection>
      </scm>
      <developers>
        <developer>
          <id>twitter</id>
          <name>Twitter Inc.</name>
          <url>https://www.twitter.com/</url>
        </developer>
      </developers>,
    publishTo <<= version { (v: String) =>
      val nexus = "https://oss.sonatype.org/"
      if (v.trim.endsWith("SNAPSHOT"))
        Some("snapshots" at nexus + "content/repositories/snapshots")
      else
        Some("releases"  at nexus + "service/local/staging/deploy/maven2")<commit_msg>scrooge: Fix sbt build<commit_after>import sbt._
import Keys._
import bintray.Plugin._
import bintray.Keys._
import com.typesafe.sbt.SbtSite.site
import com.typesafe.sbt.site.SphinxSupport.Sphinx
import pl.project13.scala.sbt.JmhPlugin
import sbtassembly.Plugin._
import AssemblyKeys._
import sbtbuildinfo.Plugin._
import scoverage.ScoverageSbtPlugin

object Scrooge extends Build {
  val branch = Process("git" :: "rev-parse" :: "--abbrev-ref" :: "HEAD" :: Nil).!!.trim
  val suffix = if (branch == "master") "" else "-SNAPSHOT"

  val libVersion = "4.7.0" + suffix

  // To build the develop branch you need to publish util, and finagle locally:
  // 'git checkout develop; sbt publishLocal' to publish SNAPSHOT versions of these projects.
  val utilVersion = "6.34.0" + suffix
  val finagleVersion = "6.35.0" + suffix

  val libthriftVersion = "0.5.0-1"

  def util(which: String) = "com.twitter" %% ("util-"+which) % utilVersion
  def finagle(which: String) = "com.twitter" %% ("finagle-"+which) % finagleVersion

  val compileThrift = TaskKey[Seq[File]](
    "compile-thrift", "generate thrift needed for tests")

  val dumpClasspath = TaskKey[File](
    "dump-classpath", "generate a file containing the full classpath")

  val dumpClasspathSettings: Seq[Setting[_]] = Seq(
    dumpClasspath <<= (
      baseDirectory,
      fullClasspath in Runtime
    ) map { (base, cp) =>
      val file = new File((base / ".classpath.txt").getAbsolutePath)
      val out = new java.io.FileWriter(file)
      try out.write(cp.files.absString) finally out.close()
      file
    }
  )

  val testThriftSettings: Seq[Setting[_]] = Seq(
    sourceGenerators in Test <+= ScroogeRunner.genTestThrift,
    ScroogeRunner.genTestThriftTask
  )

  def scalacOptionsVersion(sv: String): Seq[String] = {
    Seq(
      "-deprecation",
      "-unchecked",
      "-feature",
      "-Xlint",
      "-encoding", "utf8"
    ) ++ (CrossVersion.partialVersion(sv) match {
      case Some((2, x)) if x >= 11 =>
        Seq(
          "-target:jvm-1.8",
          "-Ypatmat-exhaust-depth", "40"
        )
      case _ =>
        Nil
    })
  }

  val sharedSettingsWithoutScalaVersion = Seq(
    version := libVersion,
    organization := "com.twitter",

    resolvers ++= Seq(
      "sonatype-public" at "https://oss.sonatype.org/content/groups/public"
    ),

    ScoverageSbtPlugin.ScoverageKeys.coverageHighlighting := true,

    libraryDependencies ++= Seq(
      "org.scalatest" %% "scalatest" % "2.2.4" % "test",
      "org.scalacheck" %% "scalacheck" % "1.12.2" % "test",
      "junit" % "junit" % "4.12" % "test"
    ),
    resolvers += "twitter-repo" at "https://maven.twttr.com",

    scalacOptions := scalacOptionsVersion(scalaVersion.value),

    // Sonatype publishing
    publishArtifact in Test := false,
    pomIncludeRepository := { _ => false },
    publishMavenStyle := true,
    pomExtra :=
      <url>https://github.com/twitter/scrooge</url>
      <licenses>
        <license>
          <name>Apache License, Version 2.0</name>
          <url>http://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
      </licenses>
      <scm>
        <url><EMAIL>:twitter/scrooge.git</url>
        <connection>scm:git:<EMAIL>:twitter/scrooge.git</connection>
      </scm>
      <developers>
        <developer>
          <id>twitter</id>
          <name>Twitter Inc.</name>
          <url>https://www.twitter.com/</url>
        </developer>
      </developers>,
    publishTo <<= version { (v: String) =>
      val nexus = "https://oss.sonatype.org/"
      if (v.trim.endsWith("SNAPSHOT"))
        Some("snapshots" at nexus + "content/repositories/snapshots")
      else
        Some("releases"  at nexus + "service/local/staging/deploy/maven2")
{'fraction_non_alphanumeric': 0.14954306286347271, 'fraction_numerical': 0.010661866518969814, 'mean_word_length': 2.900107991360691, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 66, 'https://': 10, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6050842', 'n_tokens_mistral': 2489, 'n_tokens_neox': 2401, 'n_words': 500}