Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove proguard from the build #583

Merged
merged 1 commit into from
Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 34 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,42 @@ lazy val kamon = (project in file("."))
lazy val core = (project in file("kamon-core"))
.enablePlugins(BuildInfoPlugin)
.enablePlugins(AssemblyPlugin)
.enablePlugins(SbtProguard)
.settings(commonSettings: _*)
.settings(noPublishing: _*)
.settings(
moduleName := "kamon-core",
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "kamon.status",
packageBin in Compile := (proguard in Proguard).value.head,
packageBin in Compile := assembly.value,
assemblyExcludedJars in assembly := filterOut((fullClasspath in assembly).value, "slf4j-api", "config"),
proguardOptions in Proguard ++= Seq(
"-dontnote", "-dontwarn", "-ignorewarnings", "-dontobfuscate", "-dontoptimize",
"-keepattributes **",
"-keep class kamon.Kamon { *; }",
"-keep class kamon.context.** { *; }",
"-keep class kamon.metric.** { *; }",
"-keep class kamon.module.** { *; }",
"-keep class kamon.status.** { *; }",
"-keep class kamon.tag.** { *; }",
"-keep class kamon.trace.** { *; }",
"-keep class kamon.util.** { *; }",
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("org.HdrHistogram.**" -> "kamon.lib.@0").inAll,
ShadeRule.rename("org.jctools.**" -> "kamon.lib.@0").inAll,
ShadeRule.rename("org.eclipse.**" -> "kamon.lib.@0").inAll,
ShadeRule.zap(
"org.eclipse.collections.impl.bag.**",
"org.eclipse.collections.impl.**.primitive.**",
"org.eclipse.collections.impl.**.parallel.**",
"org.eclipse.collections.impl.iterator.**",
"org.eclipse.collections.impl.list.**",
"org.eclipse.collections.impl.multimap.**",
"org.eclipse.collections.impl.primitive.**",
"org.eclipse.collections.impl.set.**",
"org.eclipse.collections.impl.stack.**",
"org.eclipse.collections.impl.string.**",
).inAll,
ShadeRule.keep(
"kamon.Kamon",
"kamon.context.**",
"kamon.metric.**",
"kamon.module.**",
"kamon.status.**",
"kamon.tag.**",
"kamon.trace.**",
"kamon.util.**",
"org.jctools.queues.MpscArrayQueue",
"org.eclipse.collections.impl.map.mutable.UnifiedMap"
).inAll
),
libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.3.1",
Expand Down Expand Up @@ -74,6 +90,10 @@ lazy val statusPage = (project in file("kamon-status-page"))
.settings(
packageBin in Compile := assembly.value,
assemblyExcludedJars in assembly := filterOut((fullClasspath in assembly).value, "slf4j-api", "config", "kamon-core"),
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("com.grack.nanojson.**" -> "kamon.lib.@0").inAll,
ShadeRule.rename("fi.iki.elonen.**" -> "kamon.lib.@0").inAll,
),
libraryDependencies ++= Seq(
"org.nanohttpd" % "nanohttpd" % "2.3.1",
"com.grack" % "nanojson" % "1.1"
Expand Down Expand Up @@ -139,21 +159,11 @@ lazy val commonSettings = Seq(
case _ => Seq.empty
}),
assembleArtifact in assemblyPackageScala := false,
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("org.HdrHistogram.**" -> "kamon.lib.@0").inAll,
ShadeRule.rename("com.grack.nanojson.**" -> "kamon.lib.@0").inAll,
ShadeRule.rename("org.jctools.**" -> "kamon.lib.@0").inAll,
ShadeRule.rename("fi.iki.elonen.**" -> "kamon.lib.@0").inAll,
ShadeRule.rename("org.eclipse.**" -> "kamon.lib.@0").inAll,
),
assemblyMergeStrategy in assembly := {
case s if s.startsWith("LICENSE") => MergeStrategy.discard
case s if s.startsWith("about") => MergeStrategy.discard
case x => (assemblyMergeStrategy in assembly).value(x)
},
proguardVersion in Proguard := "6.0.3",
proguardInputs in Proguard := Seq(assembly.value),
javaOptions in (Proguard, proguard) := Seq("-Xmx2G")
}
)

def filterOut(classPath: Classpath, patterns: String*): Classpath = {
Expand Down
3 changes: 1 addition & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
lazy val root: Project = project in file(".") dependsOn(RootProject(uri("git://github.com/kamon-io/kamon-sbt-umbrella.git")))
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.1.0-M13")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")
addSbtPlugin("com.lightbend.sbt" % "sbt-proguard" % "0.3.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")