<commit_before>import com.typesafe.sbt.SbtNativePackager.autoImport._
import sbt.Keys._

addCommandAlias("packageAll", "; clean " +
  "; systemd/packageDebianSystemd " +
  "; clean " +
  "; upstart/packageDebianUpstart " +
  "; clean" +
  "; packageJar"
)

val network = Option(System.getProperty("network")).getOrElse("mainnet")

// see https://github.com/muuki88/sbt-native-packager-examples/blob/master/multiple-package-outputs/build.sbt and https://github.com/muuki88/sbt-native-packager-examples/blob/master/multi-module-build/build.sbt
lazy val packageDebianUpstart = taskKey[File]("creates deb with upstart loader")
lazy val packageDebianSystemd = taskKey[File]("creates deb with systemd loader")
lazy val packageJar = taskKey[File]("creates fat jar")

lazy val packageDebianUpstartTask = packageDebianUpstart := {
  val output = (baseDirectory in root).value / "package" / s"waves-$network-upstart-${version.value}.deb"
  val debianFile = (packageBin in Debian).value
  streams.value.log.info(s"Moving package ${debianFile.getAbsoluteFile} to ${output.getAbsolutePath}")
  IO.move(debianFile, output)
  output
}

lazy val packageDebianSystemdTask = packageDebianSystemd := {
  val output = (baseDirectory in root).value / "package" / s"waves-$network-systemd-${version.value}.deb"
  val debianFile = (packageBin in Debian).value
  streams.value.log.info(s"Moving package ${debianFile.getAbsoluteFile} to ${output.getAbsolutePath}")
  IO.move(debianFile, output)
  output
}

lazy val packageJarTask = packageJar := {
  val output = baseDirectory.value / "package" / s"waves-${version.value}.jar"
  val jarFile = (assembly in Compile).value
  streams.value.log.info(s"Moving package ${jarFile.getAbsoluteFile} to ${output.getAbsolutePath}")
  IO.move(jarFile, output)
  output
}

val commonSettings: Seq[Setting[_]] = Seq(
  javaOptions in Universal ++= Seq(
    "-J-server",
    // JVM memory tuning for 1g ram
    "-J-Xms128m",
    "-J-Xmx1024m",

    // from https://groups.google.com/d/msg/akka-user/9s4Yl7aEz3E/zfxmdc0cGQAJ
    "-J-XX:+UseG1GC",
    "-J-XX:+UseNUMA",
    "-J-XX:+AlwaysPreTouch",

    // may be can't use with jstack and others tools
    "-J-XX:+PerfDisableSharedMem",
    "-J-XX:+ParallelRefProcEnabled",
    "-J-XX:+UseStringDeduplication",

    "-J-Dsun.net.inetaddr.ttl=60"),
  assemblyMergeStrategy in assembly := {
    case "application.conf" => MergeStrategy.concat
    case x =>
      val oldStrategy = (assemblyMergeStrategy in assembly).value
      oldStrategy(x)
  },
  mainClass in Compile := Some("com.wavesplatform.Application"),
  packageJarTask
)

import NativePackagerHelper._

val debianSettings = Seq(
  maintainer in Linux := "wavesplatform.com",
  packageName := {
    if (network == "mainnet") {
      "waves"
    } else if (network == "testnet") {
      "waves-testnet"
    } else {
      throw new IllegalStateException("invalid network")
    }
  },
  packageSummary in Linux := "Waves node implementation on top of Scorex",
  packageDescription in Linux := "Waves node",
  maintainerScripts in Debian := maintainerScriptsAppend((maintainerScripts in Debian).value)(
    DebianConstants.Postinst -> s"mkdir -p /home/waves && mkdir -p /home/waves/wallet && mkdir -p /home/waves/data && chmod -R 750 /home/waves && chmod -R 750 /usr/share/waves && chmod -R 750 /usr/share/waves/settings.json && chown -R waves:waves /home/waves && chown -R waves:waves /usr/share/waves"),
  mappings in Universal ++= {
    if (network == "mainnet") {
      Seq((baseDirectory in root).value / "waves-mainnet.json" -> "settings.json")<commit_msg>Added deb dependency to oracle jre 8<commit_after>import com.typesafe.sbt.SbtNativePackager.autoImport._
import sbt.Keys._

addCommandAlias("packageAll", "; clean " +
  "; systemd/packageDebianSystemd " +
  "; clean " +
  "; upstart/packageDebianUpstart " +
  "; clean" +
  "; packageJar"
)

val network = Option(System.getProperty("network")).getOrElse("mainnet")

// see https://github.com/muuki88/sbt-native-packager-examples/blob/master/multiple-package-outputs/build.sbt and https://github.com/muuki88/sbt-native-packager-examples/blob/master/multi-module-build/build.sbt
lazy val packageDebianUpstart = taskKey[File]("creates deb with upstart loader")
lazy val packageDebianSystemd = taskKey[File]("creates deb with systemd loader")
lazy val packageJar = taskKey[File]("creates fat jar")

lazy val packageDebianUpstartTask = packageDebianUpstart := {
  val output = (baseDirectory in root).value / "package" / s"waves-$network-upstart-${version.value}.deb"
  val debianFile = (packageBin in Debian).value
  streams.value.log.info(s"Moving package ${debianFile.getAbsoluteFile} to ${output.getAbsolutePath}")
  IO.move(debianFile, output)
  output
}

lazy val packageDebianSystemdTask = packageDebianSystemd := {
  val output = (baseDirectory in root).value / "package" / s"waves-$network-systemd-${version.value}.deb"
  val debianFile = (packageBin in Debian).value
  streams.value.log.info(s"Moving package ${debianFile.getAbsoluteFile} to ${output.getAbsolutePath}")
  IO.move(debianFile, output)
  output
}

lazy val packageJarTask = packageJar := {
  val output = baseDirectory.value / "package" / s"waves-${version.value}.jar"
  val jarFile = (assembly in Compile).value
  streams.value.log.info(s"Moving package ${jarFile.getAbsoluteFile} to ${output.getAbsolutePath}")
  IO.move(jarFile, output)
  output
}

val commonSettings: Seq[Setting[_]] = Seq(
  javaOptions in Universal ++= Seq(
    "-J-server",
    // JVM memory tuning for 1g ram
    "-J-Xms128m",
    "-J-Xmx1024m",

    // from https://groups.google.com/d/msg/akka-user/9s4Yl7aEz3E/zfxmdc0cGQAJ
    "-J-XX:+UseG1GC",
    "-J-XX:+UseNUMA",
    "-J-XX:+AlwaysPreTouch",

    // may be can't use with jstack and others tools
    "-J-XX:+PerfDisableSharedMem",
    "-J-XX:+ParallelRefProcEnabled",
    "-J-XX:+UseStringDeduplication",

    "-J-Dsun.net.inetaddr.ttl=60"),
  assemblyMergeStrategy in assembly := {
    case "application.conf" => MergeStrategy.concat
    case x =>
      val oldStrategy = (assemblyMergeStrategy in assembly).value
      oldStrategy(x)
  },
  mainClass in Compile := Some("com.wavesplatform.Application"),
  packageJarTask
)

import NativePackagerHelper._

val debianSettings = Seq(
  maintainer in Linux := "wavesplatform.com",
  packageName := {
    if (network == "mainnet") {
      "waves"
    } else if (network == "testnet") {
      "waves-testnet"
    } else {
      throw new IllegalStateException("invalid network")
    }
  },
  packageSummary in Linux := "Waves node implementation on top of Scorex",
  packageDescription in Linux := "Waves node",
  maintainerScripts in Debian := maintainerScriptsAppend((maintainerScripts in Debian).value)(
    DebianConstants.Postinst -> s"mkdir -p /home/waves && mkdir -p /home/waves/wallet && mkdir -p /home/waves/data && chmod -R 750 /home/waves && chmod -R 750 /usr/share/waves && chmod -R 750 /usr/share/waves/settings.json && chown -R waves:waves /home/waves && chown -R waves:waves /usr/share/waves"),
  debianPackageDependencies in Debian += "java8-runtime-headless",
  mappings in Universal ++= {
    if (network == "mainnet") {
      Seq((baseDirectory in root).value / "waves-mainnet.json" -> "settings.json")
{'fraction_non_alphanumeric': 0.14118134142975436, 'fraction_numerical': 0.008280430582390284, 'mean_word_length': 4.074929971988795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 6, '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': '5761694', 'n_tokens_mistral': 2514, 'n_tokens_neox': 2378, 'n_words': 509}