Skip to content

Commit 8f130ad

Browse files
committed
[SPARK-22072][SPARK-22071][BUILD] Improve release build scripts
## What changes were proposed in this pull request? Check JDK version (with javac) and use SPARK_VERSION for publish-release ## How was this patch tested? Manually tried local build with wrong JDK / JAVA_HOME & built a local release (LFTP disabled) Author: Holden Karau <[email protected]> Closes apache#19312 from holdenk/improve-release-scripts-r2.
1 parent 5960686 commit 8f130ad

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

dev/create-release/release-build.sh

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Top level targets are
3131
All other inputs are environment variables
3232
3333
GIT_REF - Release tag or commit to build from
34-
SPARK_VERSION - Release identifier used when publishing
35-
SPARK_PACKAGE_VERSION - Release identifier in top level package directory
34+
SPARK_VERSION - Version of Spark being built (e.g. 2.1.2)
35+
SPARK_PACKAGE_VERSION - Release identifier in top level package directory (e.g. 2.1.2-rc1)
3636
REMOTE_PARENT_DIR - Parent in which to create doc or release builds.
3737
REMOTE_PARENT_MAX_LENGTH - If set, parent directory will be cleaned to only
3838
have this number of subdirectories (by deleting old ones). WARNING: This deletes data.
@@ -104,6 +104,33 @@ if [ -z "$SPARK_VERSION" ]; then
104104
| grep -v INFO | grep -v WARNING | grep -v Download)
105105
fi
106106

107+
# Verify we have the right java version set
108+
if [ -z "$JAVA_HOME" ]; then
109+
echo "Please set JAVA_HOME."
110+
exit 1
111+
fi
112+
113+
java_version=$("${JAVA_HOME}"/bin/javac -version 2>&1 | cut -d " " -f 2)
114+
115+
if [[ ! $SPARK_VERSION < "2.2." ]]; then
116+
if [[ $java_version < "1.8." ]]; then
117+
echo "Java version $java_version is less than required 1.8 for 2.2+"
118+
echo "Please set JAVA_HOME correctly."
119+
exit 1
120+
fi
121+
else
122+
if [[ $java_version > "1.7." ]]; then
123+
if [ -z "$JAVA_7_HOME" ]; then
124+
echo "Java version $java_version is higher than required 1.7 for pre-2.2"
125+
echo "Please set JAVA_HOME correctly."
126+
exit 1
127+
else
128+
JAVA_HOME="$JAVA_7_HOME"
129+
fi
130+
fi
131+
fi
132+
133+
107134
if [ -z "$SPARK_PACKAGE_VERSION" ]; then
108135
SPARK_PACKAGE_VERSION="${SPARK_VERSION}-$(date +%Y_%m_%d_%H_%M)-${git_hash}"
109136
fi
@@ -326,6 +353,8 @@ if [[ "$1" == "publish-snapshot" ]]; then
326353
fi
327354

328355
if [[ "$1" == "publish-release" ]]; then
356+
SPARK_VERSION=$SPARK_PACKAGE_VERSION
357+
329358
cd spark
330359
# Publish Spark to Maven release repo
331360
echo "Publishing Spark checkout at '$GIT_REF' ($git_hash)"

0 commit comments

Comments
 (0)