<commit_before>package edu.umass.cs.iesl.sbtbase

import sbt._
import sbt.Keys._
import scala.Some
import Config._

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @version $Id$
 */

object IeslProject {

  sealed case class SnapshotsAllowedType()

  case object WithSnapshotDependencies extends SnapshotsAllowedType

  case object NoSnapshotDependencies extends SnapshotsAllowedType


  sealed case class RepoType()

  case object Public extends RepoType

  case object Private extends RepoType


  def apply(id: String, vers: String, deps: Seq[ModuleID],
            repotype: RepoType, allowSnapshots: SnapshotsAllowedType = NoSnapshotDependencies): Project =
    Project(id, file("."))
      .settings(scalaSettings: _*)
      .settings(resolvers ++= ((if (allowSnapshots == WithSnapshotDependencies) IESLSnapshotRepos else Seq.empty) ++ IESLReleaseRepos))
      .settings(getJarsTask)
      .settings(
      organization := iesl,
      version := vers,
      scalaVersion := scalaV,
      libraryDependencies ++= deps,
      publishToIesl(vers, repotype),
      creds)

  def publishToIesl(vers: String, repotype: RepoType) = publishTo := {
    def repo(name: String) = name at nexusUrl + "/content/repositories/" + name
    val isSnapshot = vers.endsWith("SNAPSHOT")
    val isPrivate = if (repotype == Private) "private-" else ""
    val repoName = isPrivate + (if (isSnapshot) "snapshots" else "releases")
    Some(repo(repoName))
  }

  val creds = credentials += {
    Seq("build.publish.user", "build.publish.password").map(k => Option(System.getProperty(k))) match {
      case Seq(Some(user), Some(pass)) =>
        Credentials(publishRealm, publishHost, user, pass)
      case _ =>
        Credentials(Path.userHome / ".ivy2" / ".credentials")
    }
  }

  val scalaSettings = Seq(
    scalaVersion := scalaV,
    scalacOptions := Seq("-deprecation", "-unchecked", "-Xcheckinit", "-encoding", "utf8"),
    javacOptions ++= Seq("-Xlint:unchecked")
  )

  // todo: use this mechanism to print the classpath to a file, to record what "latest.release" actually resolved to for each dependency in this build.

  val getJars = TaskKey[Unit]("get-jars")

  val getJarsTask = getJars <<= (target, fullClasspath in Runtime) map { (target, cp) =>
    println("Target path is: "+target)
    println("Full classpath is: "+cp.map(_.data).mkString(":"))
  }
}
<commit_msg>javac utf8<commit_after>package edu.umass.cs.iesl.sbtbase

import sbt._
import sbt.Keys._
import scala.Some
import Config._

/**
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 * @version $Id$
 */

object IeslProject {

  sealed case class SnapshotsAllowedType()

  case object WithSnapshotDependencies extends SnapshotsAllowedType

  case object NoSnapshotDependencies extends SnapshotsAllowedType


  sealed case class RepoType()

  case object Public extends RepoType

  case object Private extends RepoType


  def apply(id: String, vers: String, deps: Seq[ModuleID],
            repotype: RepoType, allowSnapshots: SnapshotsAllowedType = NoSnapshotDependencies): Project =
    Project(id, file("."))
      .settings(scalaSettings: _*)
      .settings(resolvers ++= ((if (allowSnapshots == WithSnapshotDependencies) IESLSnapshotRepos else Seq.empty) ++ IESLReleaseRepos))
      .settings(getJarsTask)
      .settings(
      organization := iesl,
      version := vers,
      scalaVersion := scalaV,
      libraryDependencies ++= deps,
      publishToIesl(vers, repotype),
      creds)

  def publishToIesl(vers: String, repotype: RepoType) = publishTo := {
    def repo(name: String) = name at nexusUrl + "/content/repositories/" + name
    val isSnapshot = vers.endsWith("SNAPSHOT")
    val isPrivate = if (repotype == Private) "private-" else ""
    val repoName = isPrivate + (if (isSnapshot) "snapshots" else "releases")
    Some(repo(repoName))
  }

  val creds = credentials += {
    Seq("build.publish.user", "build.publish.password").map(k => Option(System.getProperty(k))) match {
      case Seq(Some(user), Some(pass)) =>
        Credentials(publishRealm, publishHost, user, pass)
      case _ =>
        Credentials(Path.userHome / ".ivy2" / ".credentials")
    }
  }

  val scalaSettings = Seq(
    scalaVersion := scalaV,
    scalacOptions := Seq("-deprecation", "-unchecked", "-Xcheckinit", "-encoding", "utf8"),
    javacOptions ++= Seq("-Xlint:unchecked", "-encoding", "utf8")
  )

  // todo: use this mechanism to print the classpath to a file, to record what "latest.release" actually resolved to for each dependency in this build.

  val getJars = TaskKey[Unit]("get-jars")

  val getJarsTask = getJars <<= (target, fullClasspath in Runtime) map { (target, cp) =>
    println("Target path is: "+target)
    println("Full classpath is: "+cp.map(_.data).mkString(":"))
  }
}

{'fraction_non_alphanumeric': 0.1300795978215333, 'fraction_numerical': 0.0012568077084206116, 'mean_word_length': 3.7702297702297702, 'pattern_counts': {'":': 2, '<': 15, '<?xml version=': 0, '>': 19, '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': '2366988', 'n_tokens_mistral': 1549, 'n_tokens_neox': 1492, 'n_words': 385}