JAL-3394 JAL-3420 Temporary measure limits unix file extension to be the shortest...
[jalview.git] / build.gradle
index 0f0b8ff..8d84b25 100644 (file)
@@ -61,6 +61,9 @@ ext {
 
     case "BUILD":
     // TODO: get bamboo build artifact URL for getdown artifacts
+    getdown_channel_base = bamboo_channelbase
+    getdown_channel_name = bamboo_planKey + '/'+JAVA_VERSION
+    getdown_app_base = bamboo_channelbase + '/'+ bamboo_planKey + bamboo_getdown_channel_suffix + '/'+JAVA_VERSION
     getdown_app_dir = getdown_app_dir_alt
     buildProperties = jalviewDir + "/" + classesDir +"/" + buildPropertiesFile
     break
@@ -638,7 +641,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'
@@ -1054,15 +1057,16 @@ clean {
 install4j {
   def install4jHomeDir = "/opt/install4j"
   def hostname = "hostname".execute().text.trim()
+  def install4jName = (install4jVersion >= 8) ? "install4j"+install4jVersion:"install4j"
   if (hostname.equals("jv-bamboo")) {
-    install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
+    install4jHomeDir = System.getProperty("user.home")+"/buildtools/"+install4jName
   } else if (OperatingSystem.current().isMacOsX()) {
-    install4jHomeDir = '/Applications/install4j.app/Contents/Resources/app'
+    install4jHomeDir = '/Applications/'+install4jName+'.app/Contents/Resources/app'
     if (! file(install4jHomeDir).exists()) {
       install4jHomeDir = System.getProperty("user.home")+install4jHomeDir
     }
   } else if (OperatingSystem.current().isLinux()) {
-    install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
+    install4jHomeDir = System.getProperty("user.home")+"/buildtools/"+install4jName
   }
   installDir = file(install4jHomeDir)
   mediaTypes = Arrays.asList(install4jMediaTypes.split(","))
@@ -1085,9 +1089,10 @@ task copyInstall4jTemplate(type: Copy) {
   macosJavaVMTgz = System.env.HOME+"/buildtools/jre/openjdk-java_vm/install4j/tgz/macos-jre"+JAVA_VERSION+".tar.gz"
   windowsJavaVMDir = System.env.HOME+"/buildtools/jre/openjdk-java_vm/getdown/windows-jre"+JAVA_VERSION+"/jre"
   windowsJavaVMTgz = System.env.HOME+"/buildtools/jre/openjdk-java_vm/install4j/tgz/windows-jre"+JAVA_VERSION+".tar.gz"
+  def i4jTemplate = (install4jVersion >= 8)?install4j8Template:install4jTemplate
   from (install4jDir) {
-    include install4jTemplate
-    rename (install4jTemplate, install4jConfFile)
+    include i4jTemplate
+    rename (i4jTemplate, install4jConfFile)
     filter(ReplaceTokens, beginToken: '', endToken: '', tokens: ['9999999999': JAVA_VERSION])
     filter(ReplaceTokens, beginToken: '$$', endToken: '$$',
     tokens: [
@@ -1113,11 +1118,20 @@ task copyInstall4jTemplate(type: Copy) {
     }
   }
   into install4jDir
+
+  inputs.files(i4jTemplate)
+  if (install4jVersion >= 8) {
+    inputs.files(install4jDir+"/"+install4j8InstallerFileAssociations)
+  } else {
+    inputs.files(install4jDir+"/"+install4jInstallerFileAssociations)
+    inputs.files(install4jDir+"/"+install4jInfoPlistFileAssociations)
+  }
   outputs.files(install4jConf)
 
   doLast {
     // include file associations in installer
-    def installerFileAssociationsXml = file("$install4jDir/$install4jInstallerFileAssociations").text
+    def i4jIFA = (install4jVersion >= 8)?install4j8InstallerFileAssociations:install4jInstallerFileAssociations
+    def installerFileAssociationsXml = file("$install4jDir/$i4jIFA").text
     ant.replaceregexp(
       byline: false,
       flags: "s",
@@ -1180,57 +1194,61 @@ 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/**/*")
-  //include ("jalview-jalopy.xml")
-  //include ("JalviewApplet.jpx")
-  //include ("JalviewX.jpx")
-  //include ("nbbuild.xml")
-  //include ("nbproject/genfiles.properties")
-  //include ("nbproject/project.properties")
-  //include ("nbproject/project.xml")
-  
+
+  def EXCLUDE_FILES=["build/*","bin/*","test-output/","test-reports","tests","clover*/*"
+  ,".*"
+  ,"benchmarking/*"
+  ,"**/.*"
+  ,"*.class"
+  ,"**/*.class","$j11modDir/**/*.jar","appletlib","**/*locales"
+  ,"*locales/**",
+  ,"utils/InstallAnywhere"] 
+  def PROCESS_FILES=[   "AUTHORS",
+  "CITATION",
+  "FEATURETODO",
+  "JAVA-11-README",
+  "FEATURETODO",
+  "LICENSE",
+  "**/README",
+  "RELEASE",
+  "THIRDPARTYLIBS","TESTNG",
+  "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)
   exclude ("appletlib")
   exclude ("**/*locales")
   exclude ("*locales/**")
   exclude ("utils/InstallAnywhere")
-  exclude (libDir)
-  exclude (getdown_files_dir)
+
+    exclude (getdown_files_dir)
   exclude (getdown_website_dir)
 
   // exluding these as not using jars as modules yet
   exclude ("$j11modDir/**/*.jar")
-
+}
+//  from (jalviewDir) {
+//    // explicit includes for stuff that seemed to not get included
+//    include(fileTree("test/**/*."))
+//    exclude(EXCLUDE_FILES)
+//    exclude(PROCESS_FILES)
+//  }
 }
 
 task helppages  {
@@ -1238,5 +1256,5 @@ task helppages  {
   dependsOn pubhtmlhelp
   
   inputs.dir("$classes/$helpDir")
-  outputs.file("build/distribution/help/helpTOC.html")
+  outputs.dir("$helpOutputDir")
 }