Fixes for tools/coverage.sh
* add '-mindepth 1' to the 'find' command that is used to get the plugin
list:
Without this parameter the result contains "plugins/" in addition to
"plugins/<plugin-1>", "plugins/<plugin-2", etc.
* fix copy command to copy plugin sources:
We used "cp -r plugins/*/{java,javatests}/* ${destdir}/${plugin}/java"
which copied the code of all plugins into each plugin folder at the
destination. To fix this include the plugin name into the source
folder, so that only code of this one plugin is copied. If we do this
we should test if the source folder exists before copying to avoid
error messages for non-existing folder.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I338b99209eff5643a83e401e2a56ac3113cbe541
diff --git a/tools/coverage.sh b/tools/coverage.sh
index c92d5cf..3582d22 100755
--- a/tools/coverage.sh
+++ b/tools/coverage.sh
@@ -33,15 +33,24 @@
cp -r {java,javatests}/* ${destdir}/java
mkdir -p ${destdir}/plugins
-for plugin in `find plugins/ -maxdepth 1 -type d`
+for plugin in `find plugins/ -mindepth 1 -maxdepth 1 -type d`
do
mkdir -p ${destdir}/${plugin}/java
- cp -r plugins/*/{java,javatests}/* ${destdir}/${plugin}/java
+ if [ -e ${plugin}/java/ ]
+ then cp -r ${plugin}/java/* ${destdir}/${plugin}/java
+ fi
+ if [ -e ${plugin}/javatests/ ]
+ then cp -r ${plugin}/javatests/* ${destdir}/${plugin}/java
+ fi
# for backwards compatibility support plugins with old file structure
mkdir -p ${destdir}/${plugin}/src/{main,test}/java
- cp -r plugins/*/src/main/java/* ${destdir}/${plugin}/src/main/java
- cp -r plugins/*/src/test/java/* ${destdir}/${plugin}/src/test/java
+ if [ -e ${plugin}/src/main/java/ ]
+ then cp -r ${plugin}/src/main/java/* ${destdir}/${plugin}/src/main/java/
+ fi
+ if [ -e ${plugin}/src/test/java/ ]
+ then cp -r ${plugin}/src/test/java/* ${destdir}/${plugin}/src/test/java/
+ fi
done
base=$(bazel info bazel-testlogs)