|
| 1 | +@echo off |
| 2 | + |
| 3 | +rem |
| 4 | +rem Licensed to the Apache Software Foundation (ASF) under one or more |
| 5 | +rem contributor license agreements. See the NOTICE file distributed with |
| 6 | +rem this work for additional information regarding copyright ownership. |
| 7 | +rem The ASF licenses this file to You under the Apache License, Version 2.0 |
| 8 | +rem (the "License"); you may not use this file except in compliance with |
| 9 | +rem the License. You may obtain a copy of the License at |
| 10 | +rem |
| 11 | +rem http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +rem |
| 13 | +rem Unless required by applicable law or agreed to in writing, software |
| 14 | +rem distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +rem See the License for the specific language governing permissions and |
| 17 | +rem limitations under the License. |
| 18 | +rem |
| 19 | + |
| 20 | +rem This script loads spark-env.cmd if it exists, and ensures it is only loaded once. |
| 21 | +rem spark-env.cmd is loaded from SPARK_CONF_DIR if set, or within the current directory's |
| 22 | +rem conf/ subdirectory. |
| 23 | + |
| 24 | +if [%SPARK_ENV_LOADED%] == [] ( |
| 25 | + set SPARK_ENV_LOADED=1 |
| 26 | + |
| 27 | + if not [%SPARK_CONF_DIR%] == [] ( |
| 28 | + set user_conf_dir=%SPARK_CONF_DIR% |
| 29 | + ) else ( |
| 30 | + set user_conf_dir=%~dp0..\..\conf |
| 31 | + ) |
| 32 | + |
| 33 | + call :LoadSparkEnv |
| 34 | +) |
| 35 | + |
| 36 | +rem Setting SPARK_SCALA_VERSION if not already set. |
| 37 | + |
| 38 | +set ASSEMBLY_DIR2=%SPARK_HOME%/assembly/target/scala-2.11 |
| 39 | +set ASSEMBLY_DIR1=%SPARK_HOME%/assembly/target/scala-2.10 |
| 40 | + |
| 41 | +if [%SPARK_SCALA_VERSION%] == [] ( |
| 42 | + |
| 43 | + if exist %ASSEMBLY_DIR2% if exist %ASSEMBLY_DIR1% ( |
| 44 | + echo "Presence of build for both scala versions(SCALA 2.10 and SCALA 2.11) detected." |
| 45 | + echo "Either clean one of them or, set SPARK_SCALA_VERSION=2.11 in spark-env.cmd." |
| 46 | + exit 1 |
| 47 | + ) |
| 48 | + if exist %ASSEMBLY_DIR2% ( |
| 49 | + set SPARK_SCALA_VERSION=2.11 |
| 50 | + ) else ( |
| 51 | + set SPARK_SCALA_VERSION=2.10 |
| 52 | + ) |
| 53 | +) |
| 54 | +exit /b 0 |
| 55 | + |
| 56 | +:LoadSparkEnv |
| 57 | +if exist "%user_conf_dir%\spark-env.cmd" ( |
| 58 | + call "%user_conf_dir%\spark-env.cmd" |
| 59 | +) |
0 commit comments