<commit_before>import com.typesafe.sbt.pgp.PgpKeys._
import org.scalajs.sbtplugin.ScalaJSPlugin
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt.Keys._
import sbt._

object Build extends Build {

  val Scala211 = "2.11.7"

  val scalajsReactVersion = "0.10.2"
  val scalaCSSVersion = "0.3.1"

  type PE = Project => Project

  def commonSettings: PE =
    _.enablePlugins(ScalaJSPlugin)
      .settings(
        organization         := "com.github.chandu0101.scalajs-react-components",
        version              := "0.2.1-SNAPSHOT",
        homepage             := Some(url("https://github.com/chandu0101/scalajs-react-components")),
        licenses             += ("Apache-2.0", url("http://opensource.org/licenses/Apache-2.0")),
        scalaVersion         := Scala211,
        scalacOptions       ++= Seq("-deprecation", "-unchecked", "-feature",
                                  "-language:postfixOps", "-language:implicitConversions",
                                  "-language:higherKinds", "-language:existentials"), //"-Ymacro-debug-lite"
        updateOptions        := updateOptions.value.withCachedResolution(true),
        dependencyOverrides ++= Set(
          "org.scala-js"   %% "scalajs-test-interface" % "0.6.5"
        )
      )

  def definesMacros: Project => Project =
    _.settings(
      scalacOptions += "-language:experimental.macros",
      libraryDependencies ++= Seq(
        "org.scala-lang" % "scala-reflect" % Scala211,
        "org.scala-lang" % "scala-compiler" % Scala211 % Provided))

  def preventPublication: PE =
    _.settings(
      publishArtifact := false,
      publishLocalSigned := (),       // doesn't work
      publishSigned := (),            // doesn't work
      publish := (),
      packagedArtifacts := Map.empty) // doesn't work - https://github.com/sbt/sbt-pgp/issues/42

  def publicationSettings: PE =
    _.settings(
      publishTo := {
        val nexus = "https://oss.sonatype.org/"
        if (isSnapshot.value)
          Some("snapshots" at nexus + "content/repositories/snapshots")
        else
          Some("releases"  at nexus + "service/local/staging/deploy/maven2")
      },
      pomExtra :=
        <scm>
          <connection>scm:git:github.com:chandu0101/scalajs-react-components</connection>
          <developerConnection>scm:git:<EMAIL>:chandu0101/scalajs-react-components.git</developerConnection>
          <url>github.com:chandu0101/scalajs-react-components.git</url>
        </scm>
        <developers>
          <developer>
            <id>chandu0101</id>
            <name><NAME></name>
          </developer>
          <developer>
            <id>elacin</id>
            <name><NAME></name>
          </developer>
        </developers>)
    .configure(sourceMapsToGithub)

  def sourceMapsToGithub: PE =
    p => p.settings(
      scalacOptions ++= (if (isSnapshot.value) Seq.empty else Seq({
        val a = p.base.toURI.toString.replaceFirst("[^/]+/?$", "")
        val g = "https://raw.githubusercontent.com/chandu0101/scalajs-react-components"
        s"-P:scalajs:mapSourceURI:$a->$g/v${version.value}/"
      }))
    )

  def utestSettings: PE =
      _.settings(
      libraryDependencies  += "com.lihaoyi" %%% "utest" % "0.3.0" % Test,
      testFrameworks       += new TestFramework("utest.runner.Framework"),
      scalaJSStage in Test := FastOptStage,
      requiresDOM          := true,
      jsEnv in Test        := PhantomJSEnv().value)

  def useReact(scope: Configuration = Compile): PE =
    _.settings(
      libraryDependencies += "com.github.japgolly.scalajs-react" %%% "extra" % scalajsReactVersion % scope
    )

    val jsDir = "demo/assets"

    def createLauncher(scope: String = "compile"): PE =
    _.settings(persistLauncher := true,
      persistLauncher in Test := false,
      crossTarget in (Compile, fullOptJS) := file(jsDir),
      crossTarget in (Compile, fastOptJS) := file(jsDir),
//      crossTarget in (Compile, packageLauncher) := file(jsDir),
      artifactPath in (Compile, fastOptJS) := ((crossTarget in (Compile, fastOptJS)).value /
        ((moduleName in fastOptJS).value + "-opt.js"))
    )

  def addCommandAliases(m: (String, String)*) = {
    val s = m.map(p => addCommandAlias(p._1, p._2)).reduce(_ ++ _)
    (_: Project).settings(s: _*)
  }

  // ==============================================================================================

  lazy val macros = project
    .configure(commonSettings, utestSettings, publicationSettings, definesMacros, useReact())
    .settings(
      name := "macros",
      libraryDependencies ++= Seq(
        "org.scalatest" %%% "scalatest" % "3.0.0-M7" % Test
      )
    )

  // ==============================================================================================
  lazy val core = project
    .configure(commonSettings, publicationSettings, useReact())
    .dependsOn(macros)
    .settings(
      name := "core",
      libraryDependencies ++= Seq(
        "com.github.japgolly.scalacss"      %%% "core"      % scalaCSSVersion,
        "com.github.japgolly.scalacss"      %%% "ext-react" % scalaCSSVersion
      ),
      target in Compile in doc := baseDirectory.value / "docs"
    )

  // ==============================================================================================
  lazy val demo = project
    .dependsOn(core)
    .configure(commonSettings, createLauncher(), preventPublication)

  // ==============================================================================================
  lazy val root = Project("root", file("."))
    .aggregate(macros, core, demo)
    .configure(commonSettings, preventPublication, addCommandAliases(
      "t"  -> "; test:compile ; test/test",
      "tt" -> ";+test:compile ;+test/test",
      "T"  -> "; clean ;t",
      "TT" -> ";+clean ;tt")
    )
}
<commit_msg>update utest 0.3.0 -> 0.3.1 & scalatest 3.0.0-M7 -> 3.0.0-M12<commit_after>import com.typesafe.sbt.pgp.PgpKeys._
import org.scalajs.sbtplugin.ScalaJSPlugin
import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
import sbt.Keys._
import sbt._

object Build extends Build {

  val Scala211 = "2.11.7"

  val scalajsReactVersion = "0.10.2"
  val scalaCSSVersion = "0.3.1"

  type PE = Project => Project

  def commonSettings: PE =
    _.enablePlugins(ScalaJSPlugin)
      .settings(
        organization         := "com.github.chandu0101.scalajs-react-components",
        version              := "0.2.1-SNAPSHOT",
        homepage             := Some(url("https://github.com/chandu0101/scalajs-react-components")),
        licenses             += ("Apache-2.0", url("http://opensource.org/licenses/Apache-2.0")),
        scalaVersion         := Scala211,
        scalacOptions       ++= Seq("-deprecation", "-unchecked", "-feature",
                                  "-language:postfixOps", "-language:implicitConversions",
                                  "-language:higherKinds", "-language:existentials"), //"-Ymacro-debug-lite"
        updateOptions        := updateOptions.value.withCachedResolution(true),
        dependencyOverrides ++= Set(
          "org.scala-js"   %% "scalajs-test-interface" % "0.6.5"
        )
      )

  def definesMacros: Project => Project =
    _.settings(
      scalacOptions += "-language:experimental.macros",
      libraryDependencies ++= Seq(
        "org.scala-lang" % "scala-reflect" % Scala211,
        "org.scala-lang" % "scala-compiler" % Scala211 % Provided))

  def preventPublication: PE =
    _.settings(
      publishArtifact := false,
      publishLocalSigned := (),       // doesn't work
      publishSigned := (),            // doesn't work
      publish := (),
      packagedArtifacts := Map.empty) // doesn't work - https://github.com/sbt/sbt-pgp/issues/42

  def publicationSettings: PE =
    _.settings(
      publishTo := {
        val nexus = "https://oss.sonatype.org/"
        if (isSnapshot.value)
          Some("snapshots" at nexus + "content/repositories/snapshots")
        else
          Some("releases"  at nexus + "service/local/staging/deploy/maven2")
      },
      pomExtra :=
        <scm>
          <connection>scm:git:github.com:chandu0101/scalajs-react-components</connection>
          <developerConnection>scm:git:git@github.com:chandu0101/scalajs-react-components.git</developerConnection>
          <url>github.com:chandu0101/scalajs-react-components.git</url>
        </scm>
        <developers>
          <developer>
            <id>chandu0101</id>
            <name><NAME></name>
          </developer>
          <developer>
            <id>elacin</id>
            <name><NAME></name>
          </developer>
        </developers>)
    .configure(sourceMapsToGithub)

  def sourceMapsToGithub: PE =
    p => p.settings(
      scalacOptions ++= (if (isSnapshot.value) Seq.empty else Seq({
        val a = p.base.toURI.toString.replaceFirst("[^/]+/?$", "")
        val g = "https://raw.githubusercontent.com/chandu0101/scalajs-react-components"
        s"-P:scalajs:mapSourceURI:$a->$g/v${version.value}/"
      }))
    )

  def utestSettings: PE =
      _.settings(
      libraryDependencies  += "com.lihaoyi" %%% "utest" % "0.3.1" % Test,
      testFrameworks       += new TestFramework("utest.runner.Framework"),
      scalaJSStage in Test := FastOptStage,
      requiresDOM          := true,
      jsEnv in Test        := PhantomJSEnv().value)

  def useReact(scope: Configuration = Compile): PE =
    _.settings(
      libraryDependencies += "com.github.japgolly.scalajs-react" %%% "extra" % scalajsReactVersion % scope
    )

    val jsDir = "demo/assets"

    def createLauncher(scope: String = "compile"): PE =
    _.settings(persistLauncher := true,
      persistLauncher in Test := false,
      crossTarget in (Compile, fullOptJS) := file(jsDir),
      crossTarget in (Compile, fastOptJS) := file(jsDir),
//      crossTarget in (Compile, packageLauncher) := file(jsDir),
      artifactPath in (Compile, fastOptJS) := ((crossTarget in (Compile, fastOptJS)).value /
        ((moduleName in fastOptJS).value + "-opt.js"))
    )

  def addCommandAliases(m: (String, String)*) = {
    val s = m.map(p => addCommandAlias(p._1, p._2)).reduce(_ ++ _)
    (_: Project).settings(s: _*)
  }

  // ==============================================================================================

  lazy val macros = project
    .configure(commonSettings, utestSettings, publicationSettings, definesMacros, useReact())
    .settings(
      name := "macros",
      libraryDependencies ++= Seq(
        "org.scalatest" %%% "scalatest" % "3.0.0-M12" % Test
      )
    )

  // ==============================================================================================
  lazy val core = project
    .configure(commonSettings, publicationSettings, useReact())
    .dependsOn(macros)
    .settings(
      name := "core",
      libraryDependencies ++= Seq(
        "com.github.japgolly.scalacss"      %%% "core"      % scalaCSSVersion,
        "com.github.japgolly.scalacss"      %%% "ext-react" % scalaCSSVersion
      ),
      target in Compile in doc := baseDirectory.value / "docs"
    )

  // ==============================================================================================
  lazy val demo = project
    .dependsOn(core)
    .configure(commonSettings, createLauncher(), preventPublication)

  // ==============================================================================================
  lazy val root = Project("root", file("."))
    .aggregate(macros, core, demo)
    .configure(commonSettings, preventPublication, addCommandAliases(
      "t"  -> "; test:compile ; test/test",
      "tt" -> ";+test:compile ;+test/test",
      "T"  -> "; clean ;t",
      "TT" -> ";+clean ;tt")
    )
}

{'fraction_non_alphanumeric': 0.20326105514768653, 'fraction_numerical': 0.013829605600136588, 'mean_word_length': 2.6620819005939356, 'pattern_counts': {'":': 0, '<': 52, '<?xml version=': 0, '>': 72, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7617157', 'n_tokens_mistral': 3745, 'n_tokens_neox': 3506, 'n_words': 618}