Skip to content

Commit

Permalink
Load build time system properties from a file. See #2791
Browse files Browse the repository at this point in the history
  • Loading branch information
bantonsson committed Dec 20, 2012
1 parent ff85298 commit 0dbeb47
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*#
src_managed
activemq-data
project/akka-build.properties
project/plugins/project
project/boot/*
*/project/build/target
Expand Down
20 changes: 20 additions & 0 deletions project/AkkaBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0dbeb47

Please sign in to comment.