X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=b47e4206687e16fc04a85b7e7fafbd72e6ede4a7;hb=5ca1ffcaa6fc78d2c3972f224b4a3ce0701dde7e;hp=ec4e3b1b1b1d7587c09339fe7fde7c3d18654e25;hpb=12bd110f5aa83819e8417eb6dac136cbc6dc2de5;p=jalview.git diff --git a/build.gradle b/build.gradle index ec4e3b1..b47e420 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { @@ -58,9 +68,9 @@ ext { 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) { @@ -126,8 +136,14 @@ ext { getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}") getdownAppDistDir = getdown_app_dir_alt buildProperties = string("${classesDir}/${build_properties_file}") - reportRsyncCmd = false + reportRsyncCommand = false jvlChannelName = CHANNEL.toLowerCase() + install4jSuffix = CHANNEL.substring(0, 1).toUpperCase() + CHANNEL.substring(1).toLowerCase(); // BUILD -> Build + install4jDSStore = "DS_Store-NON-RELEASE" + install4jDMGBackgroundImage = "jalview_dmg_background-NON-RELEASE.png" + install4jInstallerName = "${jalview_name} Installer" + install4jExecutableName = jalview_name.replaceAll("[^\\w]+", "_").toLowerCase() + install4jExtraScheme = "jalviewx" switch (CHANNEL) { case "BUILD": @@ -136,11 +152,18 @@ ext { 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": getdownAppDistDir = getdown_app_dir_release reportRsyncCommand = true + install4jSuffix = "" + install4jDSStore = "DS_Store" + install4jDMGBackgroundImage = "jalview_dmg_background.png" break case "ARCHIVE": @@ -170,6 +193,7 @@ ext { } reportRsyncCommand = true getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}") + install4jSuffix = "Archive" break case "DEVELOP": @@ -178,6 +202,9 @@ ext { case "TEST-RELEASE": reportRsyncCommand = true + install4jSuffix = "Test" + JALVIEW_VERSION = "TEST" + install4jExtraScheme = "jalviewt" break case ~/^SCRATCH(|-[-\w]*)$/: @@ -185,6 +212,7 @@ ext { getdownDir = string("${getdownChannelName}/${JAVA_VERSION}") getdownAppBase = string("${getdown_channel_base}/${getdownDir}") reportRsyncCommand = true + install4jSuffix = "Scratch" break case "TEST-LOCAL": @@ -194,6 +222,9 @@ ext { getdownAppBase = file(file("${LOCALDIR}").getAbsolutePath()).toURI().toString() getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}") } + install4jSuffix = "Test-Local" + JALVIEW_VERSION = "TEST" + install4jExtraScheme = "jalviewt" break case "LOCAL": @@ -212,7 +243,23 @@ ext { println("Overriding getdown appbase with '${getdownAppBase}'") } // sanitise file name for jalview launcher file for this channel - jvlChannelName = jvlChannelName.replaceAll(/[^\w\-]/,"_") + jvlChannelName = jvlChannelName.replaceAll("[^\\w\\-]+", "_") + // install4j application and folder names + if (install4jSuffix == "") { + install4jApplicationName = "${jalview_name}" + } else { + install4jApplicationName = "${jalview_name} ${install4jSuffix}" + install4jInstallerName = "${jalview_name} Non-Release Installer" + } + // sanitise folder names + install4jApplicationFolder = install4jApplicationName + .replaceAll("[\"'~:\\\\]+", "_") // replace all awkward filename chars + install4jUnixApplicationFolder = install4jApplicationFolder + .toLowerCase() + .replaceAll(" ","_") + .replaceAll("[^\\w\\-\\.]+", "_") // replace other non [alphanumeric,_,-,.] + .replaceAll("_+", "_") + .replaceAll("_*-_*", "-") getdownAppDir = string("${getdownWebsiteDir}/${getdownAppDistDir}") //getdownJ11libDir = "${getdownWebsiteDir}/${getdown_j11lib_dir}" @@ -405,8 +452,8 @@ sourceSets { // clover bits dependencies { - cloverCompile 'org.openclover:clover:4.4.1' if (use_clover) { + cloverCompile 'org.openclover:clover:4.4.1' testCompile 'org.openclover:clover:4.4.1' } } @@ -558,7 +605,7 @@ task cloverInstr { outputs.dir cloverInstrDir doFirst { - //delete cloverInstrDir + delete cloverInstrDir def argsList = [ "--initstring", cloverDb, @@ -608,6 +655,26 @@ task cloverReport { 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 @@ -639,18 +706,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 @@ -658,14 +713,6 @@ clean { } -cleanClover { - doFirst { - delete cloverInstrDir - delete cloverDb - } -} - - cleanTest { dependsOn cleanClover doFirst { @@ -845,10 +892,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 @@ -1028,7 +1078,7 @@ task getdownWebsite() { } getdownWebsiteResourceFilenames += "${getdownAppDistDir}/${getdown_build_properties}" - // go through properties looking for getdown_txt_... + // set some getdown_txt_ properties then go through all properties looking for getdown_txt_... def props = project.properties.sort { it.key } if (getdownAltJavaMinVersion != null && getdownAltJavaMinVersion.length() > 0) { props.put("getdown_txt_java_min_version", getdownAltJavaMinVersion) @@ -1040,7 +1090,11 @@ task getdownWebsite() { props.put("getdown_txt_multi_java_location", getdownAltMultiJavaLocation) } - props.put("getdown_txt_appbase", getdownAppBase) + props.put("getdown_txt_title", jalview_name) + props.put("getdown_txt_ui.name", install4jApplicationName) + + // start with appbase + getdownTextString += "appbase = ${getdownAppBase}\n" props.each{ prop, val -> if (prop.startsWith("getdown_txt_") && val != null) { if (prop.startsWith("getdown_txt_multi_")) { @@ -1129,7 +1183,7 @@ task getdownWebsite() { def getdownLaunchJvl = getdown_launch_jvl_name + ( (jvlChannelName != null && jvlChannelName.length() > 0)?"-${jvlChannelName}":"" ) + ".jvl" def launchJvl = file("${getdownWebsiteDir}/${getdownLaunchJvl}") - launchJvl.write("appbase="+props.get("getdown_txt_appbase")) + launchJvl.write("appbase=${getdownAppBase}") copy { from getdownLauncher @@ -1342,7 +1396,7 @@ task installers(type: com.install4j.gradle.Install4jTask) { def install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}" variables = [ - 'JALVIEW_NAME': getdown_txt_title, + 'JALVIEW_NAME': install4jApplicationName, 'JALVIEW_DIR': "../..", 'OSX_KEYSTORE': OSX_KEYSTORE, 'JSIGN_SH': JSIGN_SH, @@ -1362,7 +1416,9 @@ task installers(type: com.install4j.gradle.Install4jTask) { 'LINUX_JAVA_VM_TGZ': linuxJavaVMTgz, 'COPYRIGHT_MESSAGE': install4j_copyright_message, 'MACOS_BUNDLE_ID': install4j_macOS_bundle_id, - 'INSTALLER_NAME': install4j_installer_name, + 'MACOS_DS_STORE': install4jDSStore, + 'MACOS_DMG_BG_IMAGE': install4jDMGBackgroundImage, + 'INSTALLER_NAME': install4jInstallerName, 'INSTALL4J_UTILS_DIR': install4j_utils_dir, 'GETDOWN_WEBSITE_DIR': getdown_website_dir, 'GETDOWN_FILES_DIR': getdown_files_dir, @@ -1372,6 +1428,11 @@ task installers(type: com.install4j.gradle.Install4jTask) { '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, + 'APPLICATION_FOLDER': install4jApplicationFolder, + 'UNIX_APPLICATION_FOLDER': install4jUnixApplicationFolder, + 'EXECUTABLE_NAME': install4jExecutableName, + 'EXTRA_SCHEME': install4jExtraScheme, ] destination = "${jalviewDir}/${install4jBuildDir}"