@@ -30,6 +30,13 @@ set -e
3030
3131# Figure out where the script is
3232export FWDIR=" $( cd " ` dirname " $0 " ` " ; pwd) "
33+ export SPARK_HOME=" $( cd " ` dirname " $0 " ` " /..; pwd) "
34+
35+ # Required for setting SPARK_SCALA_VERSION
36+ . " ${SPARK_HOME} " /bin/load-spark-env.sh
37+
38+ echo " Using Scala $SPARK_SCALA_VERSION "
39+
3340pushd $FWDIR
3441
3542# Install the package (this will also generate the Rd files)
@@ -45,9 +52,21 @@ Rscript -e 'libDir <- "../../lib"; library(SparkR, lib.loc=libDir); library(knit
4552
4653popd
4754
48- # render creates SparkR vignettes
49- Rscript -e ' library(rmarkdown); paths <- .libPaths(); .libPaths(c("lib", paths)); Sys.setenv(SPARK_HOME=tools::file_path_as_absolute("..")); render("pkg/vignettes/sparkr-vignettes.Rmd"); .libPaths(paths)'
55+ # Find Spark jars.
56+ if [ -f " ${SPARK_HOME} /RELEASE" ]; then
57+ SPARK_JARS_DIR=" ${SPARK_HOME} /jars"
58+ else
59+ SPARK_JARS_DIR=" ${SPARK_HOME} /assembly/target/scala-$SPARK_SCALA_VERSION /jars"
60+ fi
61+
62+ # Only create vignettes if Spark JARs exist
63+ if [ -d " $SPARK_JARS_DIR " ]; then
64+ # render creates SparkR vignettes
65+ Rscript -e ' library(rmarkdown); paths <- .libPaths(); .libPaths(c("lib", paths)); Sys.setenv(SPARK_HOME=tools::file_path_as_absolute("..")); render("pkg/vignettes/sparkr-vignettes.Rmd"); .libPaths(paths)'
5066
51- find pkg/vignettes/. -not -name ' .' -not -name ' *.Rmd' -not -name ' *.md' -not -name ' *.pdf' -not -name ' *.html' -delete
67+ find pkg/vignettes/. -not -name ' .' -not -name ' *.Rmd' -not -name ' *.md' -not -name ' *.pdf' -not -name ' *.html' -delete
68+ else
69+ echo " Skipping R vignettes as Spark JARs not found in $SPARK_HOME "
70+ fi
5271
5372popd
0 commit comments