<commit_before>import sbt._
import Keys._

object TriplePlayBuild extends Build {
  // we do some jockeying here to allow the intrepid developer to symlink a checkout of pythagoras
  // and forplay into the current directory, in which case SBT is instructed to use those directly
  // as dependent projects (allowing automatic rebuild of files therein when, for example, running
  // test targets here in tripleplay); if one or the other symlink does not exist, it will obtain
  // those dependencies via Maven
  def findProject (name :String, depend :ModuleID, project : => ProjectReference) =
    if (new java.io.File(name).exists) (None, Some(project)) else (Some(depend), None)

  val (localDeps, localProjs) = Seq(
    findProject("react", "com.threerings" % "react" % "1.0-SNAPSHOT",
                RootProject(file("react"))),
    findProject("pythagoras", "com.samskivert" % "pythagoras" % "1.1-SNAPSHOT",
                RootProject(file("pythagoras"))),
    findProject("forplay", "com.googlecode.forplay" % "core" % "1.0-SNAPSHOT",
                ProjectRef(file("forplay"), "core"))
  ) unzip

  lazy val tripleplay = (Project(
    "tripleplay", file("."), settings = Defaults.defaultSettings ++ Seq(
      organization := "com.threerings",
      version      := "1.0-SNAPSHOT",
      name         := "tripleplay",
      crossPaths   := false,
      scalaVersion := "2.9.0-1",

      javacOptions ++= Seq("-Xlint", "-Xlint:-serial"),
      fork in Compile := true,

      // TODO: reenable doc publishing when scaladoc doesn't choke on our code
      publishArtifact in (Compile, packageDoc) := false,

      resolvers += "Local Maven Repository" at Path.userHome.asURL + "/.m2/repository",

      // this hackery causes publish-local to install to ~/.m2/repository instead of ~/.ivy
      otherResolvers := Seq(Resolver.file("dotM2", file(Path.userHome + "/.m2/repository"))),
      publishLocalConfiguration <<= (packagedArtifacts, deliverLocal, ivyLoggingLevel) map {
        (arts, _, level) => new PublishConfiguration(None, "dotM2", arts, level)
      },

      autoScalaLibrary := false, // no scala-library dependency
      libraryDependencies ++= localDeps.flatten ++ Seq(
        // test dependencies
        "junit" % "junit" % "4.+" % "test",
 	      "com.novocode" % "junit-interface" % "0.7" % "test->default"
      )
    )
  ) /: localProjs.flatten) { _ dependsOn _ }
}<commit_msg>Tidied up my local project resolution code.<commit_after>import sbt._
import Keys._

// allows projects to be symlinked into the current directory for a direct dependency,
// or fall back to obtaining the project from Maven otherwise
class Local (locals :(String, String, ModuleID)*) {
  def addDeps (p :Project) = (locals collect {
    case (id, subp, dep) if (file(id).exists) => symproj(file(id), subp)
  }).foldLeft(p) { _ dependsOn _ }
  def libDeps = locals collect {
    case (id, subp, dep) if (!file(id).exists) => dep
  }
  private def symproj (dir :File, subproj :String = null) =
    if (subproj == null) RootProject(dir) else ProjectRef(dir, subproj)
}

object TriplePlayBuild extends Build {
  val locals = new Local(
    ("pythagoras", null,  "com.samskivert" % "pythagoras" % "1.1-SNAPSHOT"),
    ("react",      null,  "com.threerings" % "react" % "1.0-SNAPSHOT"),
    ("forplay",   "core", "com.googlecode.forplay" % "core" % "1.0-SNAPSHOT")
  )

  lazy val tripleplay = locals.addDeps(Project(
    "tripleplay", file("."), settings = Defaults.defaultSettings ++ Seq(
      organization := "com.threerings",
      version      := "1.0-SNAPSHOT",
      name         := "tripleplay",
      crossPaths   := false,
      scalaVersion := "2.9.0-1",

      javacOptions ++= Seq("-Xlint", "-Xlint:-serial"),
      fork in Compile := true,

      // TODO: reenable doc publishing when scaladoc doesn't choke on our code
      publishArtifact in (Compile, packageDoc) := false,

      resolvers += "Local Maven Repository" at Path.userHome.asURL + "/.m2/repository",

      // this hackery causes publish-local to install to ~/.m2/repository instead of ~/.ivy
      otherResolvers := Seq(Resolver.file("dotM2", file(Path.userHome + "/.m2/repository"))),
      publishLocalConfiguration <<= (packagedArtifacts, deliverLocal, ivyLoggingLevel) map {
        (arts, _, level) => new PublishConfiguration(None, "dotM2", arts, level)
      },

      autoScalaLibrary := false, // no scala-library dependency
      libraryDependencies ++= locals.libDeps ++ Seq(
        // test dependencies
        "junit" % "junit" % "4.+" % "test",
 	      "com.novocode" % "junit-interface" % "0.7" % "test->default"
      )
    )
  ))
}
{'fraction_non_alphanumeric': 0.14196332254584682, 'fraction_numerical': 0.008629989212513484, 'mean_word_length': 3.1245551601423487, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, 'https://': 0, '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': '4781377', 'n_tokens_mistral': 1506, 'n_tokens_neox': 1476, 'n_words': 405}