X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=1142388f541fb42f1e54ae5e38907fde4a6c25a4;hb=refs%2Fheads%2Fspikes%2FJAL-4113_javafx_with_Jalview_MSA;hp=e6b7e339120a9aa9a1ff846ff03880129ba2e3b3;hpb=deb17f488d8703a82b350c25c9ab846cc4a778fe;p=jalview.git diff --git a/build.gradle b/build.gradle index e6b7e33..1142388 100644 --- a/build.gradle +++ b/build.gradle @@ -38,6 +38,7 @@ buildscript { dependencies { classpath "com.vladsch.flexmark:flexmark-all:0.62.0" classpath "org.jsoup:jsoup:1.14.3" + classpath "com.eowise:gradle-imagemagick:0.5.1" } } @@ -113,7 +114,6 @@ ext { // Import channel_properties if (getdownChannelName.startsWith("develop-")) { channelDirName = "develop-SUFFIX" - println("SET propertiesChannelName to '${propertiesChannelName}'") } channelDir = string("${jalviewDir}/${channel_properties_dir}/${channelDirName}") channelGradleProperties = string("${channelDir}/channel_gradle.properties") @@ -204,7 +204,8 @@ ext { testSourceDir = useClover ? cloverTestInstrDir : testDir testClassesDir = useClover ? cloverTestClassesDir : "${jalviewDir}/${test_output_dir}" - channelSuffix = null + channelSuffix = "" + backgroundImageText = BACKGROUNDIMAGETEXT getdownChannelDir = string("${getdown_website_dir}/${propertiesChannelName}") getdownAppBaseDir = string("${jalviewDir}/${getdownChannelDir}/${JAVA_VERSION}") getdownArchiveDir = string("${jalviewDir}/${getdown_archive_dir}") @@ -222,12 +223,15 @@ ext { getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}") getdownAppDistDir = getdown_app_dir_alt getdownImagesDir = string("${jalviewDir}/${getdown_images_dir}") + getdownImagesBuildDir = string("${buildDir}/imagemagick/getdown") getdownSetAppBaseProperty = false // whether to pass the appbase and appdistdir to the application reportRsyncCommand = false jvlChannelName = CHANNEL.toLowerCase() install4jSuffix = CHANNEL.substring(0, 1).toUpperCase() + CHANNEL.substring(1).toLowerCase(); // BUILD -> Build install4jDMGDSStore = "${install4j_images_dir}/${install4j_dmg_ds_store}" - install4jDMGBackgroundImage = "${install4j_images_dir}/${install4j_dmg_background}" + install4jDMGBackgroundImageDir = "${install4j_images_dir}" + install4jDMGBackgroundImageBuildDir = "build/imagemagick/install4j" + install4jDMGBackgroundImageFile = "${install4j_dmg_background}" install4jInstallerName = "${jalview_name} Non-Release Installer" install4jExecutableName = install4j_executable_name install4jExtraScheme = "jalviewx" @@ -252,6 +256,7 @@ ext { testng_excluded_groups = "Not-bamboo" } install4jExtraScheme = "jalviewb" + backgroundImageText = true break case [ "RELEASE", "JALVIEWJS-RELEASE" ]: @@ -282,7 +287,7 @@ ext { getdownDir = string("${getdownChannelName}/${JAVA_VERSION}") getdownAppBase = file(getdownAppBaseDir).toURI().toString() if (!file("${ARCHIVEDIR}/${package_dir}").exists()) { - throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution") + throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution [did not find '${ARCHIVEDIR}/${package_dir}']") } else { package_dir = string("${ARCHIVEDIR}/${package_dir}") buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}") @@ -308,6 +313,7 @@ ext { getdownDir = string("${getdownChannelName}/${JAVA_VERSION}") getdownAppBase = string("${getdown_channel_base}/${getdownDir}") channelSuffix = string(suffix) + backgroundImageText = true break case "DEVELOP": @@ -319,6 +325,7 @@ ext { install4jSuffix = "Develop" install4jExtraScheme = "jalviewd" install4jInstallerName = "${jalview_name} Develop Installer" + backgroundImageText = true break case "TEST-RELEASE": @@ -333,6 +340,7 @@ ext { install4jSuffix = "Test" install4jExtraScheme = "jalviewt" install4jInstallerName = "${jalview_name} Test Installer" + backgroundImageText = true break case ~/^SCRATCH(|-[-\w]*)$/: @@ -356,6 +364,7 @@ ext { install4jSuffix = "Test-Local" install4jExtraScheme = "jalviewt" install4jInstallerName = "${jalview_name} Test Installer" + backgroundImageText = true break case [ "LOCAL", "JALVIEWJS" ]: @@ -432,7 +441,6 @@ ext { modules_compileClasspath = fileTree(dir: "${jalviewDir}/${j11modDir}", include: ["*.jar"]) modules_runtimeClasspath = modules_compileClasspath */ - gitHash = "SOURCE" gitBranch = "Source" try { @@ -537,6 +545,14 @@ ext { helpSourceDir = string("${helpParentDir}/${help_dir}") helpFile = string("${helpBuildDir}/${help_dir}/help.jhm") + convertBinary = null + convertBinaryExpectedLocation = imagemagick_convert + if (convertBinaryExpectedLocation.startsWith("~/")) { + convertBinaryExpectedLocation = System.getProperty("user.home") + convertBinaryExpectedLocation.substring(1) + } + if (file(convertBinaryExpectedLocation).exists()) { + convertBinary = convertBinaryExpectedLocation + } relativeBuildDir = file(jalviewDirAbsolutePath).toPath().relativize(buildDir.toPath()) jalviewjsBuildDir = string("${relativeBuildDir}/jalviewjs") @@ -1429,8 +1445,6 @@ def getMdSections(String content) { } return sections } - - task copyHelp(type: Copy) { def inputDir = helpSourceDir def outputDir = "${helpBuildDir}/${help_dir}" @@ -1601,8 +1615,6 @@ task releasesTemplates { outputs.file(releasesHtmlFile) outputs.file(whatsnewHtmlFile) } - - task copyResources(type: Copy) { group = "build" description = "Copy (and make text substitutions in) the resources dir to the build area" @@ -1739,6 +1751,8 @@ test { excludeGroups testng_excluded_groups preserveOrder true useDefaultListeners=true + // Uncomment to show stdout and stderr for tests in gradle build output + // testLogging.showStandardStreams = true } maxHeapSize = "1024m" @@ -1906,10 +1920,58 @@ shadowJar { minimize() } +task getdownImagesCopy() { + inputs.dir getdownImagesDir + outputs.dir getdownImagesBuildDir + + doFirst { + copy { + from(getdownImagesDir) { + include("*getdown*.png") + } + into getdownImagesBuildDir + } + } +} + +task getdownImagesProcess() { + dependsOn getdownImagesCopy + + doFirst { + if (backgroundImageText) { + if (convertBinary == null) { + throw new StopExecutionException("No ImageMagick convert binary installed at '${convertBinaryExpectedLocation}'") + } + if (!project.hasProperty("getdown_background_image_text_suffix_cmd")) { + throw new StopExecutionException("No property 'getdown_background_image_text_suffix_cmd' defined. See channel_gradle.properties for channel ${CHANNEL}") + } + fileTree(dir: getdownImagesBuildDir, include: "*background*.png").getFiles().each { file -> + exec { + executable convertBinary + args = [ + file.getPath(), + '-font', getdown_background_image_text_font, + '-fill', getdown_background_image_text_colour, + '-draw', sprintf(getdown_background_image_text_suffix_cmd, channelSuffix), + '-draw', sprintf(getdown_background_image_text_commit_cmd, "git-commit: ${gitHash}"), + '-draw', sprintf(getdown_background_image_text_date_cmd, getDate("yyyy-MM-dd HH:mm:ss")), + file.getPath() + ] + } + } + } + } +} + +task getdownImages() { + dependsOn getdownImagesProcess +} task getdownWebsite() { group = "distribution" description = "Create the getdown minimal app folder, and website folder for this version of jalview. Website folder also used for offline app installer" + + dependsOn getdownImages if (buildDist) { dependsOn makeDist } @@ -1954,13 +2016,13 @@ task getdownWebsite() { if (getdownAltMultiJavaLocation != null && getdownAltMultiJavaLocation.length() > 0) { props.put("getdown_txt_multi_java_location", getdownAltMultiJavaLocation) } - if (getdownImagesDir != null && file(getdownImagesDir).exists()) { - props.put("getdown_txt_ui.background_image", "${getdownImagesDir}/${getdown_background_image}") - props.put("getdown_txt_ui.instant_background_image", "${getdownImagesDir}/${getdown_instant_background_image}") - props.put("getdown_txt_ui.error_background", "${getdownImagesDir}/${getdown_error_background}") - props.put("getdown_txt_ui.progress_image", "${getdownImagesDir}/${getdown_progress_image}") - props.put("getdown_txt_ui.icon", "${getdownImagesDir}/${getdown_icon}") - props.put("getdown_txt_ui.mac_dock_icon", "${getdownImagesDir}/${getdown_mac_dock_icon}") + if (getdownImagesBuildDir != null && file(getdownImagesBuildDir).exists()) { + props.put("getdown_txt_ui.background_image", "${getdownImagesBuildDir}/${getdown_background_image}") + props.put("getdown_txt_ui.instant_background_image", "${getdownImagesBuildDir}/${getdown_instant_background_image}") + props.put("getdown_txt_ui.error_background", "${getdownImagesBuildDir}/${getdown_error_background}") + props.put("getdown_txt_ui.progress_image", "${getdownImagesBuildDir}/${getdown_progress_image}") + props.put("getdown_txt_ui.icon", "${getdownImagesBuildDir}/${getdown_icon}") + props.put("getdown_txt_ui.mac_dock_icon", "${getdownImagesBuildDir}/${getdown_mac_dock_icon}") } props.put("getdown_txt_title", jalview_name) @@ -2294,7 +2356,6 @@ task getdownArchive() { dependsOn getdownArchiveBuild dependsOn getdownArchiveDigest } - tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } @@ -2349,7 +2410,6 @@ task copyInstall4jTemplate { macosArchive.attributes().remove('executeSetupApp') macosArchive.attributes().remove('setupAppId') } - // turn off checksum creation for LOCAL channel def e = install4jConfigXml.application[0] e.'@createChecksums' = string(install4jCheckSums) @@ -2416,12 +2476,59 @@ task cleanInstallersDataFiles { } } +task install4jDMGBackgroundImageCopy { + inputs.file "${install4jDMGBackgroundImageDir}/${install4jDMGBackgroundImageFile}" + outputs.dir "${install4jDMGBackgroundImageBuildDir}" + doFirst { + copy { + from(install4jDMGBackgroundImageDir) { + include(install4jDMGBackgroundImageFile) + } + into install4jDMGBackgroundImageBuildDir + } + } +} + +task install4jDMGBackgroundImageProcess { + dependsOn install4jDMGBackgroundImageCopy + + doFirst { + if (backgroundImageText) { + if (convertBinary == null) { + throw new StopExecutionException("No ImageMagick convert binary installed at '${convertBinaryExpectedLocation}'") + } + if (!project.hasProperty("install4j_background_image_text_suffix_cmd")) { + throw new StopExecutionException("No property 'install4j_background_image_text_suffix_cmd' defined. See channel_gradle.properties for channel ${CHANNEL}") + } + fileTree(dir: install4jDMGBackgroundImageBuildDir, include: "*.png").getFiles().each { file -> + exec { + executable convertBinary + args = [ + file.getPath(), + '-font', install4j_background_image_text_font, + '-fill', install4j_background_image_text_colour, + '-draw', sprintf(install4j_background_image_text_suffix_cmd, channelSuffix), + '-draw', sprintf(install4j_background_image_text_commit_cmd, "git-commit: ${gitHash}"), + '-draw', sprintf(install4j_background_image_text_date_cmd, getDate("yyyy-MM-dd HH:mm:ss")), + file.getPath() + ] + } + } + } + } +} + +task install4jDMGBackgroundImage { + dependsOn install4jDMGBackgroundImageProcess +} + task installerFiles(type: com.install4j.gradle.Install4jTask) { group = "distribution" description = "Create the install4j installers" dependsOn getdown dependsOn copyInstall4jTemplate dependsOn cleanInstallersDataFiles + dependsOn install4jDMGBackgroundImage projectFile = install4jConfFile @@ -2464,7 +2571,7 @@ task installerFiles(type: com.install4j.gradle.Install4jTask) { 'INTERNAL_ID': install4jInternalId, 'WINDOWS_APPLICATION_ID': install4jWinApplicationId, 'MACOS_DMG_DS_STORE': install4jDMGDSStore, - 'MACOS_DMG_BG_IMAGE': install4jDMGBackgroundImage, + 'MACOS_DMG_BG_IMAGE': "${install4jDMGBackgroundImageBuildDir}/${install4jDMGBackgroundImageFile}", 'WRAPPER_LINK': getdownWrapperLink, 'BASH_WRAPPER_SCRIPT': getdown_bash_wrapper_script, 'POWERSHELL_WRAPPER_SCRIPT': getdown_powershell_wrapper_script, @@ -2606,7 +2713,6 @@ task installers { dependsOn installerFiles } - spotless { java { eclipse().configFile(eclipse_codestyle_file) @@ -2781,7 +2887,6 @@ task dataInstallersJson { task helppages { group "help" description "Copies all help pages to build dir. Runs ant task 'pubhtmlhelp'." - dependsOn copyHelp dependsOn pubhtmlhelp