Skip to content

Commit

Permalink
Build system tweaks (wavesplatform#3943)
Browse files Browse the repository at this point in the history
  • Loading branch information
phearnot authored Mar 12, 2024
1 parent 979d2ea commit c374b48
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 55 deletions.
2 changes: 1 addition & 1 deletion build-with-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ docker run \
-e HOME=/opt/sbt/home \
-w /src \
--rm -it wavesplatform/node-sbt-builder:$WAVES_VERSION \
/bin/sh -c "sbt --batch --mem 2048 packageAll"
/bin/sh -c "sbt --batch --mem 4096 packageAll"
1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ inScope(Global)(
network := Network.default(),
instrumentation := false,
resolvers ++= Resolver.sonatypeOssRepos("releases") ++ Resolver.sonatypeOssRepos("snapshots") ++ Seq(Resolver.mavenLocal),
Compile / doc / sources := Seq.empty,
Compile / packageDoc / publishArtifact := false,
concurrentRestrictions := Seq(Tags.limit(Tags.Test, math.min(EvaluateTask.SystemProcessors, 8))),
excludeLintKeys ++= Set(
Expand Down
14 changes: 12 additions & 2 deletions lang/jvm/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
ThisProject / publishTo := sonatypePublishToBundle.value
ThisProject / publish / skip := false
publishTo := sonatypePublishToBundle.value
publish / skip := false
homepage := Some(url("https://docs.waves.tech/en/ride/"))
developers := List(
Developer("ismagin", "Ilya Smagin", "[email protected]", url("https://github.com/ismagin")),
Developer("asayadyan", "Artyom Sayadyan", "[email protected]", url("https://github.com/xrtm000")),
Developer("mpotanin", "Mike Potanin", "[email protected]", url("https://github.com/potan")),
Developer("irakitnykh", "Ivan Rakitnykh", "[email protected]", url("https://github.com/mrkraft"))
)

Compile / packageDoc / publishArtifact := true
Test / packageDoc / publishArtifact := false

inTask(assembly)(
Seq(
Expand Down
24 changes: 1 addition & 23 deletions node/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,7 @@ inConfig(Compile)(
)
)

inTask(assembly)(
Seq(
test := {},
assemblyJarName := s"waves-all-${version.value}.jar",
assemblyMergeStrategy := {
case p
if p.endsWith(".proto") ||
p.endsWith("module-info.class") ||
p.endsWith("io.netty.versions.properties") ||
p.endsWith(".kotlin_module") =>
MergeStrategy.discard

case "scala-collection-compat.properties" =>
MergeStrategy.discard
case p
if Set("scala/util/control/compat", "scala/collection/compat")
.exists(p.replace('\\', '/').contains) =>
MergeStrategy.last

case other => (assembly / assemblyMergeStrategy).value(other)
}
)
)
inTask(assembly)(CommonSettings.assemblySettings)

// Adds "$lib_dir/*" to app_classpath in the executable file, this is needed for extensions
scriptClasspath += "*"
Expand Down
30 changes: 26 additions & 4 deletions project/CommonSettings.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
import sbt.Keys._
import sbt._
import sbt.*
import sbt.Keys.{test, version, name}
import sbtassembly.AssemblyKeys.{assembly, assemblyMergeStrategy}
import sbtassembly.AssemblyPlugin.autoImport.assemblyJarName
import sbtassembly.{MergeStrategy, PathList}

object CommonSettings extends AutoPlugin {
object autoImport extends CommonKeys
import autoImport._

override def trigger: PluginTrigger = allRequirements

// These options doesn't work for ScalaJS
override def projectSettings: Seq[Def.Setting[_]] = Seq()
override def projectSettings: Seq[Def.Setting[?]] = Seq()

val assemblySettings: Seq[Def.Setting[?]] = Seq(
assemblyJarName := s"${name.value}-all-${version.value}.jar",
test := {},
assemblyMergeStrategy := {
case p
if p.endsWith(".proto") ||
p.endsWith("module-info.class") ||
p.endsWith("io.netty.versions.properties") ||
p.endsWith(".kotlin_module") =>
MergeStrategy.discard

case "scala-collection-compat.properties" =>
MergeStrategy.discard

case "logback.xml" | PathList("scala", "util", "control", "compat") | PathList("scala", "collection", "compat") |
PathList("swagger-ui", "openapi.yaml") =>
MergeStrategy.last
case other => (assembly / assemblyMergeStrategy).value(other)
})
}

trait CommonKeys {
Expand Down
28 changes: 4 additions & 24 deletions ride-runner/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,8 @@ inConfig(Debian)(

// Fat JAR settings
inTask(assembly)(
Seq(
test := {},
mainClass := Some("com.wavesplatform.ride.runner.entrypoints.WavesRideRunnerWithPreparedStateApp"),
assemblyJarName := s"waves-ride-runner-all-${version.value}.jar",
assemblyMergeStrategy := {
case p
if p.endsWith(".proto") ||
p.endsWith("module-info.class") ||
p.endsWith("io.netty.versions.properties") ||
p.endsWith(".kotlin_module") =>
MergeStrategy.discard

case "scala-collection-compat.properties" =>
MergeStrategy.discard
case p
if Set("scala/util/control/compat", "scala/collection/compat")
.exists(p.replace('\\', '/').contains) =>
MergeStrategy.last

case "logback.xml" | "swagger-ui/openapi.yaml" => MergeStrategy.last

case other => (assembly / assemblyMergeStrategy).value(other)
}
)
CommonSettings.assemblySettings ++
Seq(
mainClass := Some("com.wavesplatform.ride.runner.entrypoints.WavesRideRunnerWithPreparedStateApp")
)
)

0 comments on commit c374b48

Please sign in to comment.