From: Jim Procter Date: Mon, 21 Nov 2022 17:02:08 +0000 (+0000) Subject: Merge commit 'alpha/update_2_12_for_2_11_2_series_merge^2' into HEAD X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=304e64fb34b32659be1bbfd39fb4e15b2f79586e;p=jalview.git Merge commit 'alpha/update_2_12_for_2_11_2_series_merge^2' into HEAD --- 304e64fb34b32659be1bbfd39fb4e15b2f79586e diff --cc build.gradle index 180d4ad,17407a9..46f2226 --- a/build.gradle +++ b/build.gradle @@@ -12,6 -12,6 +12,7 @@@ import java.security.MessageDiges import groovy.transform.ExternalizeMethods import groovy.util.XmlParser import groovy.xml.XmlUtil ++ import com.vladsch.flexmark.util.ast.Node import com.vladsch.flexmark.html.HtmlRenderer import com.vladsch.flexmark.parser.Parser @@@ -56,24 -58,13 +58,14 @@@ def string(Object o) return o == null ? "" : o.toString() } + - ext { - jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath() - jalviewDirRelativePath = jalviewDir - - // local build environment properties - // can be "projectDir/local.properties" - def localProps = "${projectDir}/local.properties" - def propsFile = null; - if (file(localProps).exists()) { - propsFile = localProps + def overrideProperties(String propsFileName, boolean output = false) { + if (propsFileName == null) { + return } - // or "../projectDir_local.properties" - def dirLocalProps = projectDir.getParent() + "/" + projectDir.getName() + "_local.properties" - if (file(dirLocalProps).exists()) { - propsFile = dirLocalProps - } - if (propsFile != null) { + def propsFile = file(propsFileName) + if (propsFile != null && propsFile.exists()) { + println("Using properties from file '${propsFileName}'") try { def p = new Properties() def localPropsFIS = new FileInputStream(propsFile) @@@ -146,6 -162,9 +163,8 @@@ ext } */ + // datestamp + buildDate = new Date().format("yyyyMMdd") - // essentials bareSourceDir = string(source_dir) sourceDir = string("${jalviewDir}/${bareSourceDir}") @@@ -166,8 -185,6 +185,7 @@@ //cloverTestClassesDir = cloverClassesDir cloverDb = string("${cloverBuildDir}/clover.db") - resourceClassesDir = useClover ? cloverClassesDir : classesDir + testSourceDir = useClover ? cloverTestInstrDir : testDir testClassesDir = useClover ? cloverTestClassesDir : "${jalviewDir}/${test_output_dir}" @@@ -437,12 -462,18 +463,19 @@@ install4jHomeDir = System.getProperty("user.home") + install4jHomeDir.substring(1) } + resourceBuildDir = string("${buildDir}/resources") + resourcesBuildDir = string("${resourceBuildDir}/resources_build") + helpBuildDir = string("${resourceBuildDir}/help_build") + docBuildDir = string("${resourceBuildDir}/doc_build") + + if (buildProperties == null) { + buildProperties = string("${resourcesBuildDir}/${build_properties_file}") + } buildingHTML = string("${jalviewDir}/${doc_dir}/building.html") - helpFile = string("${resourceClassesDir}/${help_dir}/help.jhm") helpParentDir = string("${jalviewDir}/${help_parent_dir}") helpSourceDir = string("${helpParentDir}/${help_dir}") + helpFile = string("${helpBuildDir}/${help_dir}/help.jhm") relativeBuildDir = file(jalviewDirAbsolutePath).toPath().relativize(buildDir.toPath()) @@@ -480,12 -512,9 +514,10 @@@ sourceSets } resources { - srcDirs resourceDir - srcDirs += helpParentDir + srcDirs = [ resourcesBuildDir, docBuildDir, helpBuildDir ] } - jar.destinationDir = file("${jalviewDir}/${package_dir}") + compileClasspath = files(sourceSets.main.java.outputDir) compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"]) @@@ -1156,15 -1158,7 +1161,8 @@@ task convertMdFiles def htmlFilePath = mdFile.getPath().replaceAll(/\..*?$/, ".html") htmlFiles.add(file(htmlFilePath)) } - outputs.files(htmlFiles) - } - + - task syncDocs(type: Sync) { - dependsOn convertMdFiles - def syncDir = "${classesDir}/${doc_dir}" - from fileTree("${jalviewDir}/${doc_dir}") - into syncDir + outputs.files(htmlFiles) } @@@ -1197,31 -1197,113 +1201,111 @@@ task copyHelp(type: Copy) } - task syncLib(type: Sync) { - def syncDir = "${resourceClassesDir}/${libDistDir}" - from fileTree("${jalviewDir}/${libDistDir}") - into syncDir + task copyResources(type: Copy) { + group = "build" + description = "Copy (and make text substitutions in) the resources dir to the build area" + + def inputDir = resourceDir + def outputDir = resourcesBuildDir + from(inputDir) { + include('**/*.txt') + include('**/*.md') + include('**/*.html') + include('**/*.xml') + filter(ReplaceTokens, + beginToken: '$$', + endToken: '$$', + tokens: [ + 'Version-Rel': JALVIEW_VERSION, + 'Year-Rel': getDate("yyyy") + ] + ) + } + from(inputDir) { + exclude('**/*.txt') + exclude('**/*.md') + exclude('**/*.html') + exclude('**/*.xml') + } + into outputDir + + inputs.dir(inputDir) + outputs.dir(outputDir) } + task copyChannelResources(type: Copy) { + dependsOn copyResources + group = "build" + description = "Copy the channel resources dir to the build resources area" + + def inputDir = "${channelDir}/${resource_dir}" + def outputDir = resourcesBuildDir + from inputDir + into outputDir - task syncResources(type: Sync) { - dependsOn createBuildProperties - from resourceDir - include "**/*.*" - into "${resourceClassesDir}" - preserve { - include "**" + inputs.dir(inputDir) + outputs.dir(outputDir) + } + + task createBuildProperties(type: WriteProperties) { + dependsOn copyResources + group = "build" + description = "Create the ${buildProperties} file" + + inputs.dir(sourceDir) + inputs.dir(resourcesBuildDir) + outputFile (buildProperties) + // taking time specific comment out to allow better incremental builds + comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss") + //comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd") + property "BUILD_DATE", getDate("HH:mm:ss dd MMMM yyyy") + property "VERSION", JALVIEW_VERSION + property "INSTALLATION", INSTALLATION+" git-commit:"+gitHash+" ["+gitBranch+"]" + if (getdownSetAppBaseProperty) { + property "GETDOWNAPPBASE", getdownAppBase + property "GETDOWNAPPDISTDIR", getdownAppDistDir } + outputs.file(outputFile) + } + - + task buildIndices(type: JavaExec) { + dependsOn copyHelp + classpath = sourceSets.main.compileClasspath + main = "com.sun.java.help.search.Indexer" + workingDir = "${helpBuildDir}/${help_dir}" + def argDir = "html" + args = [ argDir ] + inputs.dir("${workingDir}/${argDir}") + + outputs.dir("${classesDir}/doc") + outputs.dir("${classesDir}/help") + outputs.file("${workingDir}/JavaHelpSearch/DOCS") + outputs.file("${workingDir}/JavaHelpSearch/DOCS.TAB") + outputs.file("${workingDir}/JavaHelpSearch/OFFSETS") + outputs.file("${workingDir}/JavaHelpSearch/POSITIONS") + outputs.file("${workingDir}/JavaHelpSearch/SCHEMA") + outputs.file("${workingDir}/JavaHelpSearch/TMAP") + } + + task buildResources { + dependsOn copyResources + dependsOn copyChannelResources + dependsOn createBuildProperties } + task prepare { - dependsOn syncResources - dependsOn syncDocs + dependsOn buildResources + dependsOn copyDocs dependsOn copyHelp + dependsOn convertMdFiles + dependsOn buildIndices } + compileJava.dependsOn prepare + run.dependsOn compileJava + //run.dependsOn prepare - - //testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir test { dependsOn prepare @@@ -1256,26 -1346,6 +1348,8 @@@ } - task buildIndices(type: JavaExec) { - dependsOn copyHelp - classpath = sourceSets.main.compileClasspath - main = "com.sun.java.help.search.Indexer" - workingDir = "${classesDir}/${help_dir}" - def argDir = "html" - args = [ argDir ] - inputs.dir("${workingDir}/${argDir}") - - outputs.dir("${classesDir}/doc") - outputs.dir("${classesDir}/help") - outputs.file("${workingDir}/JavaHelpSearch/DOCS") - outputs.file("${workingDir}/JavaHelpSearch/DOCS.TAB") - outputs.file("${workingDir}/JavaHelpSearch/OFFSETS") - outputs.file("${workingDir}/JavaHelpSearch/POSITIONS") - outputs.file("${workingDir}/JavaHelpSearch/SCHEMA") - outputs.file("${workingDir}/JavaHelpSearch/TMAP") - } + + task compileLinkCheck(type: JavaCompile) { options.fork = true classpath = files("${jalviewDir}/${utils_dir}") @@@ -1311,9 -1381,10 +1385,9 @@@ task linkCheck(type: JavaExec) outputs.file(helpLinksCheckerOutFile) } - // import the pubhtmlhelp target ant.properties.basedir = "${jalviewDir}" - ant.properties.helpBuildDir = "${jalviewDirAbsolutePath}/${classes_dir}/${help_dir}" + ant.properties.helpBuildDir = "${helpBuildDir}/${help_dir}" ant.importBuild "${utils_dir}/publishHelp.xml" @@@ -1332,13 -1402,17 +1405,16 @@@ jar manifest { attributes "Main-Class": main_class, "Permissions": "all-permissions", - "Application-Name": "Jalview Desktop", - "Codebase": application_codebase + "Application-Name": install4jApplicationName, + "Codebase": application_codebase, + "Implementation-Version": JALVIEW_VERSION } - destinationDir = file("${jalviewDir}/${package_dir}") - archiveName = rootProject.name+".jar" + def outputDir = "${jalviewDir}/${package_dir}" + destinationDirectory = file(outputDir) + archiveFileName = rootProject.name+".jar" + duplicatesStrategy "EXCLUDE" - exclude "cache*/**" exclude "*.jar" exclude "*.jar.*" @@@ -1395,8 -1474,12 +1475,10 @@@ shadowJar include("*.jar") } manifest { - attributes 'Implementation-Version': JALVIEW_VERSION + attributes "Implementation-Version": JALVIEW_VERSION, + "Application-Name": install4jApplicationName } - + duplicatesStrategy "INCLUDE" - mainClassName = shadow_jar_main_class mergeServiceFiles() classifier = "all-"+JALVIEW_VERSION+"-j"+JAVA_VERSION @@@ -1741,12 -1855,6 +1854,7 @@@ task copyInstall4jTemplate } } - // remove the "Uninstall Old Jalview (optional)" symlink from DMG for non-release DS_Stores - if (! (CHANNEL == "RELEASE" || CHANNEL == "TEST-RELEASE" ) ) { - def symlink = install4jConfigXml.'**'.topLevelFiles.symlink.find { sl -> sl.'@name' == "Uninstall Old Jalview (optional).app" } - symlink.parent().remove(symlink) - } + // write install4j file install4jConfFile.text = XmlUtil.serialize(install4jConfigXml) } @@@ -1824,6 -1937,11 +1937,10 @@@ task installers(type: com.install4j.gra 'UNIX_APPLICATION_FOLDER': install4jUnixApplicationFolder, 'EXECUTABLE_NAME': install4jExecutableName, 'EXTRA_SCHEME': install4jExtraScheme, + 'MAC_ICONS_FILE': install4jMacIconsFile, + 'WINDOWS_ICONS_FILE': install4jWindowsIconsFile, + 'PNG_ICON_FILE': install4jPngIconFile, + 'BACKGROUND': install4jBackground, - ] //println("INSTALL4J VARIABLES:") @@@ -1864,17 -1992,13 +1991,12 @@@ spotless task sourceDist(type: Tar) { group "distribution" description "Create a source .tar.gz file for distribution" - - dependsOn convertMdFiles + dependsOn createBuildProperties + dependsOn convertMdFiles - 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 - } + archiveFileName = outputFileName compression Compression.GZIP @@@ -1957,6 -2081,15 +2079,13 @@@ // exclude(EXCLUDE_FILES) // exclude(PROCESS_FILES) // } - + from(file(buildProperties).getParent()) { + include(file(buildProperties).getName()) + rename(file(buildProperties).getName(), "build_properties") + filter({ line -> + line.replaceAll("^INSTALLATION=.*\$","INSTALLATION=Source Release"+" git-commit\\\\:"+gitHash+" ["+gitBranch+"]") + }) + } - } @@@ -2001,8 -2134,8 +2130,6 @@@ task jalviewjsEnableAltFileProperty(typ property(jalviewjs_j2s_alt_file_property_config, jalviewjs_j2s_alt_file_property) } } -- -- task jalviewjsSetEclipseWorkspace { def propKey = "jalviewjs_eclipse_workspace" def propVal = null @@@ -2266,6 -2399,10 +2393,8 @@@ task jalviewjsSyncAllLibs (type: Sync) preserve { include "**" } - + // should this be exclude really ? + duplicatesStrategy "INCLUDE" - outputs.files outputFiles inputs.files inputFiles } diff --cc doc/building.html index 2ca2641,8307ee3..5679cd8 --- a/doc/building.html +++ b/doc/building.html @@@ -1,10 -1,10 +1,10 @@@ -- ++ -- ++ Building Jalview from Source Building Jalview from Source