-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
86 lines (80 loc) · 3.75 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import com.lightbend.sbt.javaagent.Modules
import sbt.Keys.resourceGenerators
import BundleKeys._
resolvers += Resolver.mavenLocal
lazy val instrumentationModules: Seq[ModuleID] = Seq(
"io.kamon" %% "kamon-executors" % "2.0.2",
"io.kamon" %% "kamon-scala-future" % "2.0.1",
"io.kamon" %% "kamon-scalaz-future" % "2.0.0",
"io.kamon" %% "kamon-akka" % "2.0.2",
"io.kamon" %% "kamon-akka-http" % "2.0.3",
"io.kamon" %% "kamon-play" % "2.0.0",
"io.kamon" %% "kamon-jdbc" % "2.0.2",
"io.kamon" %% "kamon-logback" % "2.0.2",
"io.kamon" %% "kamon-mongo" % "2.0.1",
"io.kamon" %% "kamon-annotation" % "2.0.1",
"io.kamon" %% "kamon-system-metrics" % "2.0.1" exclude("org.slf4j", "slf4j-api")
)
lazy val instrumentationModulesWithoutTwoThirteen: Seq[ModuleID] = Seq(
"io.kamon" %% "kamon-cats-io" % "2.0.0",
"io.kamon" %% "kamon-twitter-future" % "2.0.0"
)
val versionSettings = Seq(
kamonCoreVersion := "2.0.4",
kanelaAgentVersion := "1.0.4",
instrumentationCommonVersion := "2.0.1"
)
lazy val root = Project("kamon-bundle", file("."))
.settings(noPublishing: _*)
.aggregate(bundle, publishing)
val bundle = (project in file("bundle"))
.enablePlugins(BuildInfoPlugin)
.enablePlugins(AssemblyPlugin)
.settings(versionSettings: _*)
.settings(
skip in publish := true,
moduleName := "kamon-bundle",
resolvers += Resolver.mavenLocal,
resolvers += Resolver.bintrayRepo("kamon-io", "releases"),
buildInfoPackage := "kamon.bundle",
buildInfoKeys := Seq[BuildInfoKey](kanelaAgentJarName),
kanelaAgentModule := "io.kamon" % "kanela-agent" % kanelaAgentVersion.value % "provided",
kanelaAgentJar := update.value.matching(Modules.exactFilter(kanelaAgentModule.value)).head,
kanelaAgentJarName := kanelaAgentJar.value.getName,
resourceGenerators in Compile += Def.task(Seq(kanelaAgentJar.value)).taskValue,
kamonCoreExclusion := ExclusionRule(organization = "io.kamon", name = s"kamon-core_${scalaBinaryVersion.value}"),
bundleDependencies := Seq(
kanelaAgentModule.value,
"io.kamon" %% "kamon-status-page" % kamonCoreVersion.value excludeAll(kamonCoreExclusion.value) changing(),
"io.kamon" %% "kamon-instrumentation-common" % instrumentationCommonVersion.value excludeAll(kamonCoreExclusion.value) changing(),
"net.bytebuddy" % "byte-buddy-agent" % "1.9.12",
),
libraryDependencies ++= {
val optionalInstrumentation = if(scalaBinaryVersion.value != "2.13") instrumentationModulesWithoutTwoThirteen else Seq.empty
val allInstrumentation = instrumentationModules ++ optionalInstrumentation
bundleDependencies.value ++ allInstrumentation.map(_.excludeAll(kamonCoreExclusion.value))
},
packageBin in Compile := assembly.value,
assembleArtifact in assemblyPackageScala := false,
assemblyShadeRules in assembly := Seq(
ShadeRule.zap("**module-info").inAll,
ShadeRule.rename("net.bytebuddy.agent.**" -> "kamon.lib.@0").inAll
),
assemblyMergeStrategy in assembly := {
case "reference.conf" => MergeStrategy.concat
case anyOther => (assemblyMergeStrategy in assembly).value(anyOther)
}
)
lazy val publishing = project
.settings(versionSettings: _*)
.settings(
moduleName := (moduleName in (bundle, Compile)).value,
scalaVersion := (scalaVersion in bundle).value,
crossScalaVersions := (crossScalaVersions in bundle).value,
packageBin in Compile := (packageBin in (bundle, Compile)).value,
packageSrc in Compile := (packageSrc in (bundle, Compile)).value,
bintrayPackage := "kamon-bundle",
libraryDependencies ++= Seq(
"io.kamon" %% "kamon-core" % kamonCoreVersion.value
)
)