Back to home page

OSCL-LXR

 
 

    


0001 @echo off
0002 
0003 rem
0004 rem Licensed to the Apache Software Foundation (ASF) under one or more
0005 rem contributor license agreements.  See the NOTICE file distributed with
0006 rem this work for additional information regarding copyright ownership.
0007 rem The ASF licenses this file to You under the Apache License, Version 2.0
0008 rem (the "License"); you may not use this file except in compliance with
0009 rem the License.  You may obtain a copy of the License at
0010 rem
0011 rem    http://www.apache.org/licenses/LICENSE-2.0
0012 rem
0013 rem Unless required by applicable law or agreed to in writing, software
0014 rem distributed under the License is distributed on an "AS IS" BASIS,
0015 rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 rem See the License for the specific language governing permissions and
0017 rem limitations under the License.
0018 rem
0019 
0020 rem This script loads spark-env.cmd if it exists, and ensures it is only loaded once.
0021 rem spark-env.cmd is loaded from SPARK_CONF_DIR if set, or within the current directory's
0022 rem conf\ subdirectory.
0023 
0024 set SPARK_ENV_CMD=spark-env.cmd
0025 if [%SPARK_ENV_LOADED%] == [] (
0026   set SPARK_ENV_LOADED=1
0027 
0028   if [%SPARK_CONF_DIR%] == [] (
0029     set SPARK_CONF_DIR=%~dp0..\conf
0030   )
0031 
0032   set SPARK_ENV_CMD=%SPARK_CONF_DIR%\%SPARK_ENV_CMD%
0033   if exist %SPARK_ENV_CMD% (
0034     call %SPARK_ENV_CMD%
0035   )
0036 )
0037 
0038 rem Setting SPARK_SCALA_VERSION if not already set.
0039 
0040 rem TODO: revisit for Scala 2.13 support
0041 set SPARK_SCALA_VERSION=2.12
0042 rem if [%SPARK_SCALA_VERSION%] == [] (
0043 rem   set SCALA_VERSION_1=2.12
0044 rem   set SCALA_VERSION_2=2.11
0045 rem
0046 rem   set ASSEMBLY_DIR1=%SPARK_HOME%\assembly\target\scala-%SCALA_VERSION_1%
0047 rem   set ASSEMBLY_DIR2=%SPARK_HOME%\assembly\target\scala-%SCALA_VERSION_2%
0048 rem   set ENV_VARIABLE_DOC=https://spark.apache.org/docs/latest/configuration.html#environment-variables
0049 rem   if exist %ASSEMBLY_DIR2% if exist %ASSEMBLY_DIR1% (
0050 rem     echo "Presence of build for multiple Scala versions detected (%ASSEMBLY_DIR1% and %ASSEMBLY_DIR2%)."
0051 rem     echo "Remove one of them or, set SPARK_SCALA_VERSION=%SCALA_VERSION_1% in %SPARK_ENV_CMD%."
0052 rem     echo "Visit %ENV_VARIABLE_DOC% for more details about setting environment variables in spark-env.cmd."
0053 rem     echo "Either clean one of them or, set SPARK_SCALA_VERSION in spark-env.cmd."
0054 rem     exit 1
0055 rem   )
0056 rem   if exist %ASSEMBLY_DIR1% (
0057 rem     set SPARK_SCALA_VERSION=%SCALA_VERSION_1%
0058 rem   ) else (
0059 rem     set SPARK_SCALA_VERSION=%SCALA_VERSION_2%
0060 rem   )
0061 rem )
0062 exit /b 0