Load build time system properties from a file. See #2791

This commit is contained in:
Björn Antonsson 2012-12-18 12:10:59 +01:00
parent ff852984cb
commit 0dbeb471b8
2 changed files with 21 additions and 0 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
*#
src_managed
activemq-data
project/akka-build.properties
project/plugins/project
project/boot/*
*/project/build/target

View file

@ -21,9 +21,16 @@ import ls.Plugin.{ lsSettings, LsKeys }
import java.lang.Boolean.getBoolean
import sbt.Tests
import LsKeys.{ lsync, docsUrl => lsDocsUrl, tags => lsTags }
import java.io.{BufferedReader, InputStreamReader, FileInputStream, File}
import java.nio.charset.Charset
import java.util.Properties
object AkkaBuild extends Build {
System.setProperty("akka.mode", "test") // Is there better place for this?
// Load system properties from a file to make configuration from Jenkins easier
loadSystemProperties("project/akka-build.properties")
val enableMiMa = false
lazy val buildSettings = Seq(
@ -617,6 +624,19 @@ object AkkaBuild extends Build {
if (enableMiMa) Some(organization % id % version) // the artifact to compare binary compatibility with
else None
def loadSystemProperties(fileName: String): Unit = {
import scala.collection.JavaConverters._
val file = new File(fileName)
if (file.exists()) {
println("Loading system properties from file `" + fileName + "`")
val in = new InputStreamReader(new FileInputStream(file), "UTF-8")
val props = new Properties
props.load(in)
in.close()
sys.props ++ props.asScala
}
}
// OSGi settings
object OSGi {