changeset 9:9f9063d3c17c

cope with subproject without src files
author smith@nwoca.org
date Thu, 25 Oct 2012 14:24:39 +0100
parents 15ddcc73ef78
children 99fda13725c3 d2c962f2b83c
files gradle.properties src/main/groovy/org/ssdt_ohio/gradle/plugins/VersionClassPlugin.groovy
diffstat 2 files changed, 10 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/gradle.properties	Sat May 19 14:15:46 2012 +0100
+++ b/gradle.properties	Thu Oct 25 14:24:39 2012 +0100
@@ -1,2 +1,2 @@
-version=0.3.0.SNAPSHOT
+version=0.2.1
 group=org.ssdt_ohio
--- a/src/main/groovy/org/ssdt_ohio/gradle/plugins/VersionClassPlugin.groovy	Sat May 19 14:15:46 2012 +0100
+++ b/src/main/groovy/org/ssdt_ohio/gradle/plugins/VersionClassPlugin.groovy	Thu Oct 25 14:24:39 2012 +0100
@@ -26,6 +26,10 @@
 
             def targetPackage = getTargetClass(project)
 
+            if (!targetPackage) {
+                return
+            }
+
             def outFile = new File(generatedSrcDir, "groovy/" + targetPackage.replaceAll('\\.', "/") + "/ProjectVersion.groovy")
 
             outFile.getParentFile().mkdirs()
@@ -79,18 +83,6 @@
 
         project.getTasks().getByName('compileGroovy').dependsOn('makeVersionClass')
 
-//        project.getTasks().getByName('jar').manifest.attributes(
-//                [
-//                        "Specification-Title": project.name,
-//                        "Specification-Version": project.version,
-//                        "Specification-Vendor": project.group,
-//                        "Implementation-Title": project.name,
-//                        "Implementation-Version": project.version,
-//                        "Implementation-Vendor": project.group,
-//                        "Built-By": System.properties['user.name'],
-//                        "Build-Jdk": System.properties['java.version'],
-//                ]
-//        )
 
     }
 
@@ -98,7 +90,12 @@
 
     private getTargetClass(project) {
         def source = project.sourceSets.main.groovy.getSrcDirTrees()
+
         def files = project.sourceSets.main.groovy as File[]
+        if (!files ) {
+            return null
+        }
+
         def targetDir = files.first().parentFile.toString()
 
         def targetPackage = targetDir