diff options
author | Dhruve Ashar <dhruveashar@gmail.com> | 2016-06-06 09:42:50 -0700 |
---|---|---|
committer | Marcelo Vanzin <vanzin@cloudera.com> | 2016-06-06 09:42:50 -0700 |
commit | fa4bc8ea8bab1277d1482da370dac79947cac719 (patch) | |
tree | b71ec05ab5c47f58be5e0cc597d91dba31aa56cb /project/SparkBuild.scala | |
parent | 00ad4f054cd044e17d29b7c2c62efd8616462619 (diff) | |
download | spark-fa4bc8ea8bab1277d1482da370dac79947cac719.tar.gz spark-fa4bc8ea8bab1277d1482da370dac79947cac719.tar.bz2 spark-fa4bc8ea8bab1277d1482da370dac79947cac719.zip |
[SPARK-14279][BUILD] Pick the spark version from pom
## What changes were proposed in this pull request?
Change the way spark picks up version information. Also embed the build information to better identify the spark version running.
More context can be found here : https://github.com/apache/spark/pull/12152
## How was this patch tested?
Ran the mvn and sbt builds to verify the version information was being displayed correctly on executing <code>spark-submit --version </code>
![image](https://cloud.githubusercontent.com/assets/7732317/15197251/f7c673a2-1795-11e6-8b2f-88f2a70cf1c1.png)
Author: Dhruve Ashar <dhruveashar@gmail.com>
Closes #13061 from dhruve/impr/SPARK-14279.
Diffstat (limited to 'project/SparkBuild.scala')
-rw-r--r-- | project/SparkBuild.scala | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala index 744f57c517..304288a32c 100644 --- a/project/SparkBuild.scala +++ b/project/SparkBuild.scala @@ -360,6 +360,9 @@ object SparkBuild extends PomBuild { enable(MimaBuild.mimaSettings(sparkHome, x))(x) } + /* Generate and pick the spark build info from extra-resources */ + enable(Core.settings)(core) + /* Unsafe settings */ enable(Unsafe.settings)(unsafe) @@ -448,7 +451,19 @@ object SparkBuild extends PomBuild { else x.settings(Seq[Setting[_]](): _*) } ++ Seq[Project](OldDeps.project) } +} +object Core { + lazy val settings = Seq( + resourceGenerators in Compile += Def.task { + val buildScript = baseDirectory.value + "/../build/spark-build-info" + val targetDir = baseDirectory.value + "/target/extra-resources/" + val command = buildScript + " " + targetDir + " " + version.value + Process(command).!! + val propsFile = baseDirectory.value / "target" / "extra-resources" / "spark-version-info.properties" + Seq(propsFile) + }.taskValue + ) } object Unsafe { @@ -480,9 +495,9 @@ object DependencyOverrides { } /** - This excludes library dependencies in sbt, which are specified in maven but are - not needed by sbt build. - */ + * This excludes library dependencies in sbt, which are specified in maven but are + * not needed by sbt build. + */ object ExcludedDependencies { lazy val settings = Seq( libraryDependencies ~= { libs => libs.filterNot(_.name == "groovy-all") } |