Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/bash
0002 
0003 #
0004 # Licensed to the Apache Software Foundation (ASF) under one or more
0005 # contributor license agreements.  See the NOTICE file distributed with
0006 # this work for additional information regarding copyright ownership.
0007 # The ASF licenses this file to You under the Apache License, Version 2.0
0008 # (the "License"); you may not use this file except in compliance with
0009 # the License.  You may obtain a copy of the License at
0010 #
0011 #    http://www.apache.org/licenses/LICENSE-2.0
0012 #
0013 # Unless required by applicable law or agreed to in writing, software
0014 # distributed under the License is distributed on an "AS IS" BASIS,
0015 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 # See the License for the specific language governing permissions and
0017 # limitations under the License.
0018 #
0019 
0020 set -o pipefail
0021 set -e
0022 
0023 FWDIR="$(cd "`dirname "${BASH_SOURCE[0]}"`"; pwd)"
0024 pushd "$FWDIR" > /dev/null
0025 
0026 . "$FWDIR/find-r.sh"
0027 
0028 # Install the package (this is required for code in vignettes to run when building it later)
0029 # Build the latest docs, but not vignettes, which is built with the package next
0030 . "$FWDIR/install-dev.sh"
0031 
0032 # Build source package with vignettes
0033 SPARK_HOME="$(cd "${FWDIR}"/..; pwd)"
0034 . "${SPARK_HOME}/bin/load-spark-env.sh"
0035 if [ -f "${SPARK_HOME}/RELEASE" ]; then
0036   SPARK_JARS_DIR="${SPARK_HOME}/jars"
0037 else
0038   SPARK_JARS_DIR="${SPARK_HOME}/assembly/target/scala-$SPARK_SCALA_VERSION/jars"
0039 fi
0040 
0041 if [ -d "$SPARK_JARS_DIR" ]; then
0042   # Build a zip file containing the source package with vignettes
0043   SPARK_HOME="${SPARK_HOME}" "$R_SCRIPT_PATH/R" CMD build "$FWDIR/pkg"
0044 
0045   find pkg/vignettes/. -not -name '.' -not -name '*.Rmd' -not -name '*.md' -not -name '*.pdf' -not -name '*.html' -delete
0046 else
0047   echo "Error Spark JARs not found in '$SPARK_HOME'"
0048   exit 1
0049 fi
0050 
0051 # Run check as-cran.
0052 VERSION=`grep Version "$FWDIR/pkg/DESCRIPTION" | awk '{print $NF}'`
0053 
0054 CRAN_CHECK_OPTIONS="--as-cran"
0055 
0056 if [ -n "$NO_TESTS" ]
0057 then
0058   CRAN_CHECK_OPTIONS=$CRAN_CHECK_OPTIONS" --no-tests"
0059 fi
0060 
0061 if [ -n "$NO_MANUAL" ]
0062 then
0063   CRAN_CHECK_OPTIONS=$CRAN_CHECK_OPTIONS" --no-manual --no-vignettes"
0064 fi
0065 
0066 echo "Running CRAN check with $CRAN_CHECK_OPTIONS options"
0067 
0068 # Remove this environment variable to allow to check suggested packages once
0069 # Jenkins installs arrow. See SPARK-29339.
0070 export _R_CHECK_FORCE_SUGGESTS_=FALSE
0071 
0072 if [ -n "$NO_TESTS" ] && [ -n "$NO_MANUAL" ]
0073 then
0074   "$R_SCRIPT_PATH/R" CMD check $CRAN_CHECK_OPTIONS "SparkR_$VERSION.tar.gz"
0075 else
0076   # This will run tests and/or build vignettes, and require SPARK_HOME
0077   SPARK_HOME="${SPARK_HOME}" "$R_SCRIPT_PATH/R" CMD check $CRAN_CHECK_OPTIONS "SparkR_$VERSION.tar.gz"
0078 fi
0079 
0080 popd > /dev/null