From 0dbeb471b80eabc18294f0c524ef902dc98f5734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Antonsson?= Date: Tue, 18 Dec 2012 12:10:59 +0100 Subject: [PATCH] Load build time system properties from a file. See #2791 --- .gitignore | 1 + project/AkkaBuild.scala | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/.gitignore b/.gitignore index 48632735ce2..980881bca95 100755 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *# src_managed activemq-data +project/akka-build.properties project/plugins/project project/boot/* */project/build/target diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala index 153f11a552c..25c4d510051 100644 --- a/project/AkkaBuild.scala +++ b/project/AkkaBuild.scala @@ -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 {