Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlyn Normington2010-05-11 08:15:08 -0400
committerGlyn Normington2010-05-11 08:15:08 -0400
commit5dfdbe75bdf1ba2476fe2e60e62e3454a3565de7 (patch)
tree5522099ce269769cdd39fe31fbe2d20afd416a1c /scripts
parentb99bf75af622c030c6c9b479c1639925bd1ea872 (diff)
downloadorg.eclipse.virgo.kernel-5dfdbe75bdf1ba2476fe2e60e62e3454a3565de7.tar.gz
org.eclipse.virgo.kernel-5dfdbe75bdf1ba2476fe2e60e62e3454a3565de7.tar.xz
org.eclipse.virgo.kernel-5dfdbe75bdf1ba2476fe2e60e62e3454a3565de7.zip
initial checkin from dm Server kernel commit dffbc217a919cefba04886160ba820f2c6cf5f57 omitting build-kernel/bin/service
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/CoverageOverview.groovy67
-rwxr-xr-xscripts/update-dependency.sh3
2 files changed, 70 insertions, 0 deletions
diff --git a/scripts/CoverageOverview.groovy b/scripts/CoverageOverview.groovy
new file mode 100755
index 00000000..08ea7c1c
--- /dev/null
+++ b/scripts/CoverageOverview.groovy
@@ -0,0 +1,67 @@
+#!/usr/bin/env groovy
+
+import javax.xml.parsers.DocumentBuilderFactory
+import javax.xml.xpath.*
+
+def buildXmlFile = new File("build-kernel/build.xml")
+def buildXml = loadXmlFile(buildXmlFile);
+def relativeLocations = readProjectLocations(buildXml);
+
+def cloverResultFiles = []
+
+relativeLocations.each {
+ cloverResultFiles.add(new File(buildXmlFile.parent, it + "/target/clover/clover.xml"))
+}
+
+println ""
+
+cloverResultFiles.each {
+
+ def coverage = determineCoverage(it);
+
+ outputCoverage (it.parentFile.parentFile.parentFile.name, coverage);
+}
+
+def overallCoverage = determineCoverage(new File(buildXmlFile.parent, "/target/clover/clover.xml"))
+
+println ""
+outputCoverage("Overall", overallCoverage);
+println ""
+
+def loadXmlFile(File xmlFile) {
+ builder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
+ inputStream = new FileInputStream(xmlFile)
+ return builder.parse(inputStream).documentElement
+}
+
+def readProjectLocations(def buildXml) {
+ def xpath = XPathFactory.newInstance().newXPath()
+ def nodes = xpath.evaluate( '//path[@id="unit.test.bundles"]/pathelement', buildXml, XPathConstants.NODESET)
+
+ def locations = []
+
+ nodes.each {
+ locations.add(xpath.evaluate( '@location', it ))
+ }
+
+ return locations
+}
+
+double determineCoverage(def cloverXmlFile) {
+ if (!cloverXmlFile.exists()) {
+ return 0;
+ }
+
+ def cloverXml = loadXmlFile(cloverXmlFile);
+ def xpath = XPathFactory.newInstance().newXPath()
+ def metrics = xpath.evaluate( '/coverage/project/metrics', cloverXml, XPathConstants.NODESET).item(0)
+
+ coveredElements = xpath.evaluate('@coveredelements', metrics).toDouble()
+ elements = xpath.evaluate('@elements', metrics).toDouble()
+
+ return (coveredElements / elements) * 100
+}
+
+def outputCoverage(def name, def coverage) {
+ println String.format("%-48s: %5.2f%%", name, coverage)
+}
diff --git a/scripts/update-dependency.sh b/scripts/update-dependency.sh
new file mode 100755
index 00000000..02f24bc0
--- /dev/null
+++ b/scripts/update-dependency.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+find . -name "*.java" -or -name ".classpath" -or -name "*.versions" -or -name "*.properties" | xargs grep -l $1 | grep -v "ivy-cache\|target" | xargs sed -ie s/$1/$2/g
+find . -name "*.javae" -or -name ".classpathe" -or -name "*.versionse" -or -name "*.propertiese" | xargs rm

Back to the top