Skip to content

Commit

Permalink
Add a 'distribution' module to create assemblies
Browse files Browse the repository at this point in the history
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
  • Loading branch information
massie committed Nov 25, 2014
1 parent e2c74f0 commit 888f32e
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 30 deletions.
17 changes: 0 additions & 17 deletions adam-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- disable surefire -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
22 changes: 15 additions & 7 deletions bin/adam-submit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 15 additions & 6 deletions bin/compute-adam-classpath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
53 changes: 53 additions & 0 deletions distribution/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.bdgenomics.adam</groupId>
<artifactId>adam-parent</artifactId>
<version>0.14.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>adam-distribution</artifactId>
<packaging>pom</packaging>
<name>ADAM: Distribution</name>
<build>
<plugins>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>Generate Documentation</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${project.basedir}/../docs</workingDirectory>
<executable>./build.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
67 changes: 67 additions & 0 deletions distribution/src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>bin</id>
<formats>
<format>tar.gz</format>
<format>tar.bz2</format>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>../</directory>
<includes>
<include>LICENSE.txt</include>
<include>NOTICE.txt</include>
<include>CHANGES.md</include>
<include>CONTRIBUTING.md</include>
<include>README.md</include>
</includes>
<outputDirectory>.</outputDirectory>
</fileSet>
<fileSet>
<directory>../adam-cli/target/appassembler/bin</directory>
<outputDirectory>bin</outputDirectory>
<excludes>
<exclude>*.bat</exclude>
</excludes>
<directoryMode>0755</directoryMode>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<directory>../adam-cli/target/appassembler/bin</directory>
<outputDirectory>bin</outputDirectory>
<includes>
<include>*.bat</include>
</includes>
<directoryMode>0755</directoryMode>
<fileMode>0644</fileMode>
</fileSet>
<fileSet>
<directory>../adam-cli/target/appassembler/repo</directory>
<outputDirectory>repo</outputDirectory>
<directoryMode>0755</directoryMode>
<fileMode>0644</fileMode>
</fileSet>
<fileSet>
<directory>../bin</directory>
<outputDirectory>bin</outputDirectory>
<directoryMode>0755</directoryMode>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<directory>../docs/output</directory>
<outputDirectory>docs</outputDirectory>
<directoryMode>0755</directoryMode>
<fileMode>0755</fileMode>
</fileSet>
</fileSets>
<!--
<dependencySets>
<dependencySet>
<outputDirectory>repo</outputDirectory>
</dependencySet>
</dependencySets>
-->
</assembly>
1 change: 1 addition & 0 deletions docs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<module>adam-core</module>
<module>adam-apis</module>
<module>adam-cli</module>
<!-- distribution should be last -->
<module>distribution</module>
</modules>

<licenses>
Expand Down

0 comments on commit 888f32e

Please sign in to comment.