Author: jleroux
Date: Mon Sep 19 06:26:34 2016
New Revision: 1761385

URL: http://svn.apache.org/viewvc?rev=1761385&view=rev
Log:
Fixes: SvnInfo.ftl and GitInfo.ftl are not generated by default
(OFBIZ-8250)

The two files are not generated as empty files when building which results in 
an FTL stacktrace in the footer of the backend applications.
This had been somehow reported at OFBIZ-7942 which I closed not understanding 
completely the problem

Thanks: Michael, Taher for fixing this issue and Wai for reporting OFBIZ-7942

Modified:
    ofbiz/trunk/build.gradle

Modified: ofbiz/trunk/build.gradle
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/build.gradle?rev=1761385&r1=1761384&r2=1761385&view=diff
==============================================================================
--- ofbiz/trunk/build.gradle (original)
+++ ofbiz/trunk/build.gradle Mon Sep 19 06:26:34 2016
@@ -47,6 +47,13 @@ tasks.withType(JavaCompile) {
     }
 }
 
+// defines the footer files for svn and git info
+def File gitFooterFile = file("${rootDir}/runtime/GitInfo.ftl")
+def File svnFooterFile = file("${rootDir}/runtime/SvnInfo.ftl")
+
+// init footer files
+initFooterFiles(gitFooterFile, svnFooterFile)
+
 // root and subproject settings
 defaultTasks 'build'
 
@@ -750,6 +757,14 @@ task cleanXtra(group: cleanupGroup, desc
 task cleanGradle(group: cleanupGroup, description: 'clean generated files from 
Gradle') << {
     delete file("${rootDir}/.gradle")
 }
+task cleanFooterFiles(group: cleanupGroup, description: 'clean generated 
footer files') << {
+    if(gitFooterFile.exists()) {
+        gitFooterFile.delete()
+    }
+    if(svnFooterFile.exists()) {
+        svnFooterFile.delete()
+    }
+}
 task cleanAnt(group: cleanupGroup, type: Delete, description: "clean old 
artifacts generated by Ant") << {
     /* TODO this task is temporary and should be deleted after some
      * time when users have updated their trees. */
@@ -792,7 +807,6 @@ task gitInfoFooter(group: committerGroup
     def branch
     def revision
     def timestamp = new Date().format 'yyyy-MM-dd HH:mm:ss'
-    File gitFooterFile = new File("${rootDir}/runtime/GitInfo.ftl")
     def gitFolder = new File('.git')
     
     if(!gitFolder.exists()) {
@@ -822,7 +836,6 @@ task gitInfoFooter(group: committerGroup
 
 task svnInfoFooter(group: committerGroup, description: 'Update the Subversion 
revision info in the footer if Subversion is used') << {
     def timestamp = new Date().format 'yyyy-MM-dd HH:mm:ss'
-    File svnFooterFile = new File("${rootDir}/runtime/SvnInfo.ftl")
     def svnOutput = new ByteArrayOutputStream()
     def svnFolder = new File('.svn')
     
@@ -1055,4 +1068,14 @@ def activateAndInstallPlugin(pluginId) {
     activatePlugin pluginId
     def gradleRunner = os.contains('windows') ? 'gradlew.bat' : './gradlew'
     exec { commandLine gradleRunner, 'installPlugin', "-PpluginId=${pluginId}" 
}
+}
+
+def initFooterFiles(gitInfoFile, svnInfoFile) {
+    
+    if(!gitInfoFile.exists()) {
+        gitInfoFile.createNewFile()
+    }
+    if(!svnInfoFile.exists()) {
+        svnInfoFile.createNewFile()
+    }
 }
\ No newline at end of file


Reply via email to