From 9b3a2c443dc27d5d2536fe4cbd79d79eb10b5d87 Mon Sep 17 00:00:00 2001 From: Matt Massie Date: Tue, 25 Nov 2014 12:09:14 -0800 Subject: [PATCH] Add a 'distribution' module to create assemblies o Moves the maven-assembly-plugin from adam-cli to the new distribution module o Updates the adam-submit and friends to work from source or binary distributions o Generates docs and adds them to the distribution o Adds LICENSE, NOTICE.txt, CHANGES.md, etc to distribution --- adam-cli/pom.xml | 17 ------ adam-cli/src/main/assembly/assembly.xml | 55 ----------------- bin/adam-submit | 22 ++++--- bin/compute-adam-classpath.sh | 21 +++++-- distribution/pom.xml | 53 ++++++++++++++++ distribution/src/main/assembly/assembly.xml | 67 +++++++++++++++++++++ docs/build.sh | 7 +++ pom.xml | 2 + scripts/jenkins-test | 2 +- 9 files changed, 160 insertions(+), 86 deletions(-) delete mode 100644 adam-cli/src/main/assembly/assembly.xml create mode 100644 distribution/pom.xml create mode 100644 distribution/src/main/assembly/assembly.xml diff --git a/adam-cli/pom.xml b/adam-cli/pom.xml index d0b24d09b2..22eb631680 100644 --- a/adam-cli/pom.xml +++ b/adam-cli/pom.xml @@ -33,23 +33,6 @@ - - org.apache.maven.plugins - maven-assembly-plugin - - - src/main/assembly/assembly.xml - - - - - package - - single - - - - org.apache.maven.plugins diff --git a/adam-cli/src/main/assembly/assembly.xml b/adam-cli/src/main/assembly/assembly.xml deleted file mode 100644 index 986d3ed40b..0000000000 --- a/adam-cli/src/main/assembly/assembly.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - bin - - tar.gz - tar.bz2 - zip - - - - - target/appassembler/bin - bin - - *.bat - - 0755 - 0755 - - - target/appassembler/bin - bin - - *.bat - - 0755 - 0644 - - - target/appassembler/repo - repo - 0755 - 0644 - - - - diff --git a/bin/adam-submit b/bin/adam-submit index edcd4634ba..90d56a34de 100755 --- a/bin/adam-submit +++ b/bin/adam-submit @@ -18,26 +18,34 @@ # # Figure out where ADAM is installed -ADAM_REPO="$(cd `dirname $0`/..; pwd)" +SCRIPT_DIR="$(cd `dirname $0`/..; pwd)" # Get list of required jars for ADAM -ADAM_JARS=$("$ADAM_REPO"/bin/compute-adam-jars.sh) +ADAM_JARS=$("$SCRIPT_DIR"/bin/compute-adam-jars.sh) + +# Binary distribution +REPO_DIR="$SCRIPT_DIR/repo" +if [ ! -d "$REPO_DIR" ]; then +# Fallback to source directory +REPO_DIR="$SCRIPT_DIR/adam-cli/target/appassembler/repo/" +fi # Find the ADAM CLI jar -num_versions=$(ls "$ADAM_REPO"/adam-cli/target/appassembler/repo/org/bdgenomics/adam/adam-cli | wc -l) +CLI_DIR="$REPO_DIR/org/bdgenomics/adam/adam-cli" +num_versions=$(ls "$CLI_DIR" | wc -l) if [ "$num_versions" -eq "0" ]; then - echo "Failed to find adam-cli jar in $ADAM_REPO/adam-cli/target/appassembler/repo/org/bdgenomics/adam/adam-cli" + echo "Failed to find adam-cli jar in $CLI_DIR" echo "You need to build ADAM before running this program." exit 1 fi if [ "$num_versions" -gt "1" ]; then - versions_list=$(ls "$ADAM_REPO"/adam-cli/target/appassembler/repo/org/bdgenomics/adam/adam-cli) - echo "Found multiple ADAM CLI versions in $ADAM_REPO/adam-cli/target/appassembler/repo/org/bdgenomics/adam/adam-cli:" + versions_list=$(ls "$CLI_DIR") + echo "Found multiple ADAM CLI versions in $CLI_DIR:" echo "$versions_list" echo "Please remove all but one." exit 1 fi -ADAM_CLI_JAR="$(ls "$ADAM_REPO"/adam-cli/target/appassembler/repo/org/bdgenomics/adam/adam-cli/*/adam-cli-*.jar)" +ADAM_CLI_JAR=$(ls $CLI_DIR/*/adam-cli-*.jar) # Find spark-submit script if [ -z "$SPARK_HOME" ]; then diff --git a/bin/compute-adam-classpath.sh b/bin/compute-adam-classpath.sh index c45983a635..e1fbed009f 100755 --- a/bin/compute-adam-classpath.sh +++ b/bin/compute-adam-classpath.sh @@ -18,16 +18,25 @@ # # Figure out where ADAM is installed -ADAM_REPO="$(cd `dirname $0`/..; pwd)" +SCRIPT_DIR="$(cd `dirname $0`/..; pwd)" -# Next three commands set CLASSPATH like appassembler -BASEDIR="$ADAM_REPO"/adam-cli/target/appassembler -REPO="$BASEDIR"/repo -if [ ! -f "$BASEDIR"/bin/adam ]; then +# Setup CLASSPATH like appassembler + +# Assume we're running in a binary distro +ADAM_CMD="$SCRIPT_DIR/bin/adam" +REPO="$SCRIPT_DIR/repo" + +# Fallback to source repo +if [ ! -f $ADAM_CMD ]; then +ADAM_CMD="$SCRIPT_DIR/adam-cli/target/appassembler/bin/adam" +REPO="$SCRIPT_DIR/adam-cli/target/appassembler/repo" +fi + +if [ ! -f "$ADAM_CMD" ]; then echo "Failed to find appassembler scripts in $BASEDIR/bin" echo "You need to build ADAM before running this program" exit 1 fi -eval $(cat "$BASEDIR"/bin/adam | grep "^CLASSPATH") +eval $(cat "$ADAM_CMD" | grep "^CLASSPATH") echo "$CLASSPATH" diff --git a/distribution/pom.xml b/distribution/pom.xml new file mode 100644 index 0000000000..55b4ebb3d8 --- /dev/null +++ b/distribution/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + + org.bdgenomics.adam + adam-parent + 0.14.1-SNAPSHOT + ../pom.xml + + + adam-distribution + pom + ADAM: Distribution + + + + exec-maven-plugin + org.codehaus.mojo + + + Generate Documentation + generate-sources + + exec + + + ${project.basedir}/../docs + ./build.sh + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + src/main/assembly/assembly.xml + + + + + package + + single + + + + + + + diff --git a/distribution/src/main/assembly/assembly.xml b/distribution/src/main/assembly/assembly.xml new file mode 100644 index 0000000000..9aadb86e8b --- /dev/null +++ b/distribution/src/main/assembly/assembly.xml @@ -0,0 +1,67 @@ + + + bin + + tar.gz + tar.bz2 + zip + + + + ../ + + LICENSE.txt + NOTICE.txt + CHANGES.md + CONTRIBUTING.md + README.md + + . + + + ../adam-cli/target/appassembler/bin + bin + + *.bat + + 0755 + 0755 + + + ../adam-cli/target/appassembler/bin + bin + + *.bat + + 0755 + 0644 + + + ../adam-cli/target/appassembler/repo + repo + 0755 + 0644 + + + ../bin + bin + 0755 + 0755 + + + ../docs/output + docs + 0755 + 0644 + + + + diff --git a/docs/build.sh b/docs/build.sh index 5ba7938a70..4e0119af3f 100755 --- a/docs/build.sh +++ b/docs/build.sh @@ -3,6 +3,7 @@ git_version=$(git rev-parse --short HEAD) output_dir="output" +rm $output_dir/* 2>/dev/null pdf_output="$output_dir/ADAM_v$git_version.pdf" html_output="$output_dir/ADAM_v$git_version.html" date_str=$(date '+%Y-%m-%d') @@ -12,6 +13,12 @@ date="$date_str git:$git_version" author="http://bdgenomics.org/" highlight_style="tango" +which pandoc >/dev/null 2>&1 +if [ $? -ne "0" ]; then + echo "WARNING! Pandoc not found on path. Documentation will not be generated!" + exit 0 +fi + # Generate a PDF of the docs pandoc -N --template=template.tex \ --highlight-style "$highlight_style" \ diff --git a/pom.xml b/pom.xml index 5d572d10ad..a170dfedb2 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,8 @@ adam-core adam-apis adam-cli + + distribution diff --git a/scripts/jenkins-test b/scripts/jenkins-test index a9febba04e..5ef471e59f 100755 --- a/scripts/jenkins-test +++ b/scripts/jenkins-test @@ -61,7 +61,7 @@ popd pushd "$PROJECT_ROOT" ./scripts/format-source -if grep --quiet "dirty" <(git describe --dirty --tags) +if test -n "$(git status --porcelain)" then echo "Please run './scripts/format-source'" exit 1