-
-
-install4j {
- if (file(install4jHomeDir).exists()) {
- // good to go!
- } else if (file(System.getProperty("user.home")+"/buildtools/install4j").exists()) {
- install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
- } else if (file("/Applications/install4j.app/Contents/Resources/app").exists()) {
- install4jHomeDir = "/Applications/install4j.app/Contents/Resources/app"
- }
- installDir(file(install4jHomeDir))
-
- mediaTypes = Arrays.asList(install4j_media_types.split(","))
-}
-
-
-task copyInstall4jTemplate(type: Copy) {
- dependsOn setGitVals
-
- def install4jTemplateMd5 = ""
- def digest = MessageDigest.getInstance("MD5")
- digest.update(
- (file("${install4jDir}/${install4j_template}").text +
- file("${install4jDir}/${install4j_info_plist_file_associations}").text +
- file("${install4jDir}/${install4j_installer_file_associations}").text).bytes)
- def filesMd5 = new BigInteger(1, digest.digest()).toString(16)
- if (filesMd5.length() >= 8) {
- filesMd5 = filesMd5.substring(0,8)
- }
- install4jTemplateMd5 += filesMd5
- install4jTemplateMd5 += "_${gitHash}"
-
- inputs.file("${install4jDir}/${install4j_template}")
- inputs.file("${install4jDir}/${install4j_info_plist_file_associations}")
- inputs.file("${install4jDir}/${install4j_installer_file_associations}")
- outputs.files(install4jConfFile)
-
- from (install4jDir) {
- include install4j_template
- rename (install4j_template, install4jConfFileName)
- // TODO change these ReplaceTokens to something better. Possibly ${compiler:variables} but also the ant.replaceregexp below, or perhaps a proper xmldom parse
- if (OSX_KEYPASS == "") {
- filter(ReplaceTokens,
- beginToken: 'codeSigning macEnabled="',
- endToken: '"',
- tokens: [
- 'true': 'codeSigning macEnabled="false"'
- ]
- )
- filter(ReplaceTokens,
- beginToken: 'runPostProcessor="true" ',
- endToken: 'Processor',
- tokens: [
- 'post': 'runPostProcessor="false" postProcessor'
- ]
- )
- }
- }
- into install4jDir
-
- doLast {
- // include file associations in installer
- def installerFileAssociationsXml = file("${install4jDir}/${install4j_installer_file_associations}").text
- ant.replaceregexp(
- byline: false,
- flags: "s",
- match: '<action name="EXTENSIONS_REPLACED_BY_GRADLE".*?</action>',
- replace: installerFileAssociationsXml,
- file: install4jConfFile
- )
- /*
- // include uninstaller applescript app files in dmg
- def installerDMGUninstallerXml = file("$install4jDir/$install4j_DMG_uninstaller_app_files").text
- ant.replaceregexp(
- byline: false,
- flags: "s",
- match: '<file name="UNINSTALL_OLD_JALVIEW_APP_REPLACED_IN_GRADLE" file=.*?>',
- replace: installerDMGUninstallerXml,
- file: install4jConfFile
- )
- */
- }
-}
-
-
-clean {
- doFirst {
- delete install4jConfFile
- }
-}
-
-
-task installers(type: com.install4j.gradle.Install4jTask) {
- group = "distribution"
- description = "Create the install4j installers"
- dependsOn getdown
- dependsOn copyInstall4jTemplate
- projectFile = file(install4jConfFile)
-
- def install4jTemplateMd5 = ""
- def digest = MessageDigest.getInstance("MD5")
- digest.update(
- (file("${install4jDir}/${install4j_template}").text +
- file("${install4jDir}/${install4j_info_plist_file_associations}").text +
- file("${install4jDir}/${install4j_installer_file_associations}").text).bytes)
- def filesMd5 = new BigInteger(1, digest.digest()).toString(16)
- if (filesMd5.length() >= 8) {
- filesMd5 = filesMd5.substring(0,8)
- }
- install4jTemplateMd5 += filesMd5
- install4jTemplateMd5 += "_${gitHash}"
- def install4jTemplateVersion = "${JALVIEW_VERSION}_${install4jTemplateMd5}"
-
- variables = [
- 'OSX_KEYSTORE': OSX_KEYSTORE,
- 'JSIGN_SH': JSIGN_SH,
- 'JALVIEW_VERSION': JALVIEW_VERSION,
- 'JAVA_MIN_VERSION': JAVA_MIN_VERSION,
- 'JAVA_MAX_VERSION': JAVA_MAX_VERSION,
- 'JAVA_VERSION': JAVA_VERSION,
- 'JAVA_INTEGER_VERSION': JAVA_INTEGER_VERSION,
- 'VERSION': JALVIEW_VERSION,
- 'MACOS_JAVA_VM_DIR': macosJavaVMDir,
- 'MACOS_JAVA_VM_TGZ': macosJavaVMTgz,
- 'WINDOWS_JAVA_VM_DIR': windowsJavaVMDir,
- 'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz,
- 'INSTALL4JINFOPLISTFILEASSOCIATIONS': install4j_info_plist_file_associations,
- 'INSTALLER_TEMPLATE_VERSION': install4jTemplateVersion,
- 'COPYRIGHT_MESSAGE': install4j_copyright_message,
- 'MACOS_BUNDLE_ID': install4j_macOS_bundle_id,
- 'GETDOWN_RESOURCE_DIR': getdown_resource_dir,
- 'GETDOWN_DIST_DIR': getdown_app_dir,
- 'GETDOWN_ALT_DIR': getdown_app_dir_alt,
- 'GETDOWN_INSTALL_DIR': getdown_install_dir
- ]
- destination = "${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}"
- buildSelected = true
-
- if (install4j_faster.equals("true") || CHANNEL.startsWith("DEVELOP") || CHANNEL.startsWith("LOCAL")) {
- // this doesn't seem to work
- faster = true
- disableSigning = true
- }
-
- if (OSX_KEYPASS) {
- macKeystorePassword=OSX_KEYPASS
- }
-
- doFirst {
- println("Using projectFile "+projectFile)
- }
-
- inputs.dir(getdownWebsiteDir)
- inputs.file(install4jConfFile)
- inputs.dir(macosJavaVMDir)
- inputs.dir(windowsJavaVMDir)
- outputs.dir("${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}")
-}
-
-
-task sourceDist (type: Tar) {
-
- def VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_")
- def outputFileName = "${project.name}_${VERSION_UNDERSCORES}.tar.gz"
- // cater for buildship < 3.1 [3.0.1 is max version in eclipse 2018-09]
- try {
- archiveFileName = outputFileName
- } catch (Exception e) {
- archiveName = outputFileName
- }
-
- compression Compression.GZIP
-
- into project.name
-
- 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 (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 {
- dependsOn copyHelp
- dependsOn pubhtmlhelp
-
- inputs.dir("${classesDir}/${helpDir}")
- outputs.dir("${buildDir}/distributions/${helpDir}")
-}
-
-// LARGE AMOUNT OF JALVIEWJS STUFF DELETED HERE
-task eclipseAutoBuildTask {}
-task eclipseSynchronizationTask {}