-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcodegenerators.sbt
More file actions
27 lines (24 loc) · 875 Bytes
/
codegenerators.sbt
File metadata and controls
27 lines (24 loc) · 875 Bytes
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
mappings in (Compile, packageSrc) ++= {
import Path.{flat, relativeTo}
println((managedSources in Compile).value)
(managedSources in Compile).value pair (relativeTo((sourceManaged in Compile).value) | flat)
}
sourceGenerators in Compile += Def.task {
if(!version.value.endsWith("-SNAPSHOT")) {
val in = scala.io.Source.fromFile(baseDirectory.value / "README.markdown.in")
try {
val out = new java.io.PrintWriter(baseDirectory.value / "README.markdown")
try {
for(line <- in.getLines()) {
out.println(line.replaceAll(java.util.regex.Pattern.quote("%VERSION%"), java.util.regex.Matcher.quoteReplacement(version.value)))
}
} finally {
out.close()
}
} finally {
in.close()
}
}
Seq.empty[File]
}
sourceGenerators in Compile += Def.task { GenPackage((sourceManaged in Compile).value) }