MINOR: Extract SCALA_BINARY_VERSION from SCALA_VERSION

Will allow users to set one fewer environment variable if they need to
change scala version. Still, SCALA_BINARY_VERSION can be explicitly set.

Author: Konstantine Karantasis <konstantine@confluent.io>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #2130 from kkonstantine/MINOR-Extract-SCALA_BINARY_VERSION-from-SCALA_VERSION
This commit is contained in:
Konstantine Karantasis 2016-11-17 02:15:14 +00:00 committed by Ismael Juma
parent 249e413685
commit aad9384066
3 changed files with 11 additions and 3 deletions

View File

@ -67,7 +67,7 @@ The release file can be found inside `./core/build/distributions/`.
./gradlew clean
### Running a task on a particular version of Scala (either 2.10.6 or 2.11.8) ###
*Note that if building the jars with a version other than 2.10, you need to set the `SCALA_BINARY_VERSION` variable or change it in `bin/kafka-run-class.sh` to run the quick start.*
*Note that if building the jars with a version other than 2.10.6, you need to set the `SCALA_VERSION` variable or change it in `bin/kafka-run-class.sh` to run the quick start.*
You can pass either the major version (eg 2.11) or the full version (eg 2.11.8):

View File

@ -52,7 +52,7 @@ if [ -z "$SCALA_VERSION" ]; then
fi
if [ -z "$SCALA_BINARY_VERSION" ]; then
SCALA_BINARY_VERSION=2.10
SCALA_BINARY_VERSION=$(echo $SCALA_VERSION | cut -f 1-2 -d '.')
fi
# run ./gradlew copyDependantLibs to get all dependant jars in a local dir

View File

@ -31,7 +31,15 @@ IF ["%SCALA_VERSION%"] EQU [""] (
)
IF ["%SCALA_BINARY_VERSION%"] EQU [""] (
set SCALA_BINARY_VERSION=2.10
for /f "tokens=1,2 delims=." %%a in ("%SCALA_VERSION%") do (
set FIRST=%%a
set SECOND=%%b
if ["!SECOND!"] EQU [""] (
set SCALA_BINARY_VERSION=!FIRST!
) else (
set SCALA_BINARY_VERSION=!FIRST!.!SECOND!
)
)
)
rem Classpath addition for kafka-core dependencies