Skip to content

Commit

Permalink
Merge e7a3ca4 into 3bb9736
Browse files Browse the repository at this point in the history
  • Loading branch information
fnothaft committed Dec 18, 2016
2 parents 3bb9736 + e7a3ca4 commit da0fd0a
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 7 deletions.
71 changes: 66 additions & 5 deletions scripts/jenkins-test
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,59 @@ then
exit 1
fi

# this next line is supposed to fail
set +e

echo "Rewriting POM.xml files to Scala 2.10 and Spark 1 should error..."
./scripts/move_to_spark_1.sh
if [[ $? == 0 ]];
then
echo "Moving to Spark 1 did not cowardly fail!"
exit 1
fi

./scripts/move_to_scala_2.10.sh
if [[ $? == 0 ]];
then
echo "Moving to Scala 2.10 did not cowardly fail!"
exit 1
fi

set -e

# are we testing for spark 2.0.0? if so, we need to rewrite our poms first
if [ ${SPARK_VERSION} == 2.0.0 ];
then
echo "Rewriting POM.xml files for Scala 2.10."
./scripts/move_to_spark_2.sh

echo "Rewriting POM.xml files for Spark 2."
./scripts/move_to_spark_2.sh

# shouldn't be able to move to spark 2 twice
set +e
./scripts/move_to_spark_2.sh
if [[ $? == 0 ]];
then
echo "Moving to Spark 2 twice did not cowardly fail!"
exit 1
fi
set -e
fi

# are we testing for scala 2.11? if so, we need to rewrite our poms to 2.11 first
if [ ${SCALAVER} == 2.11 ];
then
echo "Rewriting POM.xml files for Scala 2.10."
./scripts/move_to_scala_2.11.sh
echo "Rewriting POM.xml files for Scala 2.11."
./scripts/move_to_scala_2.11.sh

# shouldn't be able to move to scala 2.11 twice
set +e
./scripts/move_to_scala_2.11.sh
if [[ $? == 0 ]];
then
echo "Moving to Scala 2.11 twice did not cowardly fail!"
exit 1
fi
set -e
fi

# print versions
Expand Down Expand Up @@ -77,6 +118,27 @@ mvn -U \
find ${ADAM_MVN_TMP_DIR}
rm -rf ${ADAM_MVN_TMP_DIR}

# and move our poms back to their original values
# this will allow us to pass our porcelain test at the end
if [ ${SPARK_VERSION} == 2.0.0 ];
then

echo "Rewriting POM.xml files back to Spark 1."
./scripts/move_to_spark_1.sh
fi
if [ ${SCALAVER} == 2.11 ];
then
echo "Rewriting POM.xml files back to Scala 2.10."
./scripts/move_to_scala_2.10.sh
fi

if test -n "$(git status --porcelain)"
then
echo "Applying move_to_xyz script marred a pom.xml file."
echo "Exiting..."
exit 1
fi

# run integration tests on scala 2.10; prebuilt spark distributions are not available for 2.11
if [ ${SCALAVER} == 2.10 ];
then
Expand Down Expand Up @@ -157,7 +219,6 @@ then
# test that the source is formatted correctly
# we had modified the poms to add a temp dir, so check those out first
pushd ${PROJECT_ROOT}
find . -name pom.xml -exec git checkout {} \;
./scripts/format-source
if test -n "$(git status --porcelain)"
then
Expand Down
14 changes: 13 additions & 1 deletion scripts/move_to_scala_2.10.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,17 @@

set +x

find . -name "pom.xml" -exec sed -e "s/2.11.8/2.10.6/g" -e "s/2.11/2.10/g" -i.2.10.bak '{}' \;
grep "<scala\.version>" pom.xml | grep -q 2.10
if [[ $? == 0 ]];
then
echo "Scala version is already set to 2.10."
echo "Cowardly refusing to move to Scala 2.10..."

exit 1
fi

find . -name "pom.xml" -exec sed -e "s/2.11.8/2.10.6/g" \
-e "s/2.11/2.10/g" -i.2.10.bak \
-e "/no Scala/ s/Scala 2.10/Scala 2.11/g" -i.2.10.bak \
'{}' \;
find . -name "*.2.10.bak" -exec rm {} \;
13 changes: 12 additions & 1 deletion scripts/move_to_scala_2.11.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

set +x

find . -name "pom.xml" -exec sed -e "s/2.10.6/2.11.8/g" -e "/bdg-utils.version/!s/2.10/2.11/g" -i.2.11.bak '{}' \;
grep "<scala\.version>" pom.xml | grep -q 2.11
if [[ $? == 0 ]];
then
echo "Scala version is already set to 2.11."
echo "Cowardly refusing to move to Scala 2.11..."

exit 1
fi

find . -name "pom.xml" -exec sed -e "s/2.10.6/2.11.8/g" \
-e "/bdg-utils.version/! s/2.10/2.11/g" \
-i.2.11.bak '{}' \;
# keep parquet-scala at parquet-scala_2.10
find . -name "pom.xml" -exec sed -e "s/parquet-scala_2.11/parquet-scala_2.10/g" -i.2.11.2.bak '{}' \;
# keep maven-javadoc-plugin at version 2.10.3
Expand Down
17 changes: 17 additions & 0 deletions scripts/move_to_spark_1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set +x

grep -q "spark2" pom.xml
if [[ $? == 1 ]];
then
echo "POM is already set up for Spark 1."
echo "Cowardly refusing to move to Spark 1..."

exit 1
fi

find . -name "pom.xml" -exec sed \
-e "s/-spark2//g" \
-e "/spark.version/ s/2.0.0/1.6.3/g" \
-i.spark1.bak '{}' \;
9 changes: 9 additions & 0 deletions scripts/move_to_spark_2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

set +x

grep -q "spark2" pom.xml
if [[ $? == 0 ]];
then
echo "POM is already set up for Spark 2."
echo "Cowardly refusing to move to Spark 2..."

exit 1
fi

svp="\${scala.version.prefix}"
substitution_cmd="s/_$svp/-spark2_$svp/g"

Expand Down

0 comments on commit da0fd0a

Please sign in to comment.