diff --git a/build/dist b/build/dist index 1fb34bdbd..2002da8b7 100755 --- a/build/dist +++ b/build/dist @@ -31,6 +31,7 @@ set -x KYUUBI_HOME="$(cd "`dirname "$0"`/.."; pwd)" DISTDIR="$KYUUBI_HOME/dist" MAKE_TGZ=false +SPARK_PROVIDED=false NAME=none MVN="$KYUUBI_HOME/build/mvn" @@ -39,11 +40,12 @@ function usage { echo "./build/dist - Tool for making binary distributions of Kyuubi" echo "" echo "Usage:" - echo "+------------------------------------------------------+" - echo "| ./build/dist [--name] [--tgz] |" - echo "+------------------------------------------------------+" - echo "name: - custom binary name, using project version if undefined" - echo "tgz: - whether to make a whole bundled package" + echo "+--------------------------------------------------------------------------------------+" + echo "| ./build/dist [--name ] [--tgz] [--spark-provided] |" + echo "+--------------------------------------------------------------------------------------+" + echo "name: - custom binary name, using project version if undefined" + echo "tgz: - whether to make a whole bundled package" + echo "spark-provided: - whether to make a package without Spark binary" echo "" } @@ -59,6 +61,9 @@ while (( "$#" )); do --tgz) MAKE_TGZ=true ;; + --spark-provided) + SPARK_PROVIDED=true + ;; --name) NAME="$2" shift @@ -136,7 +141,11 @@ HIVE_VERSION=$("$MVN" help:evaluate -Dexpression=hive.version $@ 2>/dev/null\ echo "Building Kyuubi package of version $VERSION against Spark version - $SPARK_VERSION" if [[ "$NAME" == "none" ]]; then - NAME="spark-"$SPARK_VERSION + if [[ "$SPARK_PROVIDED" == "true" ]]; then + NAME="without-spark" + else + NAME="spark-"$SPARK_VERSION + fi fi if [[ "$MAKE_TGZ" == "true" ]]; then @@ -145,7 +154,12 @@ else echo "Making distribution for Kyuubi $VERSION named $NAME in '$DISTDIR'..." fi -BUILD_COMMAND=("$MVN" -T 1C clean package -DskipTests $@) +MVN_DIST_OPT="-DskipTests" +if [[ "$SPARK_PROVIDED" == "true" ]]; then + MVN_DIST_OPT="$MVN_DIST_OPT -Pspark-provided" +fi + +BUILD_COMMAND=("$MVN" -T 1C clean package $MVN_DIST_OPT $@) echo -e "\nBuilding with..." echo -e "\$ ${BUILD_COMMAND[@]}\n" @@ -176,7 +190,10 @@ else HIVE_VERSION_SUFFIX="-hive1.2" fi -cp -r "$KYUUBI_HOME/externals/kyuubi-download/target/spark-$SPARK_VERSION-bin-hadoop${HADOOP_VERSION:0:3}$HIVE_VERSION_SUFFIX/" "$DISTDIR/externals/spark-$SPARK_VERSION-bin-hadoop${HADOOP_VERSION:0:3}$HIVE_VERSION_SUFFIX/" +if [[ "$SPARK_PROVIDED" != "true" ]]; then + cp -r "$KYUUBI_HOME/externals/kyuubi-download/target/spark-$SPARK_VERSION-bin-hadoop${HADOOP_VERSION:0:3}$HIVE_VERSION_SUFFIX/" \ + "$DISTDIR/externals/spark-$SPARK_VERSION-bin-hadoop${HADOOP_VERSION:0:3}$HIVE_VERSION_SUFFIX/" +fi cp "$KYUUBI_HOME/externals/kyuubi-spark-sql-engine/target/kyuubi-spark-sql-engine-$VERSION.jar" "$DISTDIR/externals/engines/spark" # Copy license and ASF files diff --git a/docs/tools/distribution.md b/docs/tools/distribution.md index 644284115..19a6a37a6 100644 --- a/docs/tools/distribution.md +++ b/docs/tools/distribution.md @@ -15,11 +15,12 @@ For more information on usage, run `./build/dist --help` ./build/dist - Tool for making binary distributions of Kyuubi Server Usage: -+------------------------------------------------------+ -| ./build/dist [--name] [--tgz] | -+------------------------------------------------------+ -name: - custom binary name, using project version if undefined -tgz: - whether to make a whole bundled package ++--------------------------------------------------------------------------------------+ +| ./build/dist [--name ] [--tgz] [--spark-provided] | ++--------------------------------------------------------------------------------------+ +name: - custom binary name, using project version if undefined +tgz: - whether to make a whole bundled package +spark-provided: - whether to make a package without Spark binary ``` For instance, @@ -29,3 +30,11 @@ For instance, ``` This results a Kyuubi distribution named `kyuubi-{version}-bin-custom-name.tar.gz` for you. + +If you are planing to deploy Kyuubi where `spark` is provided, in other word, it's not required to bundle spark binary, use + +```bash +./build/dist --tgz --spark-provided +``` + +Then you will get a Kyuubi distribution without spark binary named `kyuubi-{version}-bin-without-spark.tar.gz`. diff --git a/externals/kyuubi-download/pom.xml b/externals/kyuubi-download/pom.xml index 0409fa150..b21777324 100644 --- a/externals/kyuubi-download/pom.xml +++ b/externals/kyuubi-download/pom.xml @@ -32,6 +32,7 @@ Kyuubi Project Download Externals + false spark-${spark.version}-bin-hadoop2.7.tgz @@ -44,6 +45,9 @@ com.googlecode.maven-download-plugin download-maven-plugin + + ${spark.download.skip} + download-spark-release @@ -65,4 +69,12 @@ + + + spark-provided + + true + + + diff --git a/pom.xml b/pom.xml index c47c59671..c029f6457 100644 --- a/pom.xml +++ b/pom.xml @@ -1123,6 +1123,10 @@ + + spark-provided + + spark-2.4