changeset 25:278d28eea819 version-0.4.3

USASR-2436: Create branch. Remove usages of leftShift in favor of doLast
author Christopher Springer <springer@nwoca.org>
date Wed, 21 Dec 2016 13:13:23 +0000
parents cfbdbeba877f
children 428c92e0ae10
files src/main/groovy/org/ssdt_ohio/gradle/plugins/VersionClassPlugin.groovy
diffstat 1 files changed, 44 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/groovy/org/ssdt_ohio/gradle/plugins/VersionClassPlugin.groovy	Thu Aug 04 03:29:38 2016 +0100
+++ b/src/main/groovy/org/ssdt_ohio/gradle/plugins/VersionClassPlugin.groovy	Wed Dec 21 13:13:23 2016 +0000
@@ -12,58 +12,59 @@
         def genSrc = 'generated-src/version'
         def generatedSrcDir = new File(project.buildDir, genSrc)
 
-        def makeVersionClassTask = project.task('makeVersionClass') << {
-
-            def now = new Date().format('yyyy-MM-dd hh:mm:ss')
+        def makeVersionClassTask = project.task('makeVersionClass') {
+			doLast {
+				def now = new Date().format('yyyy-MM-dd hh:mm:ss')
 
-            def buildNumber = -1
-            if (project.rootProject?.file('build-number.txt').exists()) {
-                def props = new Properties()
-                project.rootProject?.file('build-number.txt').withInputStream {stream ->
-                    props.load(stream)
-                }
-                buildNumber = props['build.number']
-            }
+				def buildNumber = -1
+				if (project.rootProject?.file('build-number.txt').exists()) {
+					def props = new Properties()
+					project.rootProject?.file('build-number.txt').withInputStream {stream ->
+						props.load(stream)
+					}
+					buildNumber = props['build.number']
+				}
 
-            def targetPackage = getTargetClass(project)
+				def targetPackage = getTargetClass(project)
 
-            if (!targetPackage) {
-                return
-            }
+				if (!targetPackage) {
+					return
+				}
 
-            def outFile = new File(generatedSrcDir, "groovy/" + targetPackage.replaceAll('\\.', "/") + "/ProjectVersion.groovy")
+				def outFile = new File(generatedSrcDir, "groovy/" + targetPackage.replaceAll('\\.', "/") + "/ProjectVersion.groovy")
 
-            outFile.getParentFile().mkdirs()
-            logger.info("creating $targetPackage in $outFile")
-            def f = new FileWriter(outFile)
-            f.write("""
-package $targetPackage
-/**
- * Generated by gradle build. $now ($buildNumber)
- * @version ${project.version}
- */
-public class ProjectVersion {
+				outFile.getParentFile().mkdirs()
+				logger.info("creating $targetPackage in $outFile")
+				def f = new FileWriter(outFile)
+				f.write("""
+					package $targetPackage
+					/**
+					 * Generated by gradle build. $now ($buildNumber)
+					 * @version ${project.version}
+					 */
+					public class ProjectVersion {
 
-    final String name = "${project.name}"
-    final String group = "${project.group}"
-    final String version = "${project.version}"
-    final String buildDate = "$now"
-    final int buildNumber = $buildNumber
+						final String name = "${project.name}"
+						final String group = "${project.group}"
+						final String version = "${project.version}"
+						final String buildDate = "$now"
+						final int buildNumber = $buildNumber
 
-    String getFullVersion() {
-        "\$version \$buildDate (#\$buildNumber)"
-    }
+						String getFullVersion() {
+							"\$version \$buildDate (#\$buildNumber)"
+						}
 
-    String getId() {
-        "\$group:\$name:\$version"
-    }
+						String getId() {
+							"\$group:\$name:\$version"
+						}
 
-    String toString() {
-        "\$id \$buildDate (#\$buildNumber)"
-    }
-}
-""")
-            f.close()
+						String toString() {
+							"\$id \$buildDate (#\$buildNumber)"
+						}
+					}
+					""")
+				f.close()
+			}
         }
 
         project.sourceSets {