<commit_before>import sbt._
import Keys._
import ls.Plugin.LsKeys

object Shared {

  val servletApiDep = "javax.servlet" % "servlet-api" % "2.3" % "provided"
  val jettyVersion = "7.6.0.v20120127"
  val continuation = "org.eclipse.jetty" % "jetty-continuation" % jettyVersion % "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 _ => sys.error("specs not supported for scala version %s" format sv)
    }

  val dispatchVersion = "0.8.6"
  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 ++
    ls.Plugin.lsSettings ++
    Seq(
    organization := "net.databinder",
    version := "0.6.0",
    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", "-deprecation", "-unchecked"),
    parallelExecution in Test := false, // :( test servers collide on same port
    homepage :=
      Some(new java.net.URL("http://unfiltered.databinder.net/")),
    publishMavenStyle := true,
    publishTo :=
      Some("releases" at
           "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
    publishArtifact in Test := false,
    licenses := Seq("MIT" -> url("http://www.opensource.org/licenses/MIT")),
    pomExtra := (
      <scm>
        <url><EMAIL>:unfiltered/unfiltered.git</url>
        <connection>scm:git:git@github.com:unfiltered/unfiltered.git</connection>
      </scm>
      <developers>
        <developer>
          <id>n8han</id>
          <name><NAME></name>
          <url>http://twitter.com/n8han</url>
        </developer>
        <developer>
          <id>softprops</id>
          <name><NAME></name>
          <url>http://twitter.com/softprops</url>
        </developer>
      </developers>)

  )

  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",
              LsKeys.skipWrite := true
            )) 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(
        description :=
          "Core library for describing requests and responses",
        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(
        description :=
          "Server binding for Java Servlet filters",
        unmanagedClasspath in (local("filter"), Test) <++=
          (fullClasspath in (local("spec"), Compile)),
        libraryDependencies <++= scalaVersion(v => Seq(servletApiDep) ++
          integrationTestDeps(v))
      )) dependsOn(library)

  lazy val filtersAsync =
    module("filter-async")(
      settings = Seq(
        description :=
          "Server binding for Java Servlet 3.0 async filters",
        unmanagedClasspath in (local("filter-async"), Test) <++=
          (fullClasspath in (local("spec"), Compile)),
        libraryDependencies <++= scalaVersion {
          v => Seq(servletApiDep,continuation) ++ integrationTestDeps(v)
        }
      )) dependsOn(filters)

  lazy val agents =
    module("agents")(
      srcPath = "unfiltered/request",
      settings = Seq(
        description :=
          "User-Agent request matchers",
        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(
        description :=
          "Support for multi-part uploads for servlet filters",
        unmanagedClasspath in (local("uploads"), Test) <++=
          (fullClasspath in (local("spec"), Compile)),
        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(
        description :=
          "Jetty server embedding module",
        libraryDependencies := Seq(
          "org.eclipse.jetty" % "jetty-webapp" % jettyVersion<commit_msg>obscene workaround to satisfy an obscene requirement<commit_after>import sbt._
import Keys._
import ls.Plugin.LsKeys

object Shared {

  val servletApiDep = "javax.servlet" % "servlet-api" % "2.3" % "provided"
  val jettyVersion = "7.6.0.v20120127"
  val continuation = "org.eclipse.jetty" % "jetty-continuation" % jettyVersion % "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 _ => sys.error("specs not supported for scala version %s" format sv)
    }

  val dispatchVersion = "0.8.6"
  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 ++
    ls.Plugin.lsSettings ++
    Seq(
    organization := "net.databinder",
    version := "0.6.0",
    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", "-deprecation", "-unchecked"),
    parallelExecution in Test := false, // :( test servers collide on same port
    homepage :=
      Some(new java.net.URL("http://unfiltered.databinder.net/")),
    publishMavenStyle := true,
    publishTo :=
      Some("releases" at
           "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
    publishArtifact in Test := false,
    licenses := Seq("MIT" -> url("http://www.opensource.org/licenses/MIT")),
    pomExtra := (
      <scm>
        <url><EMAIL>:unfiltered/unfiltered.git</url>
        <connection>scm:git:git@github.<EMAIL>:unfiltered/unfiltered.git</connection>
      </scm>
      <developers>
        <developer>
          <id>n8han</id>
          <name><NAME></name>
          <url>http://twitter.com/n8han</url>
        </developer>
        <developer>
          <id>softprops</id>
          <name><NAME></name>
          <url>http://twitter.com/softprops</url>
        </developer>
      </developers>)

  )

  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",
              LsKeys.skipWrite := true
            )) 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(
        description :=
          "Core library for describing requests and responses",
        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(
        description :=
          "Server binding for Java Servlet filters",
        unmanagedClasspath in (local("filter"), Test) <++=
          (fullClasspath in (local("spec"), Compile)),
        libraryDependencies <++= scalaVersion(v => Seq(servletApiDep) ++
          integrationTestDeps(v))
      )) dependsOn(library)

  lazy val filtersAsync =
    module("filter-async")(
      settings = Seq(
        description :=
          "Server binding for Java Servlet 3.0 async filters",
        unmanagedClasspath in (local("filter-async"), Test) <++=
          (fullClasspath in (local("spec"), Compile)),
        libraryDependencies <++= scalaVersion {
          v => Seq(servletApiDep,continuation) ++ integrationTestDeps(v)
        }
      )) dependsOn(filters)

  lazy val agents =
    module("agents")(
      srcPath = "unfiltered/request",
      settings = Seq(
        description :=
          "User-Agent request matchers",
        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(
        description :=
          "Support for multi-part uploads for servlet filters",
        unmanagedClasspath in (local("uploads"), Test) <++=
          (fullClasspath in (local("spec"), Compile)),
        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/85#issuecomment-1687483
      unmanagedClasspath in Compile += Attributed.blank(new java.io.File("doesnotexist"))
    ))

  lazy val jetty =
    module("jetty")(
      settings = Seq(
        description :=
          "Jetty server embedding module",
        libraryDependencies := Seq(
          "org.eclipse.jetty" % "jetty-webapp" % jettyVersion
{'fraction_non_alphanumeric': 0.1538066221275971, 'fraction_numerical': 0.012113648043462301, 'mean_word_length': 2.538181818181818, 'pattern_counts': {'":': 0, '<': 78, '<?xml version=': 0, '>': 86, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 1, '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': '7107444', 'n_tokens_mistral': 4389, 'n_tokens_neox': 4216, 'n_words': 890}