Added a compile time script to enforce utils/engine/tools separation.

This commit is contained in:
Khalid Shakir 2014-10-22 00:40:47 +08:00
parent 5c9fe1a06d
commit 4d3db58c71
2 changed files with 42 additions and 1 deletions

18
pom.xml
View File

@ -32,6 +32,7 @@
<resource.bundle.skip>false</resource.bundle.skip>
<!-- 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>
<!--
Phases of the build that may be disabled to speed up compilation.
@ -623,6 +624,21 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<!--
TODO: Separate maven modules into separate git repos?
Until then, keep devs from accidentally mixing utils/engine/tools.
-->
<id>check-utils-engine-tools</id>
<goals>
<goal>exec</goal>
</goals>
<phase>process-sources</phase>
<inherited>false</inherited>
<configuration>
<executable>${gatk.shell.directory}/check_utils_engine_tools.sh</executable>
</configuration>
</execution>
<execution>
<!--
TODO: Remove after 3.3+ release.
@ -636,7 +652,7 @@
<phase>process-test-resources</phase>
<inherited>false</inherited>
<configuration>
<executable>${gatk.basedir}/public/src/main/scripts/shell/delete_maven_links.sh</executable>
<executable>${gatk.shell.directory}/delete_maven_links.sh</executable>
</configuration>
</execution>
</executions>

View File

@ -0,0 +1,25 @@
#!/bin/sh
# Exit with an error if:
# - utils contains a reference to engine or tools
# - engine contains a reference to tools
sh -c \
"grep -Rn \
-e 'org.broadinstitute.gatk.tools' \
-e 'org.broadinstitute.gatk.engine' \
*/*/src/*/*/org/broadinstitute/gatk/utils | \
grep -v dependencyanalyzer && \
grep -Rn \
-e 'org.broadinstitute.gatk.tools' \
*/*/src/*/*/org/broadinstitute/gatk/engine" | \
sed -e 's/:/:'$'\x1B\x5B\x35\x6d''/2' -e 's/$/'$'\x1B\x5B\x6d''/' | \
grep gatk
RESULT=$?
if [[ ${RESULT} -eq 0 ]]; then
echo "Fix the above errors. Do not import tools nor engine into the utils, and do not import tools into the engine." >&2
exit 1
else
exit 0
fi