diff options
-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 |