diff --git a/core/pom.xml b/core/pom.xml index 73f7a75cab9d303cbba89857015001d61bb355d6..95f36eb348698796196aff1dfe2e944bf103e2c2 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -261,7 +261,7 @@ </dependency> <dependency> <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-scala_2.10</artifactId> + <artifactId>jackson-module-scala_${scala.binary.version}</artifactId> </dependency> <dependency> <groupId>org.apache.derby</groupId> diff --git a/dev/change-scala-version.sh b/dev/change-scala-version.sh new file mode 100755 index 0000000000000000000000000000000000000000..b81c00c9d6d9d48db31bc2336ac03e5f3a898919 --- /dev/null +++ b/dev/change-scala-version.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -e + +usage() { + echo "Usage: $(basename $0) <version>" 1>&2 + exit 1 +} + +if [ $# -ne 1 ]; then + usage +fi + +TO_VERSION=$1 + +VALID_VERSIONS=( 2.10 2.11 ) + +check_scala_version() { + for i in ${VALID_VERSIONS[*]}; do [ $i = "$1" ] && return 0; done + echo "Invalid Scala version: $1. Valid versions: ${VALID_VERSIONS[*]}" 1>&2 + exit 1 +} + +check_scala_version "$TO_VERSION" + +if [ $TO_VERSION = "2.11" ]; then + FROM_VERSION="2.10" +else + FROM_VERSION="2.11" +fi + +sed_i() { + sed -e "$1" "$2" > "$2.tmp" && mv "$2.tmp" "$2" +} + +export -f sed_i + +BASEDIR=$(dirname $0)/.. +find "$BASEDIR" -name 'pom.xml' -not -path '*target*' -print \ + -exec bash -c "sed_i 's/\(artifactId.*\)_'$FROM_VERSION'/\1_'$TO_VERSION'/g' {}" \; + +# Also update <scala.binary.version> in parent POM +# Match any scala binary version to ensure idempotency +sed_i '1,/<scala\.binary\.version>[0-9]*\.[0-9]*</s/<scala\.binary\.version>[0-9]*\.[0-9]*</<scala.binary.version>'$TO_VERSION'</' \ + "$BASEDIR/pom.xml" + +# Update source of scaladocs +echo "$BASEDIR/docs/_plugins/copy_api_dirs.rb" +sed_i 's/scala\-'$FROM_VERSION'/scala\-'$TO_VERSION'/' "$BASEDIR/docs/_plugins/copy_api_dirs.rb" diff --git a/dev/change-version-to-2.10.sh b/dev/change-version-to-2.10.sh deleted file mode 100755 index c4adb1f96b7d305d3a62060353f5203ea4d3bc5f..0000000000000000000000000000000000000000 --- a/dev/change-version-to-2.10.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Note that this will not necessarily work as intended with non-GNU sed (e.g. OS X) -BASEDIR=$(dirname $0)/.. -find $BASEDIR -name 'pom.xml' | grep -v target \ - | xargs -I {} sed -i -e 's/\(artifactId.*\)_2.11/\1_2.10/g' {} - -# Also update <scala.binary.version> in parent POM -sed -i -e '0,/<scala\.binary\.version>2.11</s//<scala.binary.version>2.10</' $BASEDIR/pom.xml diff --git a/dev/change-version-to-2.11.sh b/dev/change-version-to-2.11.sh deleted file mode 100755 index d370019dec34deca2fb70b1b54b76fc1ed9c4028..0000000000000000000000000000000000000000 --- a/dev/change-version-to-2.11.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Note that this will not necessarily work as intended with non-GNU sed (e.g. OS X) -BASEDIR=$(dirname $0)/.. -find $BASEDIR -name 'pom.xml' | grep -v target \ - | xargs -I {} sed -i -e 's/\(artifactId.*\)_2.10/\1_2.11/g' {} - -# Also update <scala.binary.version> in parent POM -sed -i -e '0,/<scala\.binary\.version>2.10</s//<scala.binary.version>2.11</' $BASEDIR/pom.xml diff --git a/dev/create-release/create-release.sh b/dev/create-release/create-release.sh index 30190dcd41ec5f43c488926ecad2769577b5ca38..86a7a4068c40e74d48d4eb2d9727c18f71a06385 100755 --- a/dev/create-release/create-release.sh +++ b/dev/create-release/create-release.sh @@ -122,13 +122,13 @@ if [[ ! "$@" =~ --skip-publish ]]; then -Phive-thriftserver -Phadoop-2.2 -Pspark-ganglia-lgpl -Pkinesis-asl \ clean install - ./dev/change-version-to-2.11.sh + ./dev/change-scala-version.sh 2.11 build/mvn -DskipTests -Pyarn -Phive -Prelease\ -Dscala-2.11 -Phadoop-2.2 -Pspark-ganglia-lgpl -Pkinesis-asl \ clean install - ./dev/change-version-to-2.10.sh + ./dev/change-scala-version.sh 2.10 pushd $SPARK_REPO @@ -205,7 +205,7 @@ if [[ ! "$@" =~ --skip-package ]]; then # TODO There should probably be a flag to make-distribution to allow 2.11 support if [[ $FLAGS == *scala-2.11* ]]; then - ./dev/change-version-to-2.11.sh + ./dev/change-scala-version.sh 2.11 fi export ZINC_PORT=$ZINC_PORT diff --git a/docs/building-spark.md b/docs/building-spark.md index 2128fdffecc0580aeba713c55588df0f0c90dc2f..a5da3b39502e2b501fc89f0043b2f7c1b6e9818f 100644 --- a/docs/building-spark.md +++ b/docs/building-spark.md @@ -124,7 +124,7 @@ mvn -Pyarn -Phadoop-2.4 -Dhadoop.version=2.4.0 -Phive -Phive-thriftserver -Dskip # Building for Scala 2.11 To produce a Spark package compiled with Scala 2.11, use the `-Dscala-2.11` property: - dev/change-version-to-2.11.sh + dev/change-scala-version.sh 2.11 mvn -Pyarn -Phadoop-2.4 -Dscala-2.11 -DskipTests clean package Spark does not yet support its JDBC component for Scala 2.11. diff --git a/pom.xml b/pom.xml index 2de0c35fbd51a852b286e38771cc543caf7521a7..1f44dc8abe1d439442f3c9a7b4f5e175bc55a2f9 100644 --- a/pom.xml +++ b/pom.xml @@ -614,7 +614,7 @@ 15.0, which causes runtime incompatibility issues. --> <dependency> <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-scala_2.10</artifactId> + <artifactId>jackson-module-scala_${scala.binary.version}</artifactId> <version>${fasterxml.jackson.version}</version> <exclusions> <exclusion>