Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions project/SparkBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,13 @@ object SparkBuild extends PomBuild {
v.split("(\\s+|,)").filterNot(_.isEmpty).map(_.trim.replaceAll("-P", "")).toSeq
}

if (profiles.exists(_.contains("scala-"))) {
profiles
} else if (System.getProperty("scala-2.11") != null) {
profiles ++ Seq("scala-2.11")
} else {
println("Enabled default scala profile")
profiles ++ Seq("scala-2.10")
if (System.getProperty("scala-2.11") == "") {
// To activate scala-2.11 profile, replace empty property value to non-empty value
// in the same way as Maven which handles -Dname as -Dname=true before executes build process.
// see: https://github.com/apache/maven/blob/maven-3.0.4/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L1082
System.setProperty("scala-2.11", "true")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment here and link to the maven code this is replicating? It might be tricky for other developers to understand why this exists.

}
profiles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we no longer need to turn the scala-2.10 profile on in this case? Will Maven turn it on automatically?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the profile scala-2.10 is activated by the condition:

<property><name>!scala-2.11</name></property>

so Maven will turn it on if the property scala-2.11 is null or empty.

}

Properties.envOrNone("SBT_MAVEN_PROPERTIES") match {
Expand Down