Skip to content

Commit

Permalink
[SPARK-2437] Rename MAVEN_PROFILES to SBT_MAVEN_PROFILES and add SBT_…
Browse files Browse the repository at this point in the history
…MAVEN_PROPERTIES

NOTE: It is not possible to use both env variable  `SBT_MAVEN_PROFILES`  and `-P` flag at same time. `-P` if specified takes precedence.

Author: Prashant Sharma <[email protected]>

Closes apache#1374 from ScrapCodes/SPARK-2437/rename-MAVEN_PROFILES and squashes the following commits:

8694bde [Prashant Sharma] [SPARK-2437] Rename MAVEN_PROFILES to SBT_MAVEN_PROFILES and add SBT_MAVEN_PROPERTIES
  • Loading branch information
ScrapCodes authored and pwendell committed Jul 11, 2014
1 parent f4f46de commit b23e9c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions project/SparkBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,21 @@ object SparkBuild extends PomBuild {
profiles
}

override val profiles = Properties.envOrNone("MAVEN_PROFILES") match {
override val profiles = Properties.envOrNone("SBT_MAVEN_PROFILES") match {
case None => backwardCompatibility
// Rationale: If -P option exists no need to support backwardCompatibility.
case Some(v) =>
if (backwardCompatibility.nonEmpty)
println("Note: We ignore environment variables, when use of profile is detected in " +
"conjunction with environment variable.")
v.split("(\\s+|,)").filterNot(_.isEmpty).map(_.trim.replaceAll("-P", "")).toSeq
}

Properties.envOrNone("SBT_MAVEN_PROPERTIES") match {
case Some(v) =>
v.split("(\\s+|,)").filterNot(_.isEmpty).map(_.split("=")).foreach(x => System.setProperty(x(0), x(1)))
case _ =>
}

override val userPropertiesMap = System.getProperties.toMap

lazy val sharedSettings = graphSettings ++ ScalaStyleSettings ++ Seq (
Expand Down
2 changes: 1 addition & 1 deletion sbt/sbt-launch-lib.bash
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ addJava () {
enableProfile () {
dlog "[enableProfile] arg = '$1'"
maven_profiles=( "${maven_profiles[@]}" "$1" )
export MAVEN_PROFILES="${maven_profiles[@]}"
export SBT_MAVEN_PROFILES="${maven_profiles[@]}"
}

addSbt () {
Expand Down

0 comments on commit b23e9c3

Please sign in to comment.