-
Notifications
You must be signed in to change notification settings - Fork 13
/
tg.sbt
30 lines (23 loc) · 807 Bytes
/
tg.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
import java.io.File
val manifest = new java.util.jar.Manifest()
def jar(base: File, dir: String, include: String, out: File) = {
val files = (base / dir) ** include
val target = files pair relativeTo(base :: Nil)
IO.jar(target, out, manifest)
out
}
lazy val tgJar = TaskKey[(File, File)]("tg-jar", "Jar TG classes and sources into lib folder")
tgJar := {
val lib = unmanagedBase.value
(
jar((classDirectory in Compile).value, "org", "*.class", lib / "tg.jar"),
jar((javaSource in Compile).value, "org", "*.java", lib / "tg-src.jar")
)
}
lazy val tgUnjar = TaskKey[Set[File]]("tg-unjar", "Unjar TG sources into src/main/java folder")
tgUnjar := {
val jar = unmanagedBase.value / "tg-src.jar"
val dir = (javaSource in Compile).value
//Seq(jar, dir)
IO.unzip(jar, dir)
}