Port build to SBT 1.x (#23850)
* Port build to SBT 1.x * Fix multinode tests, always enable genjavadoc bootstrap
This commit is contained in:
parent
38622246d9
commit
82ca8a2cc7
44 changed files with 443 additions and 495 deletions
33
project/VersionGenerator.scala
Normal file
33
project/VersionGenerator.scala
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright (C) 2016-2017 Lightbend Inc. <http://www.lightbend.com>
|
||||
*/
|
||||
package akka
|
||||
|
||||
import sbt._
|
||||
import sbt.Keys._
|
||||
|
||||
/**
|
||||
* Generate version.conf and akka/Version.scala files based on the version setting.
|
||||
*/
|
||||
object VersionGenerator {
|
||||
|
||||
val settings: Seq[Setting[_]] = inConfig(Compile)(Seq(
|
||||
resourceGenerators += generateVersion(resourceManaged, _ / "version.conf",
|
||||
"""|akka.version = "%s"
|
||||
|"""),
|
||||
sourceGenerators += generateVersion(sourceManaged, _ / "akka" / "Version.scala",
|
||||
"""|package akka
|
||||
|
|
||||
|object Version {
|
||||
| val current: String = "%s"
|
||||
|}
|
||||
|""")))
|
||||
|
||||
def generateVersion(dir: SettingKey[File], locate: File ⇒ File, template: String) = Def.task[Seq[File]] {
|
||||
val file = locate(dir.value)
|
||||
val content = template.stripMargin.format(version.value)
|
||||
if (!file.exists || IO.read(file) != content) IO.write(file, content)
|
||||
Seq(file)
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue