Created
September 23, 2011 01:07
-
-
Save eed3si9n/1236514 to your computer and use it in GitHub Desktop.
sample plugins for discussion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object FooPlugin extends sbt.Plugin { | |
| val FooConfig = config("foo") | |
| lazy val fooA = SettingKey[Int]("foo-a") | |
| lazy val fooB = SettingKey[String]("foo-b") | |
| lazy val fooC = SettingKey[(Int, String)]("foo-c") | |
| lazy val fooD = SettingKey[(Int, String, String)]("foo-d") | |
| lazy val fooJars = TaskKey[Classpath]("foo-jars") | |
| lazy val fooSomething = TaskKey[Classpath]("foo-something") | |
| lazy val fooSettings: Seq[sbt.Project.Setting[_]] = Seq( | |
| fooA := 1, | |
| fooB := "A", | |
| fooC <<= (fooA, fooB) { (a, b) => (a, b) }, | |
| fooD <<= (fooC) { (c) => (c._1, c._2, "x") }, | |
| fooJars <<= ((dependencyClasspath in Runtime).identity), | |
| fooSomething <<= fooJars.identity | |
| ) | |
| } | |
| object APlugin extends Plugin { | |
| object A { | |
| val a = SettingKey[Int]("a") | |
| } | |
| } | |
| object BPlugin extends Plugin { | |
| object B { | |
| val a = SettingKey[String]("a") | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package sbtobfuscate | |
| import sbt._ | |
| import Keys._ | |
| object Plugin extends sbt.Plugin { | |
| lazy val obfuscate = TaskKey[File]("obfuscate") | |
| lazy val obfuscateA = SettingKey[Int]("obfuscate-a") | |
| lazy val obfuscateJarName = SettingKey[String]("obfuscate-jar-name") | |
| lazy val obfuscateSettings = Seq( | |
| sources in obfuscate <<= (sources) | |
| ) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment