Merge pull request #771 from broadinstitute/ks_faster_builds
Faster builds of GATK executables
This commit is contained in:
commit
c14fccb571
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
mvn_args="verify"
|
||||
default_args="verify '-Ddisable.shadepackage'"
|
||||
mvn_args="${default_args}"
|
||||
mvn_properties=
|
||||
mvn_clean=
|
||||
unknown_args=
|
||||
|
|
@ -44,22 +45,23 @@ for arg in "${@}" ; do
|
|||
fi
|
||||
|
||||
else
|
||||
if [[ "${arg}" != "dist" && "${mvn_args}" != "" && "${mvn_args}" != "verify" ]] ; then
|
||||
if [[ "${arg}" != "dist" && "${mvn_args}" != "" && "${mvn_args}" != "${default_args}" ]] ; then
|
||||
echo "Sorry, this script does not currently support mixing targets." >&2
|
||||
exit 1
|
||||
|
||||
elif [[ "${arg}" == "dist" ]] ; then
|
||||
mvn_args="verify"
|
||||
mvn_args="${default_args}"
|
||||
|
||||
elif [[ "${arg}" == "gatk" ]] ; then
|
||||
mvn_args="verify '-P!queue'"
|
||||
mvn_args="${default_args} '-P!queue'"
|
||||
|
||||
elif [[ "${arg}" == "test.compile" ]] ; then
|
||||
mvn_args="test-compile"
|
||||
|
||||
elif [[ "${arg}" == "gatkdocs" ]] ; then
|
||||
local_repo="sitetemprepo"
|
||||
mvn_args="install -Dmaven.repo.local=${local_repo} -Ddisable.queue && mvn site -Dmaven.repo.local=${local_repo} -Ddisable.queue"
|
||||
mvn_args="install -Dmaven.repo.local=${local_repo} '-P!queue' && mvn site -Dmaven.repo.local=${local_repo} '-P!queue'"
|
||||
mvn_pkg_args=
|
||||
|
||||
elif [[ "${arg}" == "package.gatk.full" ]] ; then
|
||||
mvn_args="package '-P!private,!queue'"
|
||||
|
|
@ -75,11 +77,11 @@ for arg in "${@}" ; do
|
|||
|
||||
# elif [[ "${arg}" == "release.gatk.full" ]] ; then
|
||||
# mvn_args="package '-P!private,!queue'"
|
||||
# post_script=" && private/src/main/scripts/shell/copy_release.sh public/gatk-package/target/GenomeAnalysisTK-*.tar.bz2"
|
||||
# post_script=" && private/src/main/scripts/shell/copy_release.sh protected/gatk-package-distribution/target/GenomeAnalysisTK-*.tar.bz2"
|
||||
|
||||
# elif [[ "${arg}" == "release.queue.full" ]] ; then
|
||||
# mvn_args="package '-P!private'"
|
||||
# post_script=" && private/src/main/scripts/shell/copy_release.sh public/queue-package/target/Queue-*.tar.bz2"
|
||||
# post_script=" && private/src/main/scripts/shell/copy_release.sh protected/gatk-queue-package-distribution/target/Queue-*.tar.bz2"
|
||||
|
||||
elif [[ "${arg}" == "build-picard-private" ]] ; then
|
||||
mvn_args="mvn install -f private/picard-maven/pom.xml"
|
||||
|
|
@ -113,7 +115,7 @@ for arg in "${@}" ; do
|
|||
mvn_args="${mvn_args} -Dgatk.queuetests.run=true"
|
||||
|
||||
elif [[ "${arg}" == "committests" ]] ; then
|
||||
mvn_args="verify -Dgatk.committests.skipped=false"
|
||||
mvn_args="${default_args} -Dgatk.committests.skipped=false"
|
||||
|
||||
elif [[ "${arg}" == "test" ]] ; then
|
||||
mvn_args="test -Dgatk.unittests.skipped=false"
|
||||
|
|
@ -122,19 +124,19 @@ for arg in "${@}" ; do
|
|||
mvn_args="test -Dgatk.unittests.skipped=false"
|
||||
|
||||
elif [[ "${arg}" == "integrationtest" ]] ; then
|
||||
mvn_args="verify -Dgatk.integrationtests.skipped=false"
|
||||
mvn_args="${default_args} -Dgatk.integrationtests.skipped=false"
|
||||
|
||||
elif [[ "${arg}" == "largescaletest" ]] ; then
|
||||
mvn_args="verify -Dgatk.largescaletests.skipped=false"
|
||||
mvn_args="${default_args} -Dgatk.largescaletests.skipped=false"
|
||||
|
||||
elif [[ "${arg}" == "knowledgebasetest" ]] ; then
|
||||
mvn_args="verify -Dgatk.knowledgebasetests.skipped=false"
|
||||
mvn_args="${default_args} -Dgatk.knowledgebasetests.skipped=false"
|
||||
|
||||
elif [[ "${arg}" == "queuetest" ]] ; then
|
||||
mvn_args="verify -Dgatk.queuetests.skipped=false"
|
||||
mvn_args="${default_args} -Dgatk.queuetests.skipped=false"
|
||||
|
||||
elif [[ "${arg}" == "queuetestrun" ]] ; then
|
||||
mvn_args="verify -Dgatk.queuetests.skipped=false -Dgatk.queuetests.run=true"
|
||||
mvn_args="${default_args} -Dgatk.queuetests.skipped=false -Dgatk.queuetests.run=true"
|
||||
|
||||
elif [[ "${arg}" == "fasttest" ]] ; then
|
||||
mvn_args="verify -Dgatk.committests.skipped=false -pl private/gatk-tools-private -am -Dresource.bundle.skip=true"
|
||||
|
|
|
|||
126
pom.xml
126
pom.xml
|
|
@ -33,11 +33,14 @@
|
|||
<!-- TODO: Need a better a way to say "don't include hidden" by default -->
|
||||
<gatkdocs.include.hidden>-build-timestamp "${maven.build.timestamp}"</gatkdocs.include.hidden>
|
||||
<gatk.shell.directory>${gatk.basedir}/public/src/main/scripts/shell</gatk.shell.directory>
|
||||
<gatk.assembly.directory>${gatk.basedir}/public/src/main/assembly</gatk.assembly.directory>
|
||||
|
||||
<!--
|
||||
Phases of the build that may be disabled to speed up compilation.
|
||||
-->
|
||||
<gatk.jar.phase>package</gatk.jar.phase>
|
||||
<gatk.unpack.phase>prepare-package</gatk.unpack.phase>
|
||||
<gatk.shade.phase>package</gatk.shade.phase>
|
||||
<gatk.generate-resources.phase>generate-resources</gatk.generate-resources.phase>
|
||||
<gatk.process-resources.phase>process-resources</gatk.process-resources.phase>
|
||||
<gatk.process-test-resources.phase>process-test-resources</gatk.process-test-resources.phase>
|
||||
|
|
@ -66,6 +69,16 @@
|
|||
<gatk.serialqueuetests.skipped>${gatk.serialcommittests.skipped}</gatk.serialqueuetests.skipped>
|
||||
<gatk.seriallargescaletests.skipped>true</gatk.seriallargescaletests.skipped>
|
||||
<gatk.serialknowledgebasetests.skipped>true</gatk.serialknowledgebasetests.skipped>
|
||||
|
||||
<!-- Full path to write the executable MANIFEST.MF only jars, 10 seconds to create at 4KB each, and the accompanying lib directory -->
|
||||
<gatk.executable.directory>${gatk.basedir}/target/executable</gatk.executable.directory>
|
||||
<!-- Full path to write (symlinks to) the full shaded package jars, 1+ minute to create at 12MB+ each -->
|
||||
<gatk.package.directory>${gatk.basedir}/target/package</gatk.package.directory>
|
||||
<!--
|
||||
Full path to write symlink to either an executable MANIFEST.MF only jar - OR - a fully shaded package jar.
|
||||
NOTE: MANIFEST.MF only jars MUST be accompanied by the lib folder, or they will not run.
|
||||
-->
|
||||
<gatk.shortcut.directory>${gatk.basedir}/target</gatk.shortcut.directory>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
|
@ -139,9 +152,19 @@
|
|||
<excludes>${resource.bundle.path}</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>executable-jar-lib</id>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<phase>none</phase>
|
||||
<configuration>
|
||||
<outputDirectory>${gatk.executable.directory}/lib</outputDirectory>
|
||||
<includeScope>runtime</includeScope>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- TODO: Change the ResourceBundleExtractorDoclet to not require log4j.properties file -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
|
|
@ -160,25 +183,6 @@
|
|||
</goals>
|
||||
<phase>${gatk.process-test-resources.phase}</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-resource-bundle-log4j</id>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<phase>none</phase>
|
||||
<configuration>
|
||||
<!--
|
||||
Just before running the resource bundle generation, copy a simple log4j
|
||||
config file to the apidocs execution directory, so that logging prints out.
|
||||
-->
|
||||
<outputDirectory>${project.reporting.outputDirectory}/apidocs</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${gatk.basedir}/public/gatk-utils/src/main/config/org/broadinstitute/gatk/utils/help</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
|
@ -199,7 +203,7 @@
|
|||
<docletPath>${project.build.outputDirectory}</docletPath>
|
||||
<docletArtifact>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>gatk-utils</artifactId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</docletArtifact>
|
||||
<maxmemory>2g</maxmemory>
|
||||
|
|
@ -319,10 +323,40 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>executable-jar</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<phase>none</phase>
|
||||
<configuration>
|
||||
<classesDirectory>${project.build.outputDirectory}/ignored_by_executable_jar</classesDirectory>
|
||||
<outputDirectory>${gatk.executable.directory}</outputDirectory>
|
||||
<finalName>${gatk.binary-dist.name}</finalName>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>${app.main.class}</mainClass>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>lib/</classpathPrefix>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<phase>${gatk.jar.phase}</phase>
|
||||
</execution>
|
||||
<!--
|
||||
Maven keeps executing default-jar first, even if it's listed AFTER the executable-jar.
|
||||
So while packaging: run executable-jar, disable default-jar, then run unshaded-default-jar.
|
||||
-->
|
||||
<execution>
|
||||
<id>unshaded-default-jar</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-jar</id>
|
||||
<goals>
|
||||
|
|
@ -341,13 +375,14 @@
|
|||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>gatk-executable</id>
|
||||
<id>package-jar</id>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<phase>none</phase>
|
||||
<configuration>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>org.broadinstitute.gatk:gsalib:tar.gz:*</exclude>
|
||||
|
|
@ -405,7 +440,7 @@
|
|||
<phase>none</phase>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/binary-dist.xml</descriptor>
|
||||
<descriptor>${gatk.assembly.directory}/binary-dist.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
@ -437,7 +472,7 @@
|
|||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>link-binary-jar</id>
|
||||
<id>link-executable-jar</id>
|
||||
<goals>
|
||||
<goal>link</goal>
|
||||
</goals>
|
||||
|
|
@ -445,7 +480,26 @@
|
|||
<configuration>
|
||||
<links>
|
||||
<link>
|
||||
<dst>${gatk.basedir}/target/${gatk.binary-dist.name}.${project.packaging}</dst>
|
||||
<dst>${gatk.shortcut.directory}/${gatk.binary-dist.name}.${project.packaging}</dst>
|
||||
<src>${gatk.executable.directory}/${gatk.binary-dist.name}.${project.packaging}</src>
|
||||
</link>
|
||||
</links>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>link-package-jar</id>
|
||||
<goals>
|
||||
<goal>link</goal>
|
||||
</goals>
|
||||
<phase>none</phase>
|
||||
<configuration>
|
||||
<links>
|
||||
<link>
|
||||
<dst>${gatk.package.directory}/${gatk.binary-dist.name}.${project.packaging}</dst>
|
||||
<src>${project.build.directory}/${project.build.finalName}.${project.packaging}</src>
|
||||
</link>
|
||||
<link>
|
||||
<dst>${gatk.shortcut.directory}/${gatk.binary-dist.name}.${project.packaging}</dst>
|
||||
<src>${project.build.directory}/${project.build.finalName}.${project.packaging}</src>
|
||||
</link>
|
||||
</links>
|
||||
|
|
@ -748,6 +802,26 @@
|
|||
</modules>
|
||||
</profile>
|
||||
|
||||
<!-- Optionally do not shade/package jars -->
|
||||
<!--
|
||||
NOTE: Profile id "fast" comes from comments in PR #771.
|
||||
The name is meant to be memorable, but is highly non-specific. Users are forewarned that
|
||||
behavior of this profile, or the identifier itself, may be heavily modified in the future.
|
||||
Hardcode usage in non-VCS controlled scripts at your own risk.
|
||||
-->
|
||||
<profile>
|
||||
<id>fast</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>disable.shadepackage</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<gatk.unpack.phase>none</gatk.unpack.phase>
|
||||
<gatk.shade.phase>none</gatk.shade.phase>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- Collection of properties for use during package testing -->
|
||||
<profile>
|
||||
<id>packagetests-enabled</id>
|
||||
|
|
@ -761,6 +835,8 @@
|
|||
<maven.javadoc.skip>true</maven.javadoc.skip>
|
||||
<gatk.generate-gatk-extensions.skipped>true</gatk.generate-gatk-extensions.skipped>
|
||||
<gatk.jar.phase>none</gatk.jar.phase>
|
||||
<gatk.unpack.phase>none</gatk.unpack.phase>
|
||||
<gatk.shade.phase>none</gatk.shade.phase>
|
||||
<gatk.generate-resources.phase>none</gatk.generate-resources.phase>
|
||||
<gatk.process-resources.phase>none</gatk.process-resources.phase>
|
||||
<gatk.process-test-resources.phase>none</gatk.process-test-resources.phase>
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
<properties>
|
||||
<gatk.basedir>${project.basedir}/../..</gatk.basedir>
|
||||
<gatk.unpack.phase>prepare-package</gatk.unpack.phase>
|
||||
<gatk.shade.phase>package</gatk.shade.phase>
|
||||
<app.main.class>org.broadinstitute.gatk.engine.CommandLineGATK</app.main.class>
|
||||
<gatk.binary-dist.name>GenomeAnalysisTK</gatk.binary-dist.name>
|
||||
</properties>
|
||||
|
|
@ -169,6 +167,25 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>executable-jar</id>
|
||||
<phase>${gatk.jar.phase}</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>unshaded-default-jar</id>
|
||||
<phase>${gatk.jar.phase}</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
|
|
@ -177,6 +194,10 @@
|
|||
<id>unpack-direct-dependencies</id>
|
||||
<phase>${gatk.unpack.phase}</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>executable-jar-lib</id>
|
||||
<phase>${gatk.jar.phase}</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
|
@ -185,7 +206,7 @@
|
|||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>gatk-executable</id>
|
||||
<id>package-jar</id>
|
||||
<phase>${gatk.shade.phase}</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
@ -207,7 +228,11 @@
|
|||
<artifactId>maven-junction-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>link-binary-jar</id>
|
||||
<id>link-executable-jar</id>
|
||||
<phase>${gatk.jar.phase}</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>link-package-jar</id>
|
||||
<phase>${gatk.shade.phase}</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
|
|
@ -236,20 +261,6 @@
|
|||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>packagetests-enabled</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>gatk.packagetests.enabled</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<gatk.jar.phase>none</gatk.jar.phase>
|
||||
<gatk.unpack.phase>none</gatk.unpack.phase>
|
||||
<gatk.shade.phase>none</gatk.shade.phase>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>gsadev</id>
|
||||
<activation>
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
<properties>
|
||||
<gatk.basedir>${project.basedir}/../..</gatk.basedir>
|
||||
<gatk.unpack.phase>prepare-package</gatk.unpack.phase>
|
||||
<gatk.shade.phase>package</gatk.shade.phase>
|
||||
<gatk.binary-dist.name>Queue</gatk.binary-dist.name>
|
||||
<app.main.class>org.broadinstitute.gatk.queue.QCommandLine</app.main.class>
|
||||
</properties>
|
||||
|
|
@ -171,6 +169,25 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>executable-jar</id>
|
||||
<phase>${gatk.jar.phase}</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>unshaded-default-jar</id>
|
||||
<phase>${gatk.jar.phase}</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
|
|
@ -179,6 +196,10 @@
|
|||
<id>unpack-direct-dependencies</id>
|
||||
<phase>${gatk.unpack.phase}</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>executable-jar-lib</id>
|
||||
<phase>${gatk.jar.phase}</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
|
@ -187,7 +208,7 @@
|
|||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>gatk-executable</id>
|
||||
<id>package-jar</id>
|
||||
<phase>${gatk.shade.phase}</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
@ -209,7 +230,11 @@
|
|||
<artifactId>maven-junction-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>link-binary-jar</id>
|
||||
<id>link-executable-jar</id>
|
||||
<phase>${gatk.jar.phase}</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>link-package-jar</id>
|
||||
<phase>${gatk.shade.phase}</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
|
|
@ -238,20 +263,6 @@
|
|||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>packagetests-enabled</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>gatk.packagetests.enabled</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<gatk.jar.phase>none</gatk.jar.phase>
|
||||
<gatk.unpack.phase>none</gatk.unpack.phase>
|
||||
<gatk.shade.phase>none</gatk.shade.phase>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>gsadev</id>
|
||||
<activation>
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
<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>binary-dist</id>
|
||||
<formats>
|
||||
<format>tar.bz2</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<includes>
|
||||
<include>org.broadinstitute.gatk:gatk-queue-package-distribution</include>
|
||||
</includes>
|
||||
<outputFileNameMapping>${gatk.binary-dist.name}.${artifact.extension}</outputFileNameMapping>
|
||||
</dependencySet>
|
||||
<dependencySet>
|
||||
<outputDirectory>resources</outputDirectory>
|
||||
<unpack>true</unpack>
|
||||
<includes>
|
||||
<include>org.broadinstitute.gatk:gatk-engine:tar.bz2:example-resources</include>
|
||||
<include>org.broadinstitute.gatk:gatk-queue-extensions-public:tar.bz2:example-resources</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
|
|
@ -71,16 +71,6 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resource-bundle-log4j</id>
|
||||
<phase>prepare-package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ import org.broadinstitute.gatk.utils.sam.AlignmentUtils;
|
|||
import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
|
||||
import org.broadinstitute.gatk.engine.io.NWaySAMFileWriter;
|
||||
import org.broadinstitute.gatk.utils.sam.ReadUtils;
|
||||
import org.broadinstitute.gatk.utils.text.TextFormattingUtils;
|
||||
import org.broadinstitute.gatk.utils.text.XReadLines;
|
||||
import htsjdk.variant.variantcontext.VariantContext;
|
||||
|
||||
|
|
@ -476,10 +475,8 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
|||
if ( NO_PG_TAG ) return null;
|
||||
|
||||
final SAMProgramRecord programRecord = new SAMProgramRecord(PROGRAM_RECORD_NAME);
|
||||
final ResourceBundle headerInfo = TextFormattingUtils.loadResourceBundle("StingText");
|
||||
try {
|
||||
final String version = headerInfo.getString("org.broadinstitute.sting.gatk.version");
|
||||
programRecord.setProgramVersion(version);
|
||||
programRecord.setProgramVersion(CommandLineProgram.getVersionNumber());
|
||||
} catch (MissingResourceException e) {
|
||||
// this is left empty on purpose (perhaps Andrey knows why?)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ import org.broadinstitute.gatk.utils.*;
|
|||
import org.broadinstitute.gatk.utils.exceptions.UserException;
|
||||
import htsjdk.variant.variantcontext.*;
|
||||
import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
|
||||
import org.broadinstitute.gatk.utils.text.TextFormattingUtils;
|
||||
import org.broadinstitute.gatk.utils.help.DocumentedGATKFeature;
|
||||
import org.broadinstitute.gatk.utils.help.HelpConstants;
|
||||
import htsjdk.variant.vcf.VCFConstants;
|
||||
|
|
@ -222,8 +221,7 @@ public class SimulateReadsForVariants extends RodWalker<Integer, Integer> {
|
|||
|
||||
final SAMProgramRecord programRecord = new SAMProgramRecord(PROGRAM_RECORD_NAME);
|
||||
if ( !NO_PG_TAG ) {
|
||||
final ResourceBundle headerInfo = TextFormattingUtils.loadResourceBundle("GATKText");
|
||||
programRecord.setProgramVersion(headerInfo.getString("org.broadinstitute.gatk.tools.version"));
|
||||
programRecord.setProgramVersion(CommandLineProgram.getVersionNumber());
|
||||
programRecord.setCommandLine(getToolkit().createApproximateCommandLineArgumentString(getToolkit(), this));
|
||||
}
|
||||
header.setProgramRecords(Arrays.asList(programRecord));
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
<gatk.integrationtests.skipped>${gatk.committests.skipped}</gatk.integrationtests.skipped>
|
||||
|
||||
<!-- This flag is used by the package tests to disable re-shading -->
|
||||
<gatk.unpack.phase>process-resources</gatk.unpack.phase>
|
||||
<gatk.unpack.phase>prepare-package</gatk.unpack.phase>
|
||||
<gatk.shade.phase>package</gatk.shade.phase>
|
||||
</properties>
|
||||
|
||||
|
|
@ -119,9 +119,9 @@
|
|||
<!-- Required as doclet uses reflection to access classes for documentation, instead of source java-->
|
||||
<docletPath>${project.build.outputDirectory}</docletPath>
|
||||
<docletArtifact>
|
||||
<groupId>org.broadinstitute.gatk</groupId>
|
||||
<artifactId>gatk-utils</artifactId>
|
||||
<version>${gatk.version}</version>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</docletArtifact>
|
||||
<maxmemory>2g</maxmemory>
|
||||
<useStandardDocletOptions>false</useStandardDocletOptions>
|
||||
|
|
@ -145,6 +145,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<!-- Explicitly include classes loaded via reflection from artifacts below -->
|
||||
<filters>
|
||||
<filter>
|
||||
|
|
@ -259,7 +260,32 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
<reporting>
|
||||
<excludeDefaults>true</excludeDefaults>
|
||||
</reporting>
|
||||
|
||||
<!-- These profiles are used by the GATK build in a multi-module setting. You do NOT need these profiles. -->
|
||||
<profiles>
|
||||
<!-- Optionally do not shade/package jars -->
|
||||
<!--
|
||||
NOTE: Profile id "fast" comes from comments in PR #771.
|
||||
The name is meant to be memorable, but is highly non-specific. Users are forewarned that
|
||||
behavior of this profile, or the identifier itself, may be heavily modified in the future.
|
||||
Hardcode usage in non-VCS controlled scripts at your own risk.
|
||||
-->
|
||||
<profile>
|
||||
<id>fast</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>disable.shadepackage</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<gatk.unpack.phase>none</gatk.unpack.phase>
|
||||
<gatk.shade.phase>none</gatk.shade.phase>
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- Collection of properties for use during package testing -->
|
||||
<profile>
|
||||
<id>packagetests-enabled</id>
|
||||
<activation>
|
||||
|
|
|
|||
|
|
@ -50,16 +50,6 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resource-bundle-log4j</id>
|
||||
<phase>prepare-package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class WalkerManager extends PluginManager<Walker> {
|
|||
|
||||
public WalkerManager() {
|
||||
super(Walker.class,"walker","");
|
||||
helpText = TextFormattingUtils.loadResourceBundle("GATKText");
|
||||
helpText = TextFormattingUtils.GATK_RESOURCE_BUNDLE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ package org.broadinstitute.gatk.engine.io;
|
|||
import htsjdk.samtools.*;
|
||||
import htsjdk.samtools.util.ProgressLoggerInterface;
|
||||
import org.broadinstitute.gatk.engine.GenomeAnalysisEngine;
|
||||
import org.broadinstitute.gatk.utils.commandline.CommandLineProgram;
|
||||
import org.broadinstitute.gatk.utils.sam.SAMReaderID;
|
||||
import org.broadinstitute.gatk.utils.exceptions.GATKException;
|
||||
import org.broadinstitute.gatk.utils.exceptions.UserException;
|
||||
import org.broadinstitute.gatk.utils.sam.GATKSAMFileWriter;
|
||||
import org.broadinstitute.gatk.utils.text.TextFormattingUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
|
@ -141,10 +141,8 @@ public class NWaySAMFileWriter implements SAMFileWriter {
|
|||
*/
|
||||
public static SAMProgramRecord createProgramRecord(GenomeAnalysisEngine toolkit, Object walker, String PROGRAM_RECORD_NAME) {
|
||||
final SAMProgramRecord programRecord = new SAMProgramRecord(PROGRAM_RECORD_NAME);
|
||||
final ResourceBundle headerInfo = TextFormattingUtils.loadResourceBundle("GATKText");
|
||||
try {
|
||||
final String version = headerInfo.getString("org.broadinstitute.gatk.engine.version");
|
||||
programRecord.setProgramVersion(version);
|
||||
programRecord.setProgramVersion(CommandLineProgram.getVersionNumber());
|
||||
} catch (MissingResourceException e) {
|
||||
// couldn't care less if the resource is missing...
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ import org.broadinstitute.gatk.utils.classloader.PluginManager
|
|||
import org.broadinstitute.gatk.utils.exceptions.UserException
|
||||
import org.broadinstitute.gatk.utils.io.IOUtils
|
||||
import org.broadinstitute.gatk.utils.help.ApplicationDetails
|
||||
import java.util.{ResourceBundle, Arrays}
|
||||
import org.broadinstitute.gatk.utils.text.TextFormattingUtils
|
||||
import java.util.Arrays
|
||||
import org.apache.commons.io.FilenameUtils
|
||||
|
||||
/**
|
||||
|
|
@ -260,33 +259,11 @@ class QCommandLine extends CommandLineProgram with Logging {
|
|||
}
|
||||
|
||||
private def createQueueHeader() : Seq[String] = {
|
||||
Seq(String.format("Queue v%s, Compiled %s", getQueueVersion, getBuildTimestamp),
|
||||
Seq(String.format("Queue v%s, Compiled %s", CommandLineProgram.getVersionNumber, CommandLineProgram.getBuildTime),
|
||||
"Copyright (c) 2012 The Broad Institute",
|
||||
"For support and documentation go to http://www.broadinstitute.org/gatk")
|
||||
}
|
||||
|
||||
private def getQueueVersion : String = {
|
||||
val stingResources : ResourceBundle = TextFormattingUtils.loadResourceBundle("GATKText")
|
||||
|
||||
if ( stingResources.containsKey("org.broadinstitute.gatk.queue.QueueVersion.version") ) {
|
||||
stingResources.getString("org.broadinstitute.gatk.queue.QueueVersion.version")
|
||||
}
|
||||
else {
|
||||
"<unknown>"
|
||||
}
|
||||
}
|
||||
|
||||
private def getBuildTimestamp : String = {
|
||||
val stingResources : ResourceBundle = TextFormattingUtils.loadResourceBundle("GATKText")
|
||||
|
||||
if ( stingResources.containsKey("build.timestamp") ) {
|
||||
stingResources.getString("build.timestamp")
|
||||
}
|
||||
else {
|
||||
"<unknown>"
|
||||
}
|
||||
}
|
||||
|
||||
def shutdown() = {
|
||||
shuttingDown = true
|
||||
qGraph.shutdown()
|
||||
|
|
|
|||
|
|
@ -54,16 +54,6 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resource-bundle-log4j</id>
|
||||
<phase>prepare-package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
|
|
|
|||
|
|
@ -137,16 +137,6 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resource-bundle-log4j</id>
|
||||
<phase>prepare-package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
# Root logger option
|
||||
log4j.rootLogger=INFO, stdout
|
||||
|
||||
# Direct log messages to stdout
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
|
||||
|
|
@ -53,6 +53,14 @@ public class Utils {
|
|||
public static void resetRandomGenerator() { randomGenerator.setSeed(GATK_RANDOM_SEED); }
|
||||
public static void resetRandomGenerator(long seed) { randomGenerator.setSeed(seed); }
|
||||
|
||||
private static final int TEXT_WARNING_WIDTH = 68;
|
||||
private static final String TEXT_WARNING_PREFIX = "* ";
|
||||
private static final String TEXT_WARNING_BORDER = dupString('*', TEXT_WARNING_PREFIX.length() + TEXT_WARNING_WIDTH);
|
||||
private static final char ESCAPE_CHAR = '\u001B';
|
||||
// ASCII codes for making text blink
|
||||
public static final String TEXT_BLINK = ESCAPE_CHAR + "[5m";
|
||||
public static final String TEXT_RESET = ESCAPE_CHAR + "[m";
|
||||
|
||||
/** our log, which we want to capture anything from this class */
|
||||
private static Logger logger = Logger.getLogger(Utils.class);
|
||||
|
||||
|
|
@ -106,28 +114,66 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static void warnUser(final Logger logger, final String msg) {
|
||||
logger.warn(String.format("********************************************************************************"));
|
||||
logger.warn(String.format("* WARNING:"));
|
||||
logger.warn(String.format("*"));
|
||||
prettyPrintWarningMessage(logger, msg);
|
||||
logger.warn(String.format("********************************************************************************"));
|
||||
for (final String line: warnUserLines(msg))
|
||||
logger.warn(line);
|
||||
}
|
||||
|
||||
public static List<String> warnUserLines(final String msg) {
|
||||
List<String> results = new ArrayList<>();
|
||||
results.add(String.format(TEXT_WARNING_BORDER));
|
||||
results.add(String.format(TEXT_WARNING_PREFIX + "WARNING:"));
|
||||
results.add(String.format(TEXT_WARNING_PREFIX));
|
||||
prettyPrintWarningMessage(results, msg);
|
||||
results.add(String.format(TEXT_WARNING_BORDER));
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* pretty print the warning message supplied
|
||||
*
|
||||
* @param logger logger for the message
|
||||
* @param results the pretty printed message
|
||||
* @param message the message
|
||||
*/
|
||||
private static void prettyPrintWarningMessage(Logger logger, String message) {
|
||||
StringBuilder builder = new StringBuilder(message);
|
||||
while (builder.length() > 70) {
|
||||
int space = builder.lastIndexOf(" ", 70);
|
||||
if (space <= 0) space = 70;
|
||||
logger.warn(String.format("* %s", builder.substring(0, space)));
|
||||
builder.delete(0, space + 1);
|
||||
private static void prettyPrintWarningMessage(final List<String> results, final String message) {
|
||||
for (final String line: message.split("\\r?\\n")) {
|
||||
final StringBuilder builder = new StringBuilder(line);
|
||||
while (builder.length() > TEXT_WARNING_WIDTH) {
|
||||
int space = getLastSpace(builder, TEXT_WARNING_WIDTH);
|
||||
if (space <= 0) space = TEXT_WARNING_WIDTH;
|
||||
results.add(String.format("%s%s", TEXT_WARNING_PREFIX, builder.substring(0, space)));
|
||||
builder.delete(0, space + 1);
|
||||
}
|
||||
results.add(String.format("%s%s", TEXT_WARNING_PREFIX, builder));
|
||||
}
|
||||
logger.warn(String.format("* %s", builder));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last whitespace location in string, before width characters.
|
||||
* @param message The message to break.
|
||||
* @param width The width of the line.
|
||||
* @return The last whitespace location.
|
||||
*/
|
||||
private static int getLastSpace(final CharSequence message, int width) {
|
||||
final int length = message.length();
|
||||
int stopPos = width;
|
||||
int currPos = 0;
|
||||
int lastSpace = -1;
|
||||
boolean inEscape = false;
|
||||
while (currPos < stopPos && currPos < length) {
|
||||
final char c = message.charAt(currPos);
|
||||
if (c == ESCAPE_CHAR) {
|
||||
stopPos++;
|
||||
inEscape = true;
|
||||
} else if (inEscape) {
|
||||
stopPos++;
|
||||
if (Character.isLetter(c))
|
||||
inEscape = false;
|
||||
} else if (Character.isWhitespace(c)) {
|
||||
lastSpace = currPos;
|
||||
}
|
||||
currPos++;
|
||||
}
|
||||
return lastSpace;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -296,13 +296,12 @@ public abstract class CommandLineProgram {
|
|||
}
|
||||
|
||||
public static String getVersionNumber() {
|
||||
// TODO: Confirm that version is available elsewhere not on tools.
|
||||
ResourceBundle headerInfo = TextFormattingUtils.loadResourceBundle("GATKText");
|
||||
ResourceBundle headerInfo = TextFormattingUtils.GATK_RESOURCE_BUNDLE;
|
||||
return headerInfo.containsKey("org.broadinstitute.gatk.utils.version") ? headerInfo.getString("org.broadinstitute.gatk.utils.version") : "<unknown>";
|
||||
}
|
||||
|
||||
public static String getBuildTime() {
|
||||
ResourceBundle headerInfo = TextFormattingUtils.loadResourceBundle("GATKText");
|
||||
ResourceBundle headerInfo = TextFormattingUtils.GATK_RESOURCE_BUNDLE;
|
||||
return headerInfo.containsKey("build.timestamp") ? headerInfo.getString("build.timestamp") : "<unknown>";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class DocletUtils {
|
|||
}
|
||||
|
||||
protected static Class getClassForDoc(ProgramElementDoc doc) throws ClassNotFoundException {
|
||||
return Class.forName(getClassName(doc));
|
||||
return Class.forName(getClassName(doc, true));
|
||||
}
|
||||
|
||||
protected static Field getFieldForFieldDoc(FieldDoc fieldDoc) {
|
||||
|
|
@ -67,10 +67,14 @@ public class DocletUtils {
|
|||
* @param doc the Javadoc model for the given class.
|
||||
* @return The (string) class name of the given class.
|
||||
*/
|
||||
protected static String getClassName(ProgramElementDoc doc) {
|
||||
protected static String getClassName(ProgramElementDoc doc, boolean binaryName) {
|
||||
PackageDoc containingPackage = doc.containingPackage();
|
||||
String className = doc.name();
|
||||
if (binaryName) {
|
||||
className = className.replaceAll("\\.", "\\$");
|
||||
}
|
||||
return containingPackage.name().length() > 0 ?
|
||||
String.format("%s.%s", containingPackage.name(), doc.name()) :
|
||||
String.format("%s", doc.name());
|
||||
String.format("%s.%s", containingPackage.name(), className) :
|
||||
String.format("%s", className);
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,11 @@ import java.util.*;
|
|||
* @version 0.1
|
||||
*/
|
||||
public class ResourceBundleExtractorDoclet {
|
||||
// NOTE: Using log4j during javadoc generation requires
|
||||
// a proper Log4J initialization (see CommandLineProgram),
|
||||
// or a log4.properties file. This doclet has neither.
|
||||
//private static Logger logger = Logger.getLogger(ResourceBundleExtractorDoclet.class);
|
||||
|
||||
/**
|
||||
* Taglet for the particular version number.
|
||||
*/
|
||||
|
|
@ -46,16 +51,12 @@ public class ResourceBundleExtractorDoclet {
|
|||
public static final String SUMMARY_TAGLET_NAME = "help.summary";
|
||||
public static final String DESCRIPTION_TAGLET_NAME = "help.description";
|
||||
|
||||
/**
|
||||
* Maintains a collection of resources in memory as they're accumulated.
|
||||
*/
|
||||
protected final Properties resourceText = new Properties();
|
||||
|
||||
/**
|
||||
* Maintains a collection of classes that should really be documented.
|
||||
*/
|
||||
protected final Set<String> undocumentedClasses = new HashSet<String>();
|
||||
private final RootDoc rootDoc;
|
||||
private final Set<ClassDoc> classDocs;
|
||||
private final Set<PackageDoc> packageDocs;
|
||||
private final Set<Doc> allDocs;
|
||||
|
||||
protected File outFile = null;
|
||||
protected String buildTimestamp = null, absoluteVersion = null;
|
||||
|
||||
/**
|
||||
|
|
@ -65,75 +66,22 @@ public class ResourceBundleExtractorDoclet {
|
|||
* @throws IOException if output can't be written.
|
||||
*/
|
||||
public static boolean start(RootDoc rootDoc) throws IOException {
|
||||
ResourceBundleExtractorDoclet doclet = new ResourceBundleExtractorDoclet();
|
||||
PrintStream out = doclet.loadData(rootDoc, true);
|
||||
doclet.processDocs(rootDoc, out);
|
||||
ResourceBundleExtractorDoclet doclet = new ResourceBundleExtractorDoclet(rootDoc);
|
||||
doclet.checkUndocumentedClasses();
|
||||
if (doclet.isUpToDate()) {
|
||||
rootDoc.printNotice("Docs up to date. Not regenerating.");
|
||||
return true;
|
||||
}
|
||||
doclet.processDocs();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected PrintStream loadData(RootDoc rootDoc, boolean overwriteResourcesFile) {
|
||||
PrintStream out = System.out;
|
||||
|
||||
for(String[] options: rootDoc.options()) {
|
||||
if(options[0].equals("-out")) {
|
||||
try {
|
||||
loadExistingResourceFile(options[1], rootDoc);
|
||||
if ( overwriteResourcesFile )
|
||||
out = new PrintStream(options[1]);
|
||||
} catch ( FileNotFoundException e ) {
|
||||
throw new RuntimeException(e);
|
||||
} catch ( IOException e ) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
if(options[0].equals("-build-timestamp"))
|
||||
buildTimestamp = options[1];
|
||||
if (options[0].equals("-absolute-version"))
|
||||
absoluteVersion = options[1];
|
||||
}
|
||||
|
||||
resourceText.setProperty("build.timestamp",buildTimestamp);
|
||||
return out;
|
||||
}
|
||||
|
||||
protected void processDocs(RootDoc rootDoc, PrintStream out) {
|
||||
// Cache packages as we see them, since there's no direct way to iterate over packages.
|
||||
Set<PackageDoc> packages = new HashSet<PackageDoc>();
|
||||
|
||||
for(ClassDoc currentClass: rootDoc.classes()) {
|
||||
PackageDoc containingPackage = currentClass.containingPackage();
|
||||
packages.add(containingPackage);
|
||||
|
||||
if(isRequiredJavadocMissing(currentClass) && shouldDocument(currentClass))
|
||||
undocumentedClasses.add(currentClass.name());
|
||||
|
||||
renderHelpText(DocletUtils.getClassName(currentClass),currentClass);
|
||||
}
|
||||
|
||||
for(PackageDoc currentPackage: packages)
|
||||
renderHelpText(currentPackage.name(),currentPackage);
|
||||
|
||||
try {
|
||||
resourceText.store(out,"Strings displayed by the GATK help system");
|
||||
} catch ( FileNotFoundException e ) {
|
||||
throw new RuntimeException(e);
|
||||
} catch ( IOException e ) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
// ASCII codes for making text blink
|
||||
final String blink = "\u001B\u005B\u0035\u006D";
|
||||
final String reset = "\u001B\u005B\u006D";
|
||||
|
||||
if(undocumentedClasses.size() > 0)
|
||||
Utils.warnUser(String.format("The following are currently undocumented: %s%s%s", blink, Utils.join(" ", undocumentedClasses), reset));
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the given options against options supported by this doclet.
|
||||
* @param option Option to validate.
|
||||
* @return Number of potential parameters; 0 if not supported.
|
||||
*/
|
||||
@SuppressWarnings("unused") // Used by javadoc system
|
||||
public static int optionLength(String option) {
|
||||
if(option.equals("-build-timestamp") || option.equals("-out") || option.equals("-absolute-version") ) {
|
||||
return 2;
|
||||
|
|
@ -141,25 +89,111 @@ public class ResourceBundleExtractorDoclet {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new resource extractor doclet.
|
||||
* @param rootDoc the documentation root.
|
||||
*/
|
||||
private ResourceBundleExtractorDoclet(RootDoc rootDoc) {
|
||||
this.rootDoc = rootDoc;
|
||||
this.classDocs = new TreeSet<>();
|
||||
this.packageDocs = new TreeSet<>();
|
||||
this.allDocs = new TreeSet<>();
|
||||
for (final ClassDoc classDoc: rootDoc.classes()) {
|
||||
this.classDocs.add(classDoc);
|
||||
// Cache packages as we see them, since there's no direct way to iterate over packages.
|
||||
this.packageDocs.add(classDoc.containingPackage());
|
||||
}
|
||||
this.allDocs.addAll(classDocs);
|
||||
this.allDocs.addAll(packageDocs);
|
||||
for(final String[] options: rootDoc.options()) {
|
||||
if(options[0].equals("-out"))
|
||||
this.outFile = new File(options[1]);
|
||||
if(options[0].equals("-build-timestamp"))
|
||||
this.buildTimestamp = options[1];
|
||||
if (options[0].equals("-absolute-version"))
|
||||
this.absoluteVersion = options[1];
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUndocumentedClasses() {
|
||||
final Set<String> undocumentedClasses = new TreeSet<>();
|
||||
|
||||
for (final ClassDoc classDoc: classDocs) {
|
||||
if(isRequiredJavadocMissing(classDoc) && shouldDocument(classDoc))
|
||||
undocumentedClasses.add(classDoc.name());
|
||||
}
|
||||
|
||||
if(undocumentedClasses.size() > 0) {
|
||||
final String message = String.format("The following are currently undocumented: %s%s%s",
|
||||
Utils.TEXT_BLINK, Utils.join(" ", undocumentedClasses), Utils.TEXT_RESET);
|
||||
for (final String line: Utils.warnUserLines(message)) {
|
||||
rootDoc.printWarning(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isUpToDate() {
|
||||
if (outFile == null)
|
||||
return false;
|
||||
|
||||
final long outFileMillis = outFile.lastModified();
|
||||
|
||||
if (outFileMillis == 0L) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (final Doc doc: allDocs) {
|
||||
final File docFile = doc.position() == null ? null : doc.position().file();
|
||||
if (docFile != null && docFile.lastModified() > outFileMillis) {
|
||||
rootDoc.printNotice("At least one item is out of date: " + docFile.getAbsolutePath());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void processDocs() throws IOException {
|
||||
final PrintStream out;
|
||||
if (outFile != null) {
|
||||
out = new PrintStream(outFile);
|
||||
} else {
|
||||
out = System.out;
|
||||
}
|
||||
try {
|
||||
// Maintains a collection of resources in memory as they're accumulated.
|
||||
final Properties resourceText = new Properties();
|
||||
|
||||
loadExistingResourceFile(resourceText);
|
||||
|
||||
resourceText.setProperty("build.timestamp", buildTimestamp);
|
||||
|
||||
for (final ClassDoc currentClass : classDocs)
|
||||
renderHelpText(resourceText, DocletUtils.getClassName(currentClass, false), currentClass);
|
||||
for (final PackageDoc currentPackage : packageDocs)
|
||||
renderHelpText(resourceText, currentPackage.name(), currentPackage);
|
||||
|
||||
resourceText.store(out, "Strings displayed by the GATK help system");
|
||||
} finally {
|
||||
if (outFile != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to load the contents of the resource file named by resourceFileName into
|
||||
* our in-memory resource collection resourceText. If the resource file doesn't exist,
|
||||
* prints a notice to the user but does not throw an exception back to the calling method,
|
||||
* since we'll just create a new resource file from scratch in that case.
|
||||
* @param resourceFileName name of the resource file to attempt to load.
|
||||
* @param rootDoc the documentation root.
|
||||
* @throws IOException if there is an I/O-related error other than FileNotFoundException
|
||||
* while attempting to read the resource file.
|
||||
*/
|
||||
private void loadExistingResourceFile( String resourceFileName, RootDoc rootDoc ) throws IOException {
|
||||
private void loadExistingResourceFile(final Properties resourceText) throws IOException {
|
||||
try {
|
||||
BufferedReader resourceFile = new BufferedReader(new FileReader(resourceFileName));
|
||||
try {
|
||||
try (final BufferedReader resourceFile = new BufferedReader(new FileReader(outFile))) {
|
||||
resourceText.load(resourceFile);
|
||||
}
|
||||
finally {
|
||||
resourceFile.close();
|
||||
}
|
||||
}
|
||||
catch ( FileNotFoundException e ) {
|
||||
rootDoc.printNotice("Resource file not found -- generating a new one from scratch.");
|
||||
|
|
@ -172,11 +206,14 @@ public class ResourceBundleExtractorDoclet {
|
|||
* @return True if the class should be documented. False otherwise.
|
||||
*/
|
||||
protected static boolean shouldDocument(ClassDoc classDoc) {
|
||||
if (classDoc.isAbstract()) {
|
||||
return false;
|
||||
}
|
||||
// TODO: Code duplication with GATKDoclet, including DocletUtils.getClassForDoc().
|
||||
// TODO: Refactor common methods into DocletUtils, and possibly just use DocumentGATKFeatureObjects.
|
||||
final Class<? extends Object> docClass;
|
||||
final Class<?> docClass;
|
||||
try {
|
||||
docClass = (Class<? extends Object>) DocletUtils.getClassForDoc(classDoc);
|
||||
docClass = (Class<?>) DocletUtils.getClassForDoc(classDoc);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return false;
|
||||
} catch (NoClassDefFoundError e) {
|
||||
|
|
@ -184,6 +221,9 @@ public class ResourceBundleExtractorDoclet {
|
|||
} catch (UnsatisfiedLinkError e) {
|
||||
return false; // naughty BWA bindings
|
||||
}
|
||||
if (Throwable.class.isAssignableFrom(docClass)) {
|
||||
return false; // UserExceptions
|
||||
}
|
||||
final DocumentedGATKFeature f = docClass.getAnnotation(DocumentedGATKFeature.class);
|
||||
return f != null && f.enable();
|
||||
}
|
||||
|
|
@ -199,10 +239,11 @@ public class ResourceBundleExtractorDoclet {
|
|||
|
||||
/**
|
||||
* Renders all the help text required for a given name.
|
||||
* @param resourceText resource text properties
|
||||
* @param elementName element name to use as the key
|
||||
* @param element Doc element to process.
|
||||
*/
|
||||
private void renderHelpText(String elementName, Doc element) {
|
||||
private void renderHelpText(final Properties resourceText, final String elementName, final Doc element) {
|
||||
StringBuilder summaryBuilder = new StringBuilder();
|
||||
for(Tag tag: element.firstSentenceTags())
|
||||
summaryBuilder.append(tag.text());
|
||||
|
|
|
|||
|
|
@ -26,7 +26,14 @@
|
|||
package org.broadinstitute.gatk.utils.io;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.SequenceInputStream;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Stores a resource by path and a relative class.
|
||||
|
|
@ -34,6 +41,7 @@ import java.io.InputStream;
|
|||
public class Resource {
|
||||
private final String path;
|
||||
private final Class<?> relativeClass;
|
||||
private final ClassLoader relativeClassLoader;
|
||||
|
||||
/**
|
||||
* Create a resource with a path and a relative class.
|
||||
|
|
@ -45,12 +53,20 @@ public class Resource {
|
|||
public Resource(String path, Class<?> relativeClass) {
|
||||
this.path = path;
|
||||
this.relativeClass = relativeClass;
|
||||
ClassLoader classLoader = null;
|
||||
if (relativeClass != null)
|
||||
classLoader = relativeClass.getClassLoader();
|
||||
this.relativeClassLoader = classLoader != null ? classLoader : ClassLoader.getSystemClassLoader();
|
||||
}
|
||||
|
||||
public Class<?> getRelativeClass() {
|
||||
return relativeClass;
|
||||
}
|
||||
|
||||
public ClassLoader getRelativeClassLoader() {
|
||||
return relativeClassLoader;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
|
@ -88,4 +104,39 @@ public class Resource {
|
|||
|
||||
return inputStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of this resource as an InputStream
|
||||
* @throws IllegalArgumentException if resource cannot be read
|
||||
* @return an input stream that will read the contents of these resources
|
||||
*/
|
||||
public List<InputStream> getAllResourcesContentsAsStreams() {
|
||||
final List<InputStream> resourceStreams = new ArrayList<InputStream>();
|
||||
try {
|
||||
final Enumeration<URL> resources = getRelativeClassLoader().getResources(path);
|
||||
while (resources.hasMoreElements()) {
|
||||
try {
|
||||
resourceStreams.add(resources.nextElement().openStream());
|
||||
} catch (IOException ignored) {
|
||||
/* skip exceptions, just like ClassLoader.getSystemResourceAsStream() */
|
||||
}
|
||||
}
|
||||
} catch (IOException ignoredAlso) {
|
||||
/* skip exceptions, just like ClassLoader.getSystemResourceAsStream() */
|
||||
}
|
||||
if (resourceStreams.isEmpty()) {
|
||||
throw new IllegalArgumentException("Resource not found: " + path);
|
||||
}
|
||||
return resourceStreams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of this resource as an InputStream
|
||||
* @throws IllegalArgumentException if resource cannot be read
|
||||
* @return an input stream that will read the contents of these resources
|
||||
*/
|
||||
public InputStream getAllResourcesContentsAsStream() {
|
||||
final List<InputStream> resourceStreams = getAllResourcesContentsAsStreams();
|
||||
return new SequenceInputStream(Collections.enumeration(resourceStreams));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.gatk.utils.text;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException;
|
||||
import org.broadinstitute.gatk.utils.io.Resource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
|
|
@ -44,7 +45,12 @@ public class TextFormattingUtils {
|
|||
/**
|
||||
* our log, which we want to capture anything from this class
|
||||
*/
|
||||
private static Logger logger = Logger.getLogger(TextFormattingUtils.class);
|
||||
private static Logger logger = Logger.getLogger(TextFormattingUtils.class);
|
||||
|
||||
/**
|
||||
* The contents of the GATK bundle. If no such resource exists, warn the user and create an empty bundle.
|
||||
*/
|
||||
public static final ResourceBundle GATK_RESOURCE_BUNDLE = loadResourceBundle("GATKText", null);
|
||||
|
||||
/**
|
||||
* The default line width, for GATK output written to the screen.
|
||||
|
|
@ -96,14 +102,18 @@ public class TextFormattingUtils {
|
|||
* Load the contents of a resource bundle with the given name. If no such resource exists, warn the user
|
||||
* and create an empty bundle.
|
||||
* @param bundleName The name of the bundle to load.
|
||||
* @param relativeClass The relative class or null to load a bundle from the root.
|
||||
* @return The best resource bundle that can be found matching the given name.
|
||||
*/
|
||||
public static ResourceBundle loadResourceBundle(String bundleName) {
|
||||
public static ResourceBundle loadResourceBundle(String bundleName, Class<?> relativeClass) {
|
||||
final ResourceBundle.Control c = ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT);
|
||||
final String resourceName = c.toResourceName(c.toBundleName(bundleName, Locale.ROOT), "properties");
|
||||
final Resource resource = new Resource(resourceName, relativeClass);
|
||||
ResourceBundle bundle;
|
||||
try {
|
||||
bundle = ResourceBundle.getBundle(bundleName);
|
||||
bundle = new PropertyResourceBundle(resource.getAllResourcesContentsAsStream());
|
||||
}
|
||||
catch(MissingResourceException ex) {
|
||||
catch(Exception ex) {
|
||||
//logger.warn("Unable to load help text. Help output will be sparse.");
|
||||
// Generate an empty resource bundle.
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,14 @@
|
|||
</goals>
|
||||
<phase>${gatk.generate-resources.phase}</phase>
|
||||
<configuration>
|
||||
<!--
|
||||
Looking at the assembly plugin 2.4(.1) source code, <updateOnly>true</updateOnly>
|
||||
is equivalent to plexus_archiver.setForced(false). Unlike the docs say, this
|
||||
does work even if the file does not exist.
|
||||
Also, why..? "archiver.setUseJvmChmod( configSource.isUpdateOnly() );"
|
||||
Appears to only affect the plexus dir/DirectoryArchiver.
|
||||
-->
|
||||
<updateOnly>true</updateOnly>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>src/assembly/gsalib.xml</descriptor>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<dependencySets>
|
||||
<dependencySet>
|
||||
<includes>
|
||||
<include>org.broadinstitute.gatk:gatk-package-distribution</include>
|
||||
<include>${groupId}:${artifactId}</include>
|
||||
</includes>
|
||||
<outputFileNameMapping>${gatk.binary-dist.name}.${artifact.extension}</outputFileNameMapping>
|
||||
</dependencySet>
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
<outputDirectory>resources</outputDirectory>
|
||||
<unpack>true</unpack>
|
||||
<includes>
|
||||
<include>org.broadinstitute.gatk:gatk-engine:tar.bz2:example-resources</include>
|
||||
<include>org.broadinstitute.gatk:*:tar.bz2:example-resources</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
Loading…
Reference in New Issue