(注意:sbt 目前推荐多项目 build.sbt而不是 build.scala。)
一些 sbt 插件使用脚本来测试自己,这会在src/sbt-test
. 如果你找到一个,它可能包含关于如何设置插件的很好的示例。
sbt-proguard 创建了一个名为akka的示例,据称该示例由 Akka 项目使用。
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 = ....
}