buildscript {
dependencies {
- classpath 'org.openclover:clover:4.3.1'
+ classpath 'org.openclover:clover:4.4.1'
}
}
id 'eclipse'
id 'com.github.johnrengelman.shadow' version '4.0.3'
id 'com.install4j.gradle' version '8.0.2'
- id 'com.dorongold.task-tree' version '1.4' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree
+ id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree
}
repositories {
}
dependencies {
- compile 'org.apache.commons:commons-compress:1.18'
}
classes = classesDir
getdownWebsiteDir = string("${jalviewDir}/${getdown_website_dir}/${JAVA_VERSION}")
- getdownDir = string("")
- reportRsyncCmd = false
buildDist = true
- buildProperties = build_properties_file
+
+ // the following values might be overridden by the CHANNEL switch
+ getdownChannelName = CHANNEL.toLowerCase()
+ getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
+ getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}")
+ getdownAppDistDir = getdown_app_dir_alt
+ buildProperties = string("${classesDir}/${build_properties_file}")
+ reportRsyncCmd = false
+ jvlChannelName = CHANNEL.toLowerCase()
switch (CHANNEL) {
case "BUILD":
// TODO: get bamboo build artifact URL for getdown artifacts
getdown_channel_base = bamboo_channelbase
- getdown_channel_name = string("${bamboo_planKey}/${JAVA_VERSION}")
- getdown_app_base = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}")
- getdown_app_dir = getdown_app_dir_alt
- buildProperties = string("${classesDir}/${build_properties_file}")
+ getdownChannelName = string("${bamboo_planKey}/${JAVA_VERSION}")
+ getdownAppBase = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}")
+ jvlChannelName += "_${getdownChannelName}"
break
case "RELEASE":
- getdown_channel_name = CHANNEL.toLowerCase()
- getdownDir = string("${getdown_channel_name}/${JAVA_VERSION}")
- getdown_app_base = string("${getdown_channel_base}/${getdownDir}")
- getdown_app_dir = getdown_app_dir_release
- buildProperties = string("${classesDir}/${build_properties_file}")
+ getdownAppDistDir = getdown_app_dir_release
reportRsyncCommand = true
break
case "ARCHIVE":
- getdown_channel_name = CHANNEL.toLowerCase()+"/${JALVIEW_VERSION}"
- getdownDir = string("${getdown_channel_name}/${JAVA_VERSION}")
- getdown_app_base = string("${getdown_channel_base}/${getdownDir}")
- getdown_app_dir = getdown_app_dir_alt
+ getdownChannelName = CHANNEL.toLowerCase()+"/${JALVIEW_VERSION}"
+ getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
+ getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
if (!file("${ARCHIVEDIR}/${packageDir}").exists()) {
- print "Must provide an ARCHIVEDIR value to produce an archive distribution"
- exit
+ throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
} else {
packageDir = string("${ARCHIVEDIR}/${packageDir}")
buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
break
case "ARCHIVELOCAL":
- getdown_channel_name = string("archive/${JALVIEW_VERSION}")
- getdownDir = string("${getdown_channel_name}/${JAVA_VERSION}")
- getdown_app_base = file(getdownWebsiteDir).toURI().toString()
- getdown_app_dir = getdown_app_dir_alt
+ getdownChannelName = string("archive/${JALVIEW_VERSION}")
+ getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
+ getdownAppBase = file(getdownWebsiteDir).toURI().toString()
if (!file("${ARCHIVEDIR}/${packageDir}").exists()) {
- print "Must provide an ARCHIVEDIR value to produce an archive distribution"
- exit
+ throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
} else {
packageDir = string("${ARCHIVEDIR}/${packageDir}")
buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
break
case "DEVELOP":
- getdown_channel_name = CHANNEL.toLowerCase()
- getdownDir = string("${getdown_channel_name}/${JAVA_VERSION}")
- getdown_app_base = string("${getdown_channel_base}/${getdownDir}")
- getdown_app_dir = getdown_app_dir_alt
- buildProperties = string("${classesDir}/${build_properties_file}")
reportRsyncCommand = true
break
case "TEST-RELEASE":
- getdown_channel_name = CHANNEL.toLowerCase()
- getdownDir = string("${getdown_channel_name}/${JAVA_VERSION}")
- getdown_app_base = string("${getdown_channel_base}/${getdownDir}")
- getdown_app_dir = getdown_app_dir_alt
- buildProperties = string("${classesDir}/${build_properties_file}")
reportRsyncCommand = true
break
case ~/^SCRATCH(|-[-\w]*)$/:
- getdown_channel_name = CHANNEL
- getdownDir = string("${getdown_channel_name}/${JAVA_VERSION}")
- getdown_app_base = string("${getdown_channel_base}/${getdownDir}")
- getdown_app_dir = getdown_app_dir_alt
- buildProperties = string("${classesDir}/${build_properties_file}")
+ getdownChannelName = CHANNEL
+ getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
+ getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
reportRsyncCommand = true
break
+ case "TEST-LOCAL":
+ if (!file("${LOCALDIR}").exists()) {
+ throw new GradleException("Must provide a LOCALDIR value to produce a local distribution")
+ } else {
+ getdownAppBase = file(file("${LOCALDIR}").getAbsolutePath()).toURI().toString()
+ getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
+ }
+ break
+
case "LOCAL":
- getdown_app_base = file(getdownWebsiteDir).toURI().toString()
- getdown_app_dir = getdown_app_dir_alt
- buildProperties = string("${classesDir}/${build_properties_file}")
+ getdownAppBase = file(getdownWebsiteDir).toURI().toString()
getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
break
default: // something wrong specified
- println("CHANNEL must be one of BUILD, RELEASE, ARCHIVE, DEVELOP, TEST-RELEASE, SCRATCH-..., LOCAL [default]")
- exit
+ throw new GradleException("CHANNEL must be one of BUILD, RELEASE, ARCHIVE, DEVELOP, TEST-RELEASE, SCRATCH-..., LOCAL [default]")
break
}
- // override getdown_app_base if requested
+ // override getdownAppBase if requested
if (findProperty("getdown_appbase_override") != null) {
- getdown_app_base = string(getProperty("getdown_appbase_override"))
- println("Overriding getdown appbase with '${getdown_app_base}'")
+ getdownAppBase = string(getProperty("getdown_appbase_override"))
+ println("Overriding getdown appbase with '${getdownAppBase}'")
}
+ // sanitise file name for jalview launcher file for this channel
+ jvlChannelName = jvlChannelName.replaceAll(/[^\w\-]/,"_")
- getdownAppDir = string("${getdownWebsiteDir}/${getdown_app_dir}")
+ getdownAppDir = string("${getdownWebsiteDir}/${getdownAppDistDir}")
//getdownJ11libDir = "${getdownWebsiteDir}/${getdown_j11lib_dir}"
getdownResourceDir = string("${getdownWebsiteDir}/${getdown_resource_dir}")
getdownInstallDir = string("${getdownWebsiteDir}/${getdown_install_dir}")
compileClasspath = files( sourceSets.test.java.outputDir )
if (use_clover) {
- compileClasspath += sourceSets.clover.compileClasspath
+ compileClasspath = sourceSets.clover.compileClasspath
} else {
compileClasspath += files(sourceSets.main.java.outputDir)
}
// clover bits
dependencies {
if (use_clover) {
- cloverCompile 'org.openclover:clover:4.3.1'
- testCompile 'org.openclover:clover:4.3.1'
+ cloverCompile 'org.openclover:clover:4.4.1'
+ testCompile 'org.openclover:clover:4.4.1'
}
}
task cloverInstr() {
// only instrument source, we build test classes as normal
- inputs.files files (sourceSets.main.allJava) // , fileTree(dir: testSourceDir, include: ["**/*.java"]))
+ inputs.files files (sourceSets.main.allJava,sourceSets.test.allJava) // , fileTree(dir:"$jalviewDir/$testSourceDir", include: ["**/*.java"]))
outputs.dir cloverInstrDir
doFirst {
def getdownWebsiteResourceFilenames = []
def getdownTextString = ""
def getdownResourceDir = getdownResourceDir
- def getdownAppDir = getdownAppDir
def getdownResourceFilenames = []
doFirst {
rename(build_properties_file, getdown_build_properties)
into getdownAppDir
}
- getdownWebsiteResourceFilenames += "${getdown_app_dir}/${getdown_build_properties}"
+ getdownWebsiteResourceFilenames += "${getdownAppDistDir}/${getdown_build_properties}"
// go through properties looking for getdown_txt_...
def props = project.properties.sort { it.key }
props.put("getdown_txt_multi_java_location", getdownAltMultiJavaLocation)
}
- props.put("getdown_txt_appbase", getdown_app_base)
+ props.put("getdown_txt_appbase", getdownAppBase)
props.each{ prop, val ->
if (prop.startsWith("getdown_txt_") && val != null) {
if (prop.startsWith("getdown_txt_multi_")) {
}
codeFiles.sort().each{f ->
def name = f.getName()
- def line = "code = ${getdown_app_dir}/${name}\n"
+ def line = "code = ${getdownAppDistDir}/${name}\n"
getdownTextString += line
copy {
from f.getPath()
def getdown_txt = file("${getdownWebsiteDir}/getdown.txt")
getdown_txt.write(getdownTextString)
- def launch_jvl = file("${getdownWebsiteDir}/${getdown_launch_jvl}")
- launch_jvl.write("appbase="+props.get("getdown_txt_appbase"))
+ 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"))
copy {
from getdownLauncher
copy {
from getdown_txt
- from launch_jvl
+ from launchJvl
from getdownLauncher
from "${getdownWebsiteDir}/${getdown_build_properties}"
if (file(getdownLauncher).getName() != getdown_launcher) {
}
+// a helper task to allow getdown digest of any dir: `gradle getdownDigestDir -PDIGESTDIR=/path/to/my/random/getdown/dir
+task getdownDigestDir(type: JavaExec) {
+ def digestDirPropertyName = "DIGESTDIR"
+ description = "Digest a local dir (-P${digestDirPropertyName}=...) for getdown"
+ doFirst {
+ classpath = files(getdownLauncher)
+ def digestDir = findProperty(digestDirPropertyName)
+ if (digestDir == null) {
+ throw new GradleException("Must provide a DIGESTDIR value to produce an alternative getdown digest")
+ }
+ args digestDir
+ }
+ main = "com.threerings.getdown.tools.Digester"
+}
+
+
task getdownDigest(type: JavaExec) {
group = "distribution"
description = "Digest the getdown website folder"
dependsOn getdownWebsite
doFirst {
- classpath = files("${getdownWebsiteDir}/${getdown_launcher}")
+ classpath = files(getdownLauncher)
}
main = "com.threerings.getdown.tools.Digester"
args getdownWebsiteDir
}
}
+ // turn off checksum creation for LOCAL channel
+ def e = install4jConfigXml.application[0]
+ if (CHANNEL == "LOCAL") {
+ e.'@createChecksums' = "false"
+ } else {
+ e.'@createChecksums' = "true"
+ }
+
// put file association actions where placeholder action is
def install4jFileAssociationsText = install4jFileAssociationsFile.text
def fileAssociationActions = new XmlParser().parseText("<actions>${install4jFileAssociationsText}</actions>")
filesMd5 = filesMd5.substring(0,8)
}
def install4jTemplateVersion = "${JALVIEW_VERSION}_F${filesMd5}_C${gitHash}"
+ // make install4jBuildDir relative to jalviewDir
+ def install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}"
- println("WINDOWS_JAVA_VM_TGZ=${windowsJavaVMTgz}")
variables = [
+ 'JALVIEW_NAME': getdown_txt_title,
+ 'JALVIEW_DIR': "../..",
'OSX_KEYSTORE': OSX_KEYSTORE,
'JSIGN_SH': JSIGN_SH,
'JRE_DIR': getdown_app_dir_java,
'LINUX_JAVA_VM_TGZ': linuxJavaVMTgz,
'COPYRIGHT_MESSAGE': install4j_copyright_message,
'MACOS_BUNDLE_ID': install4j_macOS_bundle_id,
+ 'INSTALLER_NAME': install4j_installer_name,
+ 'INSTALL4J_UTILS_DIR': install4j_utils_dir,
+ 'GETDOWN_WEBSITE_DIR': getdown_website_dir,
+ 'GETDOWN_FILES_DIR': getdown_files_dir,
'GETDOWN_RESOURCE_DIR': getdown_resource_dir,
- 'GETDOWN_DIST_DIR': getdown_app_dir,
+ 'GETDOWN_DIST_DIR': getdownAppDistDir,
'GETDOWN_ALT_DIR': getdown_app_dir_alt,
'GETDOWN_INSTALL_DIR': getdown_install_dir,
'INFO_PLIST_FILE_ASSOCIATIONS_FILE': install4j_info_plist_file_associations,
+ 'BUILD_DIR': install4jBuildDir,
]
- destination = "${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}"
+ destination = "${jalviewDir}/${install4jBuildDir}"
buildSelected = true
- if (install4j_faster.equals("true") || CHANNEL.startsWith("DEVELOP") || CHANNEL.startsWith("LOCAL")) {
- // this doesn't seem to work
+ if (install4j_faster.equals("true") || CHANNEL.startsWith("LOCAL")) {
faster = true
disableSigning = true
}