JAL-3337 rejig the source distribution generation to process and replace tokens in...
[jalview.git] / build.gradle
index 76284e9..c24c020 100644 (file)
@@ -56,6 +56,7 @@ ext {
   reportRsyncCmd = false
   buildDist = true
   buildProperties = buildPropertiesFile
+  getdownLauncher = jalviewDir + '/' + getdown_lib_dir + '/' + getdown_launcher
   switch (CHANNEL) {
 
     case "BUILD":
@@ -103,6 +104,7 @@ ext {
       buildDist = false
     }
     reportRsyncCommand = true
+    getdownLauncher = jalviewDir + '/' + getdown_lib_dir + '/' + getdown_launcher_local
     break
 
     case "DEVELOP":
@@ -136,6 +138,7 @@ ext {
     getdown_app_base = file(getdownWebsiteDir).toURI().toString()
     getdown_app_dir = getdown_app_dir_alt
     buildProperties = jalviewDir + "/" + classesDir +"/" + buildPropertiesFile
+    getdownLauncher = jalviewDir + '/' + getdown_lib_dir + '/' + getdown_launcher_local
     break
 
     default: // something wrong specified
@@ -150,7 +153,6 @@ ext {
   //getdownJ11libDir = getdownWebsiteDir + '/' + getdown_j11lib_dir
   getdownResourceDir = getdownWebsiteDir + '/' + getdown_resource_dir
   getdownInstallDir = getdownWebsiteDir + '/' + getdown_install_dir
-  getdownLauncher = jalviewDir + '/' + getdown_launcher
   getdownFilesDir = jalviewDir + '/' + getdown_files_dir + '/' + JAVA_VERSION + '/'
   getdownFilesInstallDir = getdownFilesDir+"/"+getdown_install_dir
   /* compile without modules -- using classpath libraries
@@ -636,7 +638,7 @@ task copyHelp(type: Copy) {
     exclude '**/*.gif'
       exclude '**/*.jpg'
       exclude '**/*.png'
-      filter(ReplaceTokens, beginToken: '$$', endToken: '$$', tokens: ['Version-Rel': JALVIEW_VERSION])
+      filter(ReplaceTokens, beginToken: '$$', endToken: '$$', tokens: ['Version-Rel': JALVIEW_VERSION,'Year-Rel': getDate("yyyy")])
   }
   from(inputDir) {
     include '**/*.gif'
@@ -962,6 +964,9 @@ task getdownWebsite() {
 
     copy {
       from getdownLauncher
+      if (file(getdownLauncher).getName() != getdown_launcher) {
+        rename(file(getdownLauncher).getName(), getdown_launcher)
+      }
       into project.ext.getdownWebsiteDir
     }
 
@@ -970,6 +975,9 @@ task getdownWebsite() {
         from getdown_txt
         from getdownLauncher
         from getdownWebsiteDir+"/"+getdown_build_properties
+        if (file(getdownLauncher).getName() != getdown_launcher) {
+          rename(file(getdownLauncher).getName(), getdown_launcher)
+        }
         into getdownInstallDir
       }
 
@@ -984,6 +992,9 @@ task getdownWebsite() {
       from launch_jvl
       from getdownLauncher
       from getdownWebsiteDir+"/"+getdown_build_properties
+      if (file(getdownLauncher).getName() != getdown_launcher) {
+        rename(file(getdownLauncher).getName(), getdown_launcher)
+      }
       into getdownFilesDir
     }
 
@@ -1004,7 +1015,9 @@ task getdownDigest(type: JavaExec) {
   group = "distribution"
   description = "Digest the getdown website folder"
   dependsOn getdownWebsite
-  classpath = files(jalviewDir + '/' + getdown_core, jalviewDir+'/'+getdown_launcher)
+  doFirst {
+    classpath = files(getdownWebsiteDir + '/' + getdown_launcher)
+  }
   main = "com.threerings.getdown.tools.Digester"
   args project.ext.getdownWebsiteDir
   inputs.dir(project.ext.getdownWebsiteDir)
@@ -1161,38 +1174,55 @@ task sourceDist (type: Tar) {
   
   compression Compression.GZIP
   
-  from jalviewDir
   into project.name
-   
-  exclude (".*")
-  exclude ("**/.*")
-  exclude ("*.class")
-  exclude ("**/*.class")
-  include (eclipse_extra_jdt_prefs_file)
-  include ("AUTHORS")
-  include ("CITATION")
-  include ("FEATURETODO")
-  include ("JAVA-11-README")
-  include ("FEATURETODO")
-  include ("LICENSE")
-  include ("README")
-  include ("RELEASE")
-  include ("THIRDPARTYLIBS")
-  include ("build.gradle")
-  include ("gradle.properties")
-  include ("$sourceDir/*.java")
-  include ("$sourceDir/**/*.java")
-  include ("$sourceDir/**/*.cdr")
-  include ("$j8libDir/**/*.jar")
-  include ("$j11libDir/**/*.jar")
-  include ("$resourceDir/**/*")
-  include ("$helpDir/**/*")
-  include ("$schemaDir/**/*")
-  include ("$utilsDir/**/*")
-  include ("$docDir/**/*")
-  include ("$examplesDir/**/*")
-  include ("getdown/**/*")
+
+  def EXCLUDE_FILES=["bin/*","test-*","clover*/*"
+  ,".*"
+  ,"**/.*"
+  ,"*.class"
+  ,"**/*.class","$j11modDir/**/*.jar","appletlib","**/*locales"
+  ,"*locales/**",
+  ,"utils/InstallAnywhere"] 
+  def PROCESS_FILES=[   "AUTHORS",
+  "CITATION",
+  "FEATURETODO",
+  "JAVA-11-README",
+  "FEATURETODO",
+  "LICENSE",
+  "README",
+  "RELEASE",
+  "THIRDPARTYLIBS",
+  "build.gradle",
+  "gradle.properties",
+  "**/*.java",
+  "**/*.html",
+  "**/*.xml",
+  "**/*.gradle",
+  "**/*.groovy",
+  "**/*.properties",
+  "**/*.perl",
+  "**/*.sh"]
+
+  from(jalviewDir) {
+    exclude (EXCLUDE_FILES)
+    include (PROCESS_FILES)
+    filter(ReplaceTokens, beginToken: '$$', endToken: '$$', tokens: ['Version-Rel': JALVIEW_VERSION,'Year-Rel': getDate("yyyy")])
+  }
+  from(jalviewDir) {
+    exclude (EXCLUDE_FILES)
+    exclude (PROCESS_FILES)
+    include (eclipse_extra_jdt_prefs_file)
+    include ("$schemaDir/**/*")
+    include ("$utilsDir/**/*")
+    include ("$docDir/**/*")
+    include ("$examplesDir/**/*")
+    include ("getdown/**/*")
+  
+    include ("$sourceDir/**/*.cdr")
+    include ("$j8libDir/**/*.jar")
+    include ("$j11libDir/**/*.jar")
+    include ("$resourceDir/**/*")
+  
   //include ("jalview-jalopy.xml")
   //include ("JalviewApplet.jpx")
   //include ("JalviewX.jpx")
@@ -1201,16 +1231,20 @@ task sourceDist (type: Tar) {
   //include ("nbproject/project.properties")
   //include ("nbproject/project.xml")
   
+  include ("$helpDir/**/*")
+  exclude ("$helpDir/**/*.html")
+
   exclude ("appletlib")
   exclude ("**/*locales")
   exclude ("*locales/**")
   exclude ("utils/InstallAnywhere")
+  exclude (libDir)
   exclude (getdown_files_dir)
   exclude (getdown_website_dir)
 
   // exluding these as not using jars as modules yet
   exclude ("$j11modDir/**/*.jar")
-
+}
 }
 
 task helppages  {
@@ -1218,5 +1252,5 @@ task helppages  {
   dependsOn pubhtmlhelp
   
   inputs.dir("$classes/$helpDir")
-  outputs.file("build/distribution/help/helpTOC.html")
+  outputs.dir("$helpOutputDir")
 }