Merge branch 'improvement/JAL-3394_added_categories_to_unix_shell_installer_desktop_f...
authorBen Soares <bsoares@dundee.ac.uk>
Thu, 2 Apr 2020 11:42:30 +0000 (12:42 +0100)
committerBen Soares <bsoares@dundee.ac.uk>
Thu, 2 Apr 2020 11:42:30 +0000 (12:42 +0100)
1  2 
build.gradle
gradle.properties

diff --combined build.gradle
@@@ -7,18 -7,12 +7,18 @@@ import groovy.transform.ExternalizeMeth
  import groovy.util.XmlParser
  import groovy.xml.XmlUtil
  
 +
  buildscript {
 +  repositories {
 +    mavenCentral()
 +    mavenLocal()
 +  }
    dependencies {
      classpath 'org.openclover:clover:4.4.1'
    }
  }
  
 +
  plugins {
    id 'java'
    id 'application'
@@@ -32,6 -26,12 +32,6 @@@ repositories 
    jcenter()
    mavenCentral()
    mavenLocal()
 -  flatDir {
 -    dirs gradlePluginsDir
 -  }
 -}
 -
 -dependencies {
  }
  
  
@@@ -46,21 -46,11 +46,21 @@@ ext 
    jalviewDirRelativePath = jalviewDir
  
    // local build environment properties
 -  def localProps = "${jalviewDirAbsolutePath}/local.properties"
 +  // can be "projectDir/local.properties"
 +  def localProps = "${projectDir}/local.properties"
 +  def propsFile = null;
    if (file(localProps).exists()) {
 +    propsFile = localProps
 +  }
 +  // or "../projectDir_local.properties"
 +  def dirLocalProps = projectDir.getParent() + "/" + projectDir.getName() + "_local.properties"
 +  if (file(dirLocalProps).exists()) {
 +    propsFile = dirLocalProps
 +  }
 +  if (propsFile != null) {
      try {
        def p = new Properties()
 -      def localPropsFIS = new FileInputStream(localProps)
 +      def localPropsFIS = new FileInputStream(propsFile)
        p.load(localPropsFIS)
        localPropsFIS.close()
        p.each {
@@@ -68,9 -58,9 +68,9 @@@
            def oldval = findProperty(key)
            setProperty(key, val)
            if (oldval != null) {
 -            println("Overriding property '${key}' ('${oldval}') with local.properties value '${val}'")
 +            println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'")
            } else {
 -            println("Setting unknown property '${key}' with local.properties value '${val}'")
 +            println("Setting unknown property '${key}' with ${file(propsFile).getName()}s value '${val}'")
            }
        }
      } catch (Exception e) {
  
    // clover
    cloverInstrDir = file("${buildDir}/${cloverSourcesInstrDir}")
 +  cloverDb = string("${buildDir}/clover/clover.db")
    classesDir = string("${jalviewDir}/${classes_dir}")
    if (clover.equals("true")) {
      use_clover = true
      getdownChannelName = string("${bamboo_planKey}/${JAVA_VERSION}")
      getdownAppBase = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}")
      jvlChannelName += "_${getdownChannelName}"
 +    // automatically add the test group Not-bamboo for exclusion 
 +    if ("".equals(testngExcludedGroups)) { 
 +      testngExcludedGroups = "Not-bamboo"
 +    }
      break
  
      case "RELEASE":
@@@ -425,13 -410,12 +425,13 @@@ dependencies 
    }
  }
  
 -
  configurations {
    cloverRuntime
    cloverRuntime.extendsFrom cloverCompile
  }
  
 +
 +// eclipse project and settings files creation, also used by buildship
  eclipse {
    project {
      name = eclipse_project_name
  }
  
  
 -task cloverInstr() {
 +task cloverInstr {
    // only instrument source, we build test classes as normal
    inputs.files files (sourceSets.main.allJava,sourceSets.test.allJava) // , fileTree(dir:"$jalviewDir/$testSourceDir", include: ["**/*.java"]))
    outputs.dir cloverInstrDir
  
    doFirst {
      delete cloverInstrDir
 -    def argsList = ["--initstring", "${buildDir}/clover/clover.db",
 -    "-d", "${buildDir}/${cloverSourcesInstrDir}"]
 -    argsList.addAll(inputs.files.files.collect({ file ->
 -      file.absolutePath
 -    }))
 +    def argsList = [
 +      "--initstring",
 +      cloverDb,
 +      "-d",
 +      cloverInstrDir.getPath(),
 +    ]
 +    argsList.addAll(
 +      inputs.files.files.collect(
 +        { file -> file.absolutePath }
 +      )
 +    )
      String[] args = argsList.toArray()
      println("About to instrument "+args.length +" files")
      com.atlassian.clover.CloverInstr.mainImpl(args)
  }
  
  
 -task cloverReportHTML (type: JavaExec) {
 -    inputs.dir "${buildDir}/clover"
 -    outputs.dir "${reportsDir}/clover"
 +cloverClasses.dependsOn cloverInstr
  
 -    classpath configurations.cloverRuntime
 -    maxHeapSize "${cloverReportJVMHeap}"
 -    jvmArgs += "${cloverReportJVMArgs}"
 -    main = "com.atlassian.clover.reporters.html.HtmlReporter"
 -    args  "--initstring", "${buildDir}/clover/clover.db", "-o", "${reportsDir}/clover"
 -    "${cloverReportHTMLOptions}".split(",").each {
 -      args+= it.trim()
 -      }
 -}
  
 -task cloverReportXML (type: JavaExec) {
 -    inputs.dir "${buildDir}/clover"
 -    outputs.dir "${reportsDir}/clover"
 -    maxHeapSize "${cloverReportJVMHeap}"
 -    jvmArgs "${cloverReportJVMArgs}"
 -    classpath configurations.cloverRuntime
 -    main = "com.atlassian.clover.reporters.xml.XMLReporter"
 -    args  "--initstring", "${buildDir}/clover/clover.db", "-o", "${reportsDir}/clover/clover.xml"
 -    
 -    "${cloverReportXMLOptions}".split(",").each {
 -      args+= it.trim()
 -      }
 -}
  task cloverReport {
    group = "Verification"
 -    description = "Creates the Clover report"
 -    inputs.dir "${buildDir}/clover"
 -    outputs.dir "${reportsDir}/clover"
 -    onlyIf {
 -      file("${buildDir}/clover/clover.db").exists()
 -    }
 -    dependsOn cloverReportXML
 -    dependsOn cloverReportHTML
 +  description = "Creates the Clover report"
 +  inputs.dir "${buildDir}/clover"
 +  outputs.dir "${reportsDir}/clover"
 +  onlyIf {
 +    file(cloverDb).exists()
 +  }
 +  doFirst {
 +    def argsList = [
 +      "--initstring",
 +      cloverDb,
 +      "-o",
 +      "${reportsDir}/clover"
 +    ]
 +    String[] args = argsList.toArray()
 +    com.atlassian.clover.reporters.html.HtmlReporter.runReport(args)
 +
 +    // and generate ${reportsDir}/clover/clover.xml
 +    args = [
 +      "--initstring",
 +      cloverDb,
 +      "-o",
 +      "${reportsDir}/clover/clover.xml"
 +    ].toArray()
 +    com.atlassian.clover.reporters.xml.XMLReporter.runReport(args)
 +  }
 +}
 +
 +
 +compileCloverJava {
 +
 +  doFirst {
 +    sourceCompatibility = compile_source_compatibility
 +    targetCompatibility = compile_target_compatibility
 +    options.compilerArgs += additional_compiler_args
 +    print ("Setting target compatibility to "+targetCompatibility+"\n")
 +  }
 +  classpath += configurations.cloverRuntime
 +}
 +
 +
 +task cleanClover {
 +  doFirst {
 +    delete cloverInstrDir
 +    delete cloverDb
 +  }
  }
  // end clover bits
  
@@@ -673,6 -638,18 +673,6 @@@ compileTestJava 
  }
  
  
 -compileCloverJava {
 -
 -  doFirst {
 -    sourceCompatibility = compile_source_compatibility
 -    targetCompatibility = compile_target_compatibility
 -    options.compilerArgs += additional_compiler_args
 -    print ("Setting target compatibility to "+targetCompatibility+"\n")
 -  }
 -  classpath += configurations.cloverRuntime
 -}
 -
 -
  clean {
    doFirst {
      delete sourceSets.main.java.outputDir
  
  
  cleanTest {
 +  dependsOn cleanClover
    doFirst {
      delete sourceSets.test.java.outputDir
 -    delete cloverInstrDir
    }
  }
  
@@@ -859,13 -836,10 +859,13 @@@ test 
  
    useTestNG() {
      includeGroups testngGroups
 +    excludeGroups testngExcludedGroups
      preserveOrder true
      useDefaultListeners=true
    }
  
 +  maxHeapSize = "1024m"
 +
    workingDir = jalviewDir
    //systemProperties 'clover.jar' System.properties.clover.jar
    sourceCompatibility = compile_source_compatibility
@@@ -1389,6 -1363,7 +1389,7 @@@ task installers(type: com.install4j.gra
      'GETDOWN_INSTALL_DIR': getdown_install_dir,
      'INFO_PLIST_FILE_ASSOCIATIONS_FILE': install4j_info_plist_file_associations,
      'BUILD_DIR': install4jBuildDir,
+     'UNIX_DESKTOP_ADDITIONS': install4j_unix_desktop_additions,
    ]
  
    destination = "${jalviewDir}/${install4jBuildDir}"
diff --combined gradle.properties
@@@ -1,5 -1,3 +1,5 @@@
 +org.gradle.jvmargs=-Xmx1536m -Xms512m
 +
  jalviewDir = .
  
  #JAVA_VERSION = 1.8
@@@ -24,7 -22,6 +24,7 @@@ jalview_keyalg = SHA1withRS
  jalview_keydig = SHA1
  
  testngGroups = Functional
 +testngExcludedGroups = 
  
  j8libDir = j8lib
  j11libDir = j11lib
@@@ -122,9 -119,10 +122,10 @@@ install4j_info_plist_file_associations 
  install4j_installer_file_associations = file_associations_auto-install4j8.xml
  #install4j_DMG_uninstaller_app_files = uninstall_old_jalview_files.xml
  install4j_build_dir = build/install4j
- install4j_media_types = windows,macosArchive,linuxRPM,linuxDeb,unixArchive,unixInstaller
+ install4j_media_types = windows,macosArchive,unixArchive,unixInstaller
  install4j_faster = false
  install4j_installer_name = Jalview Installer
+ install4j_unix_desktop_additions = Categories=Science;Biology;Java;
  
  OSX_KEYSTORE =
  OSX_KEYPASS =
@@@ -147,7 -145,7 +148,7 @@@ bamboo_channelbase = https://builds.jal
  bamboo_planKey = 
  bamboo_getdown_channel_suffix = /latest/artifact/shared/getdown-channel
  
 -eclipse_extra_jdt_prefs_file = .settings/org.eclipse.jdt.core.jalview.prefs
 +eclipse_extra_jdt_prefs_file = utils/eclipse/org.eclipse.jdt.core.jalview.prefs
  eclipse_project_name = jalview
  eclipse_bin_dir = bin
  eclipse_debug = false