diff options
author | Roland Grunberg <rgrunber@redhat.com> | 2014-06-03 12:52:14 -0400 |
---|---|---|
committer | Roland Grunberg <rgrunber@redhat.com> | 2014-06-03 12:59:28 -0400 |
commit | 992650f993c0186c0bcf7b3373b666e77af2ff79 (patch) | |
tree | 376b780cf60a51e4eefdfadf335116a63f68e9d4 | |
parent | f7ab45d6f6ceb405b392df2bcd51c67eaf232d6c (diff) | |
download | tycho-surefire-testbundlerunner-master.tar.gz tycho-surefire-testbundlerunner-master.tar.xz tycho-surefire-testbundlerunner-master.zip |
- Use better logic for Bundle-SymbolicName lookup
- Be more explicit about pom.xml lookup in jars
-rwxr-xr-x | prepTestBundle.sh | 40 | ||||
-rwxr-xr-x | runAllTestBundles.sh | 2 |
2 files changed, 36 insertions, 6 deletions
diff --git a/prepTestBundle.sh b/prepTestBundle.sh index 694857f..53981e0 100755 --- a/prepTestBundle.sh +++ b/prepTestBundle.sh @@ -30,6 +30,36 @@ # --> target/classes/**.class # --> resources/ +function readBSN () { + +bsn= +manEntryPat="^[a-zA-Z-]*:" +foundBSNLine=0 + +while read line; do +if [ ${foundBSNLine} -eq 1 ]; then + echo ${line} | grep -qE ${manEntryPat} + if [ $? -eq 0 ]; then + break + else + bsn=${bsn}"`echo ${line} | sed 's/\([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'`" + fi +fi + +echo ${line} | grep -q "Bundle-SymbolicName:" +if [ $? -eq 0 ]; then + bsn=`echo ${line} | grep 'Bundle-SymbolicName:' | sed 's/Bundle-SymbolicName: \([a-zA-Z0-9_.-]*\)\(;\)\?.*/\1/'` + echo ${line} | grep "Bundle-SymbolicName:" | grep -q ";" + if [ $? -eq 0 ]; then + break + fi + foundBSNLine=1 +fi +done < <(unzip -p $1 'META-INF/MANIFEST.MF') + +echo ${bsn} +} + if [ ! $# -eq 1 ]; then echo "USAGE : $0 /PATH/TO/JAR" exit 1 @@ -38,10 +68,10 @@ fi jarLoc=$1 jarPomPath=`jar -tf ${jarLoc} | grep 'pom.xml'` -bsname=`unzip -p ${jarLoc} 'META-INF/MANIFEST.MF' | grep 'Bundle-SymbolicName' | sed 's/Bundle-SymbolicName: \([a-zA-Z.]*\)\(;\)\?.*/\1/'` +bsname=`readBSN ${jarLoc}` mkdir ${bsname} -pushd ${bsname} +pushd ${bsname} >/dev/null # place manifest and pom jar -xf ${jarLoc} 'META-INF/MANIFEST.MF' ${jarPomPath} @@ -57,15 +87,15 @@ sed -i '/<parent>/,/<\/parent>/ s/<version>.*<\/version>/<version>1.0.0-SNAPSHOT # place classes # non-classes will just be ignored mkdir -p target/classes -pushd target/classes +pushd target/classes >/dev/null jar -xf ${jarLoc} -popd +popd >/dev/null # place resources and other files # non-resources will just be ignored jar -xf ${jarLoc} -popd +popd >/dev/null if [ ! -e pom.xml ]; then cp pom.xml{.orig,} diff --git a/runAllTestBundles.sh b/runAllTestBundles.sh index a198940..0f294b8 100755 --- a/runAllTestBundles.sh +++ b/runAllTestBundles.sh @@ -22,7 +22,7 @@ fi testBundleFolder=$1 for jar in `find ${testBundleFolder} -name "*.jar"`; do - jarPomPath=`jar -tf ${jar} | grep 'pom.xml'` + jarPomPath=`jar -tf ${jar} | grep -E '(^pom.xml$|\/pom.xml$)'` unzip -p ${jar} ${jarPomPath} | grep -q '<packaging>eclipse-test-plugin</packaging>' && ./prepTestBundle.sh ${jar} done |