changeset 3:1756755e4e71

improve up-to-date check so version does not cause recompile
author smith@nwoca.org
date Fri, 18 May 2012 21:50:36 +0100
parents 4db19f1c5ad0
children 5d8e81067c6a fb82b0a8f05a
files src/main/groovy/org/ssdt_ohio/gradle/plugins/VersionClassPlugin.groovy
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/groovy/org/ssdt_ohio/gradle/plugins/VersionClassPlugin.groovy	Fri May 18 18:21:13 2012 +0100
+++ b/src/main/groovy/org/ssdt_ohio/gradle/plugins/VersionClassPlugin.groovy	Fri May 18 21:50:36 2012 +0100
@@ -26,7 +26,7 @@
 
             def targetPackage = getTargetClass(project)
 
-            def outFile = new File(generatedSrcDir, targetPackage.replaceAll('\\.', "/") + "/ProjectVersion.groovy")
+            def outFile = new File(generatedSrcDir, "groovy/" + targetPackage.replaceAll('\\.', "/") + "/ProjectVersion.groovy")
 
             outFile.getParentFile().mkdirs()
             logger.info("creating $targetPackage in $outFile")
@@ -64,16 +64,19 @@
         project.sourceSets {
             main {
                 groovy {
-                    srcDir project.buildDir.name + '/' + genSrc
+                    srcDir project.buildDir.name + '/' + genSrc + '/groovy'
                 }
             }
         }
 
-        makeVersionClassTask.getInputs().files(project.sourceSets.main.getAllSource())
-        makeVersionClassTask.getOutputs().files(generatedSrcDir)
+        makeVersionClassTask.getInputs().files(project.sourceSets.main.getAllSource().findAll{ !it.name.startsWith('ProjectVersion')}
+        )
+        makeVersionClassTask.getOutputs().file( project.buildDir.name + '/' + genSrc)
+
         if (project.getBuildFile() != null && project.getBuildFile().exists()) {
             makeVersionClassTask.getInputs().files(project.getBuildFile())
         }
+
         project.getTasks().getByName('compileGroovy').dependsOn('makeVersionClass')
 
         project.getTasks().getByName('jar').manifest.attributes(
@@ -86,8 +89,6 @@
                         "Implementation-Vendor": project.group,
                         "Built-By": System.properties['user.name'],
                         "Build-Jdk": System.properties['java.version'],
-                        "Build-Time":  new Date().format('yyyy-MM-dd hh:mm:ss'),
-
                 ]
         )