[SPARK-15851][BUILD] Fix the call of the bash script to enable proper run in Windows

## What changes were proposed in this pull request?
The way bash script `build/spark-build-info` is called from core/pom.xml prevents Spark building on Windows. Instead of calling the script directly we call bash and pass the script as an argument. This enables running it on Windows with bash installed which typically comes with Git.

This brings https://github.com/apache/spark/pull/13612 up-to-date and also addresses comments from the code review.

Closes #13612

## How was this patch tested?
I built manually (on a Mac) to verify it didn't break Mac compilation.

Author: Reynold Xin <rxin@databricks.com>
Author: avulanov <nashb@yandex.ru>

Closes #13691 from rxin/SPARK-15851.
This commit is contained in:
Reynold Xin 2016-06-15 20:11:23 -07:00
parent ebdd751272
commit 5a52ba0f95
2 changed files with 3 additions and 2 deletions

View file

@ -357,7 +357,8 @@
<configuration> <configuration>
<!-- Execute the shell script to generate the spark build information. --> <!-- Execute the shell script to generate the spark build information. -->
<target> <target>
<exec executable="${project.basedir}/../build/spark-build-info"> <exec executable="bash">
<arg value="${project.basedir}/../build/spark-build-info"/>
<arg value="${project.build.directory}/extra-resources"/> <arg value="${project.build.directory}/extra-resources"/>
<arg value="${project.version}"/> <arg value="${project.version}"/>
</exec> </exec>

View file

@ -458,7 +458,7 @@ object Core {
resourceGenerators in Compile += Def.task { resourceGenerators in Compile += Def.task {
val buildScript = baseDirectory.value + "/../build/spark-build-info" val buildScript = baseDirectory.value + "/../build/spark-build-info"
val targetDir = baseDirectory.value + "/target/extra-resources/" val targetDir = baseDirectory.value + "/target/extra-resources/"
val command = buildScript + " " + targetDir + " " + version.value val command = Seq("bash", buildScript, targetDir, version.value)
Process(command).!! Process(command).!!
val propsFile = baseDirectory.value / "target" / "extra-resources" / "spark-version-info.properties" val propsFile = baseDirectory.value / "target" / "extra-resources" / "spark-version-info.properties"
Seq(propsFile) Seq(propsFile)