From b3e36b3bdfce38981b5ebf03f932333d1adb84df Mon Sep 17 00:00:00 2001 From: rnguyen Date: Wed, 30 Jul 2014 20:28:26 -0500 Subject: [PATCH] Update to support groovy projects 2 issues were identified that caused this plugin to fail when run on groovy projects. - Java sources under the groovy sourceSet are ignored Groovy projects may contain java sources in the groovy sourceSet for joint compilation. These java files are ignored by the plugin. - Java sourceSet directory might not exist A groovy project might put all of its java source under the groovy sourceSet and use joint compilation. If any sourceSets.main.java.srcDirs do not exist, then the cov-emit-java task will fail. --- .../naedward/gradle/coverityplugin/tasks/EmitTask.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/groovy/naedward/gradle/coverityplugin/tasks/EmitTask.groovy b/src/main/groovy/naedward/gradle/coverityplugin/tasks/EmitTask.groovy index b29a6fd..592aac8 100644 --- a/src/main/groovy/naedward/gradle/coverityplugin/tasks/EmitTask.groovy +++ b/src/main/groovy/naedward/gradle/coverityplugin/tasks/EmitTask.groovy @@ -27,10 +27,10 @@ class EmitTask extends DefaultTask { coverityClasspath.plus(diff) } - Set coveritySrc = project.sourceSets.main.java.srcDirs + Set coveritySrc = project.sourceSets.main.allJava.srcDirs if (project.coverity.includeTestSource) { - coveritySrc.addAll(project.sourceSets.test.java.srcDirs) + coveritySrc.addAll(project.sourceSets.test.allJava.srcDirs) } String pathSep = File.pathSeparator @@ -40,6 +40,7 @@ class EmitTask extends DefaultTask { continue } } + if (!dir.exists()) continue sourcePaths.append(dir.getCanonicalPath()); sourcePaths.append(pathSep); }