extract version number from pom.xml - makes -v optional, check if release script is executed from the 'etc' folder
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@7242 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
parent
12faf9023b
commit
61498acc39
7
pmd/etc/extract_release_number.xslt
Normal file
7
pmd/etc/extract_release_number.xslt
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:template match="//project/version">
|
||||
VERSION:<xsl:value-of select="."/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
@ -1,11 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
echo "$(basename ${0}) -v version-number [-d] [-s]"
|
||||
echo "$(basename ${0}) [-v version-number] [-d] [-s]"
|
||||
echo ""
|
||||
echo "-v must provide the release's version number"
|
||||
echo "-v override the release's version number provided in pom.xml"
|
||||
echo "-d no docs generation"
|
||||
echo "-s no SVN tags"
|
||||
echo ""
|
||||
echo "This script MUST BE executed from the 'etc' folder of the PMD projet."
|
||||
}
|
||||
|
||||
check_dependency() {
|
||||
@ -19,7 +21,7 @@ check_dependency() {
|
||||
fi
|
||||
}
|
||||
|
||||
while getopts V:Dh OPT; do
|
||||
while getopts v:dsh OPT; do
|
||||
case "$OPT" in
|
||||
h)
|
||||
usage
|
||||
@ -42,14 +44,20 @@ while getopts V:Dh OPT; do
|
||||
done
|
||||
|
||||
if [ -z ${version} ]; then
|
||||
usage
|
||||
exit 1
|
||||
check_dependency "xsltproc"
|
||||
readonly version=$(xsltproc extract_release_number.xslt ../pom.xml | grep VERSION | cut -f2 -d: | sed -e 's/-SNAPSHOT//')
|
||||
fi
|
||||
|
||||
check_dependency "ant"
|
||||
check_dependency "maven"
|
||||
check_dependency "mvn"
|
||||
|
||||
current_dir=$(pwd | sed -e 's/^.*\///')
|
||||
if [ "${current_dir}" -ne "etc" ], then
|
||||
echo "release script MUST be executed from the 'etc' folder"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
echo "building release version ${version}"
|
||||
|
||||
pmd_top_dir="$(mktemp -d)"
|
||||
|
Loading…
x
Reference in New Issue
Block a user