<commit_before>import sbt._
import Keys._

object Shared {

  val servletApiDep = "javax.servlet" % "servlet-api" % "2.3" % "provided"
  val jettyVersion = "7.2.2.v20101205"
  val continuation = "org.eclipse.jetty" % "jetty-continuation" % "7.5.1.v20110908" % "compile"

  def specsDep(sv: String) =
    sv.split('.').toList match {
      case "2" :: "8" :: _ => "org.scala-tools.testing" % "specs_2.8.1" % "1.6.8"
      case "2" :: "9" :: "1" :: _ => "org.scala-tools.testing" % "specs_2.9.1" % "1.6.9"
      case "2" :: "9" :: _ => "org.scala-tools.testing" %% "specs" % "1.6.8"
      case _ => error("specs not supported for scala version %s" format sv)
    }

  val dispatchVersion = "0.8.5"
  def dispatchDeps =
    "net.databinder" %% "dispatch-mime" % dispatchVersion ::
    "net.databinder" %% "dispatch-http" % dispatchVersion :: Nil

  def dispatchOAuthDep =
    "net.databinder" %% "dispatch-oauth" % dispatchVersion

  def integrationTestDeps(sv: String) = (specsDep(sv) :: dispatchDeps) map { _ % "test" }
}

object Unfiltered extends Build {
  import Shared._

  def id(name: String) = "unfiltered-%s" format name

  def local(name: String) = LocalProject(id(name))

  val buildSettings = Defaults.defaultSettings ++ Seq(
    organization := "net.databinder",
    version := "0.5.1",
    crossScalaVersions := Seq("2.8.0", "2.8.1", "2.8.2",
                              "2.9.0", "2.9.0-1", "2.9.1"),
    scalaVersion := "2.8.1",
    publishTo := Some("Scala Tools Nexus" at "http://nexus.scala-tools.org/content/repositories/releases/"),
    credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),
    scalacOptions ++= Seq("-Xcheckinit", "-encoding", "utf8"),
    parallelExecution in Test := false // :( test servers collide on same port
  )

  def srcPathSetting(projectId: String, rootPkg: String) = {
    mappings in (LocalProject(projectId), Compile, packageSrc) ~= {
      defaults: Seq[(File,String)] =>
        defaults.map { case(file, path) =>
          (file, rootPkg + "/" + path)
        }
    }
  }

  private def module(moduleName: String)(
    settings: Seq[Setting[_]],
    projectId: String = "unfiltered-" + moduleName,
    dirName: String = moduleName,
    srcPath: String = "unfiltered/" + moduleName.replace("-","/")
  ) = Project(projectId, file(dirName),
              settings = (buildSettings :+
                          srcPathSetting(projectId, srcPath)) ++ settings)

  lazy val unfiltered =
    Project("unfiltered-all", file("."),
            settings = buildSettings ++ Seq(name := "Unfiltered")
            ) aggregate(
            library, filters, filtersAsync , uploads, util, jetty,
            jettyAjpProject, netty, nettyServer, json, specHelpers,
            scalaTestHelpers, websockets, oauth, agents)

  lazy val library: Project =
    module("unfiltered")(
      dirName = "library",
      projectId = "unfiltered",
      settings = Seq(
        unmanagedClasspath in (LocalProject("unfiltered"), Test) <++=
          (fullClasspath in (local("spec"), Compile),
           fullClasspath in (local("filter"), Compile)) map { (s, f) =>
            s ++ f
        },
        libraryDependencies <++= scalaVersion(v => Seq(
          "commons-codec" % "commons-codec" % "1.4",
          Shared.specsDep(v) % "test"
        ) ++ integrationTestDeps(v))
      )
   ) dependsOn(util)

  lazy val filters =
    module("filter")(
      settings = Seq(
        unmanagedClasspath in (local("filter"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion(v => Seq(servletApiDep) ++
          integrationTestDeps(v))
      )) dependsOn(library)

  lazy val filtersAsync =
    module("filter-async")(
      settings = Seq(
        unmanagedClasspath in (local("filter-async"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion {
          v => Seq(servletApiDep,continuation) ++ integrationTestDeps(v)
        }
      )) dependsOn(filters)

  lazy val agents =
    module("agents")(
      srcPath = "unfiltered/request",
      settings = Seq(
        unmanagedClasspath in (local("agents"), Test) <++=
            (fullClasspath in (local("spec"), Compile),
             fullClasspath in (local("filter"), Compile)) map { (s, f) =>
              s ++ f
        },
        libraryDependencies <++= scalaVersion(v => Seq(servletApiDep) ++
          integrationTestDeps(v))
       )) dependsOn(library)

  lazy val uploads =
    module("uploads")(
      srcPath = "unfiltered/request",
      settings = Seq(
        unmanagedClasspath in (local("uploads"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion(v => Seq(
          servletApiDep,
          "commons-io" % "commons-io" % "1.4",
          "commons-fileupload" % "commons-fileupload" % "1.2.1"
        ) ++ integrationTestDeps(v))
       )) dependsOn(filters)

  lazy val util = module("util")(
    settings = Seq(
      // https://github.com/harrah/xsbt/issues/76
      publishArtifact in packageDoc := false
    ))

  lazy val jetty =
    module("jetty")(
      settings = Seq(
        libraryDependencies := Seq(
          "org.eclipse.jetty" % "jetty-webapp" % jettyVersion
        )
     )) dependsOn(util)

  lazy val jettyAjpProject =
    module("jetty-ajp")(
      settings = Seq(
        libraryDependencies := Seq(
          "org.eclipse.jetty" % "jetty-ajp" % jettyVersion
        )
      )) dependsOn(jetty)

  lazy val nettyServer =
    module("netty-server")(
      srcPath = "unfiltered/netty",
      settings = Seq(
        unmanagedClasspath in (local("netty-server"), Test) <++=
            (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <<= scalaVersion(integrationTestDeps _)
       )) dependsOn(netty, util)

  lazy val netty =
    module("netty")(
      settings = Seq(
        unmanagedClasspath in (local("netty"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion(v =>
          ("org.jboss.netty" % "netty" % "3.2.5.Final" withSources()) +:
          integrationTestDeps(v)
        )
      )) dependsOn(library)

  lazy val specHelpers =
    module("spec")(
      settings = Seq(
        libraryDependencies <++= scalaVersion { v =>
          specsDep(v) :: dispatchDeps
        }
      )) dependsOn(filters, jetty, nettyServer)

  lazy val scalaTestHelpers =
    module("scalatest")(
      settings = Seq(
        libraryDependencies ~= { _ ++
          ("org.scalatest" % "scalatest" % "1.3" :: dispatchDeps)
        }
      )) dependsOn(jetty, nettyServer)

  lazy val json =
    module("json")(
      srcPath = "unfiltered",
      settings = Seq(
        unmanagedClasspath in (local("json"), Test) <++=
          (fullClasspath in (local("spec"), Compile),
           fullClasspath in (local("filter"), Compile)) map { (s, f) =>
             s ++ f
          },
        libraryDependencies <++= scalaVersion(v => Seq(
          v.split('.').toList match {
            case "2" :: "8" :: "2" :: _ =>
              "net.liftweb" % "lift-json_2.8.1" % "2.4-M4"
            case _ =>
              "net.liftweb" %% "lift-json" % "2.4-M4"
          }) ++ integrationTestDeps(v))
      )) dependsOn(library)

  lazy val scalate =
    module("scalate")(
      settings = Seq(
        libraryDependencies <++= scalaVersion { v =>
          val scalateVersion = v match {
            case "2.8.0" | "2.8.1" => "1.5.2-scala_2.8.1"
            case _ => "1.5.2"
          }
          Seq(
            "org.fusesource.scalate" % "scalate-core" % scalateVersion,
            "org.fusesource.scalate" % "scalate-util" % scalateVersion % "test",
            "org.scala-lang" % "scala-compiler" % v % "test",
            "org.mockito" % "mockito-core" % "1.8.5" % "test"
          ) ++ integrationTestDeps(v)}
        )) dependsOn(library)

  lazy val websockets =
    module("netty-websockets")(
      settings = Seq(
        unmanagedClasspath in (local("netty-websockets"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion(integrationTestDeps _)
      )) dependsOn(nettyServer)

  lazy val oauth =
    module("oauth")(
      settings = Seq(
        unmanagedClasspath in (local("oauth"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion(v =>
          Seq(dispatchOAuthDep) ++
          integrationTestDeps(v))
      )) dependsOn(jetty, filters)
}
<commit_msg>version bump, scala 2.8.2 as default<commit_after>import sbt._
import Keys._

object Shared {

  val servletApiDep = "javax.servlet" % "servlet-api" % "2.3" % "provided"
  val jettyVersion = "7.2.2.v20101205"
  val continuation = "org.eclipse.jetty" % "jetty-continuation" % "7.5.1.v20110908" % "compile"

  def specsDep(sv: String) =
    sv.split('.').toList match {
      case "2" :: "8" :: _ => "org.scala-tools.testing" % "specs_2.8.1" % "1.6.8"
      case "2" :: "9" :: "1" :: _ => "org.scala-tools.testing" % "specs_2.9.1" % "1.6.9"
      case "2" :: "9" :: _ => "org.scala-tools.testing" %% "specs" % "1.6.8"
      case _ => error("specs not supported for scala version %s" format sv)
    }

  val dispatchVersion = "0.8.5"
  def dispatchDeps =
    "net.databinder" %% "dispatch-mime" % dispatchVersion ::
    "net.databinder" %% "dispatch-http" % dispatchVersion :: Nil

  def dispatchOAuthDep =
    "net.databinder" %% "dispatch-oauth" % dispatchVersion

  def integrationTestDeps(sv: String) = (specsDep(sv) :: dispatchDeps) map { _ % "test" }
}

object Unfiltered extends Build {
  import Shared._

  def id(name: String) = "unfiltered-%s" format name

  def local(name: String) = LocalProject(id(name))

  val buildSettings = Defaults.defaultSettings ++ Seq(
    organization := "net.databinder",
    version := "0.5.2-SNAPSHOT",
    crossScalaVersions := Seq("2.8.0", "2.8.1", "2.8.2",
                              "2.9.0", "2.9.0-1", "2.9.1"),
    scalaVersion := "2.8.2",
    publishTo := Some("Scala Tools Nexus" at "http://nexus.scala-tools.org/content/repositories/releases/"),
    credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),
    scalacOptions ++= Seq("-Xcheckinit", "-encoding", "utf8"),
    parallelExecution in Test := false // :( test servers collide on same port
  )

  def srcPathSetting(projectId: String, rootPkg: String) = {
    mappings in (LocalProject(projectId), Compile, packageSrc) ~= {
      defaults: Seq[(File,String)] =>
        defaults.map { case(file, path) =>
          (file, rootPkg + "/" + path)
        }
    }
  }

  private def module(moduleName: String)(
    settings: Seq[Setting[_]],
    projectId: String = "unfiltered-" + moduleName,
    dirName: String = moduleName,
    srcPath: String = "unfiltered/" + moduleName.replace("-","/")
  ) = Project(projectId, file(dirName),
              settings = (buildSettings :+
                          srcPathSetting(projectId, srcPath)) ++ settings)

  lazy val unfiltered =
    Project("unfiltered-all", file("."),
            settings = buildSettings ++ Seq(name := "Unfiltered")
            ) aggregate(
            library, filters, filtersAsync , uploads, util, jetty,
            jettyAjpProject, netty, nettyServer, json, specHelpers,
            scalaTestHelpers, websockets, oauth, agents)

  lazy val library: Project =
    module("unfiltered")(
      dirName = "library",
      projectId = "unfiltered",
      settings = Seq(
        unmanagedClasspath in (LocalProject("unfiltered"), Test) <++=
          (fullClasspath in (local("spec"), Compile),
           fullClasspath in (local("filter"), Compile)) map { (s, f) =>
            s ++ f
        },
        libraryDependencies <++= scalaVersion(v => Seq(
          "commons-codec" % "commons-codec" % "1.4",
          Shared.specsDep(v) % "test"
        ) ++ integrationTestDeps(v))
      )
   ) dependsOn(util)

  lazy val filters =
    module("filter")(
      settings = Seq(
        unmanagedClasspath in (local("filter"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion(v => Seq(servletApiDep) ++
          integrationTestDeps(v))
      )) dependsOn(library)

  lazy val filtersAsync =
    module("filter-async")(
      settings = Seq(
        unmanagedClasspath in (local("filter-async"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion {
          v => Seq(servletApiDep,continuation) ++ integrationTestDeps(v)
        }
      )) dependsOn(filters)

  lazy val agents =
    module("agents")(
      srcPath = "unfiltered/request",
      settings = Seq(
        unmanagedClasspath in (local("agents"), Test) <++=
            (fullClasspath in (local("spec"), Compile),
             fullClasspath in (local("filter"), Compile)) map { (s, f) =>
              s ++ f
        },
        libraryDependencies <++= scalaVersion(v => Seq(servletApiDep) ++
          integrationTestDeps(v))
       )) dependsOn(library)

  lazy val uploads =
    module("uploads")(
      srcPath = "unfiltered/request",
      settings = Seq(
        unmanagedClasspath in (local("uploads"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion(v => Seq(
          servletApiDep,
          "commons-io" % "commons-io" % "1.4",
          "commons-fileupload" % "commons-fileupload" % "1.2.1"
        ) ++ integrationTestDeps(v))
       )) dependsOn(filters)

  lazy val util = module("util")(
    settings = Seq(
      // https://github.com/harrah/xsbt/issues/76
      publishArtifact in packageDoc := false
    ))

  lazy val jetty =
    module("jetty")(
      settings = Seq(
        libraryDependencies := Seq(
          "org.eclipse.jetty" % "jetty-webapp" % jettyVersion
        )
     )) dependsOn(util)

  lazy val jettyAjpProject =
    module("jetty-ajp")(
      settings = Seq(
        libraryDependencies := Seq(
          "org.eclipse.jetty" % "jetty-ajp" % jettyVersion
        )
      )) dependsOn(jetty)

  lazy val nettyServer =
    module("netty-server")(
      srcPath = "unfiltered/netty",
      settings = Seq(
        unmanagedClasspath in (local("netty-server"), Test) <++=
            (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <<= scalaVersion(integrationTestDeps _)
       )) dependsOn(netty, util)

  lazy val netty =
    module("netty")(
      settings = Seq(
        unmanagedClasspath in (local("netty"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion(v =>
          ("org.jboss.netty" % "netty" % "3.2.5.Final" withSources()) +:
          integrationTestDeps(v)
        )
      )) dependsOn(library)

  lazy val specHelpers =
    module("spec")(
      settings = Seq(
        libraryDependencies <++= scalaVersion { v =>
          specsDep(v) :: dispatchDeps
        }
      )) dependsOn(filters, jetty, nettyServer)

  lazy val scalaTestHelpers =
    module("scalatest")(
      settings = Seq(
        libraryDependencies ~= { _ ++
          ("org.scalatest" % "scalatest" % "1.3" :: dispatchDeps)
        }
      )) dependsOn(jetty, nettyServer)

  lazy val json =
    module("json")(
      srcPath = "unfiltered",
      settings = Seq(
        unmanagedClasspath in (local("json"), Test) <++=
          (fullClasspath in (local("spec"), Compile),
           fullClasspath in (local("filter"), Compile)) map { (s, f) =>
             s ++ f
          },
        libraryDependencies <++= scalaVersion(v => Seq(
          v.split('.').toList match {
            case "2" :: "8" :: "2" :: _ =>
              "net.liftweb" % "lift-json_2.8.1" % "2.4-M4"
            case _ =>
              "net.liftweb" %% "lift-json" % "2.4-M4"
          }) ++ integrationTestDeps(v))
      )) dependsOn(library)

  lazy val scalate =
    module("scalate")(
      settings = Seq(
        libraryDependencies <++= scalaVersion { v =>
          val scalateVersion = v match {
            case "2.8.0" | "2.8.1" => "1.5.2-scala_2.8.1"
            case _ => "1.5.2"
          }
          Seq(
            "org.fusesource.scalate" % "scalate-core" % scalateVersion,
            "org.fusesource.scalate" % "scalate-util" % scalateVersion % "test",
            "org.scala-lang" % "scala-compiler" % v % "test",
            "org.mockito" % "mockito-core" % "1.8.5" % "test"
          ) ++ integrationTestDeps(v)}
        )) dependsOn(library)

  lazy val websockets =
    module("netty-websockets")(
      settings = Seq(
        unmanagedClasspath in (local("netty-websockets"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion(integrationTestDeps _)
      )) dependsOn(nettyServer)

  lazy val oauth =
    module("oauth")(
      settings = Seq(
        unmanagedClasspath in (local("oauth"), Test) <++=
          (fullClasspath in (local("spec"), Compile)).identity,
        libraryDependencies <++= scalaVersion(v =>
          Seq(dispatchOAuthDep) ++
          integrationTestDeps(v))
      )) dependsOn(jetty, filters)
}

{'fraction_non_alphanumeric': 0.15703908682116915, 'fraction_numerical': 0.014008993427879627, 'mean_word_length': 2.4714828897338403, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '7418880', 'n_tokens_mistral': 5740, 'n_tokens_neox': 5553, 'n_words': 1123}