Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CANNOLI-215] Add support for Scala 2.12 in build and release scripts #217

Merged
merged 1 commit into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ package org.bdgenomics.cannoli.cli
import grizzled.slf4j.Logging
import htsjdk.samtools.ValidationStringency
import org.apache.spark.SparkContext
import org.apache.spark.rdd.RDD
import org.bdgenomics.adam.rdd.ADAMContext._
import org.bdgenomics.adam.rdd.ADAMSaveAnyArgs
import org.bdgenomics.adam.rdd.fragment.FragmentDataset
import org.bdgenomics.formats.avro.Fragment
import org.bdgenomics.utils.cli._
import org.kohsuke.args4j.{ Argument, Option => Args4jOption }

Expand Down Expand Up @@ -70,7 +72,7 @@ class SampleReads(protected val args: SampleReadsArgs) extends BDGSparkCommand[S

info("Sampling fraction %f with seed %d".format(args.fraction, args.seed))
fragments
.transform(_.sample(withReplacement = false, args.fraction, args.seed))
.transform((rdd: RDD[Fragment]) => rdd.sample(withReplacement = false, args.fraction, args.seed))
.save(args.outputPath)
}
}
8 changes: 2 additions & 6 deletions scripts/move_to_scala_2.11.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ then
exit 1
fi

find . -name "pom.xml" -exec sed -e "s/2.10.6/2.11.8/g" \
-e "s/2.10/2.11/g" \
find . -name "pom.xml" -exec sed -e "s/2.12.8/2.11.12/g" \
-e "s/2.12/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.4
find . -name "pom.xml" -exec sed -e "s/2.11.4/2.10.4/g" -i.2.11.3.bak '{}' \;
find . -name "*.2.11.*bak" -exec rm -f {} \;
17 changes: 17 additions & 0 deletions scripts/move_to_scala_2.12.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set +x

grep "<scala\.version>" pom.xml | grep -q 2.12
if [[ $? == 0 ]];
then
echo "Scala version is already set to 2.12 (Scala artifacts have _2.12 version suffix in artifact name)."
echo "Cowardly refusing to move to Scala 2.12 a second time..."

exit 1
fi

find . -name "pom.xml" -exec sed -e "s/2.11.12/2.12.8/g" \
-e "s/2.11/2.12/g" \
-i.2.12.bak '{}' \;
find . -name "*.2.12.*bak" -exec rm -f {} \;
24 changes: 24 additions & 0 deletions scripts/release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,30 @@ if [ $? != 0 ]; then
exit 1
fi

git checkout master

# do spark 2, scala 2.12 release
git checkout -b maint_spark2_2.12-${release} ${branch}

./scripts/move_to_scala_2.12.sh
git commit -a -m "Modifying pom.xml files for Spark 2, Scala 2.12 release."

mvn --batch-mode \
-P distribution \
-Dresume=false \
-Dtag=cannoli-parent-spark2_2.12-${release} \
-DreleaseVersion=${release} \
-DdevelopmentVersion=${devel} \
-DbranchName=cannoli-spark2_2.12-${release} \
release:clean \
release:prepare \
release:perform

if [ $? != 0 ]; then
echo "Releasing Spark 2, Scala 2.12 version failed."
exit 1
fi

if [ $branch = "master" ]; then
# if original branch was master, update versions on original branch
git checkout ${branch}
Expand Down