How to set-up the sbt-proguard plugin in Build.scala
Asked Answered
V

1

6

I want to use the sbt-proguard plugin in my project, but I need to set it up in a Build.scala file.

I read the documentation but there is just an example for the build.sbt file, which won't work in my case. I need to know how to configure the plugin for my Build.scala file.

Here's the link to the repo: https://github.com/sbt/sbt-proguard/blob/master/README.md#example

FYI: I'm using scala.version=2.11.4 and sbt.version=0.13.5

Vulvitis answered 19/1, 2015 at 16:58 Comment(0)
D
1

(Note: sbt currently recommends multi-project build.sbt instead of build.scala.)

Some of the sbt plugins use scripted to test itself, which sets up fake builds under src/sbt-test. If you find one it could contain nice samples on how to set up the plugin.

sbt-proguard created a sample called akka supposedly used by Akka project.

import sbt._
import sbt.Keys._
import com.typesafe.sbt.SbtProguard._

object SampleBuild extends Build {
  import ProguardKeys.{ mergeStrategies, merge, options }
  import ProguardOptions.keepMain
  import ProguardMerge.append

  lazy val proguardAkka = Project(
    id = "proguard-akka",
    base = file("."),
    settings = Defaults.defaultSettings ++ proguardSettings ++ Seq(
      scalaVersion := "2.10.1",
      libraryDependencies += "com.typesafe.akka" %% "akka-remote" % "2.1.2",
      merge in Proguard := true,
      mergeStrategies in Proguard += append("reference.conf"),
      options in Proguard += keepMain("A"),
      options in Proguard += keepMain("B"),
      options in Proguard += "-dontoptimize", // reduce time for proguard
      options in Proguard += ProguardConf.akka
    )
  )
}
object ProguardConf {
  val akka = ....
}
Diaphone answered 20/1, 2015 at 6:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.