From 8f03cb58af639ecddd76c7967d223c14a0286a98 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Tue, 21 Sep 2021 09:57:00 +0100 Subject: [PATCH 1/1] JAL-3521 'Debian-safe' version of minimal build.gradle and patch. Using existing doc/*.html and build_properties from source tarball. --- utils/debian/build_gradle.patch | 280 ++++++++++++++++++++++++++++++-------- utils/debian/debian_build.gradle | 151 ++------------------ 2 files changed, 235 insertions(+), 196 deletions(-) diff --git a/utils/debian/build_gradle.patch b/utils/debian/build_gradle.patch index 867a576..1527c79 100644 --- a/utils/debian/build_gradle.patch +++ b/utils/debian/build_gradle.patch @@ -1,6 +1,6 @@ ---- a/build.gradle 2021-09-20 17:46:04.088152106 +0100 -+++ b/build.gradle 2021-09-20 17:46:09.180302062 +0100 -@@ -2,16 +2,6 @@ +--- a/build.gradle 2021-09-21 09:52:04.653972716 +0100 ++++ b/build.gradle 2021-09-21 09:52:18.117985307 +0100 +@@ -2,56 +2,12 @@ * For properties set within build.gradle, use camelCaseNoSpace. */ import org.apache.tools.ant.filters.ReplaceTokens @@ -14,23 +14,28 @@ -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 -@@ -24,34 +14,17 @@ - import com.vladsch.flexmark.ext.toc.TocExtension - - buildscript { +-import com.vladsch.flexmark.util.ast.Node +-import com.vladsch.flexmark.html.HtmlRenderer +-import com.vladsch.flexmark.parser.Parser +-import com.vladsch.flexmark.util.data.MutableDataSet +-import com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension +-import com.vladsch.flexmark.ext.tables.TablesExtension +-import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughExtension +-import com.vladsch.flexmark.ext.autolink.AutolinkExtension +-import com.vladsch.flexmark.ext.anchorlink.AnchorLinkExtension +-import com.vladsch.flexmark.ext.toc.TocExtension +- +-buildscript { - repositories { - mavenCentral() - mavenLocal() - } - dependencies { - classpath "com.vladsch.flexmark:flexmark-all:0.62.0" - } - } - +- dependencies { +- classpath "com.vladsch.flexmark:flexmark-all:0.62.0" +- } +-} - + plugins { id 'java' id 'application' @@ -39,20 +44,25 @@ - id 'com.github.johnrengelman.shadow' version '4.0.3' - id 'com.install4j.gradle' version '8.0.10' - id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree - id 'com.palantir.git-version' version '0.12.3' - } - +- id 'com.palantir.git-version' version '0.12.3' +-} +- -repositories { - jcenter() - mavenCentral() - mavenLocal() --} -- + } + - // in ext the values are cast to Object. Ensure string values are cast as String (and not GStringImpl) for later use def string(Object o) { return o == null ? "" : o.toString() -@@ -96,19 +69,11 @@ +@@ -92,23 +48,15 @@ + } + } + +-ext { ++project.ext { jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath() jalviewDirRelativePath = jalviewDir @@ -74,7 +84,7 @@ //// // Import releaseProps from the RELEASE file // or a file specified via JALVIEW_RELEASE_FILE if defined -@@ -128,41 +93,6 @@ +@@ -128,41 +76,6 @@ if (findProperty("JALVIEW_VERSION")==null || "".equals(JALVIEW_VERSION)) { JALVIEW_VERSION = releaseProps.get("jalview.version") } @@ -116,7 +126,7 @@ // essentials bareSourceDir = string(source_dir) -@@ -173,214 +103,18 @@ +@@ -173,218 +86,18 @@ classesDir = string("${jalviewDir}/${classes_dir}") @@ -144,15 +154,7 @@ - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}") - getdownAppDistDir = getdown_app_dir_alt - getdownImagesDir = string("${jalviewDir}/${getdown_images_dir}") -+ useClover = false -+ -+ resourceClassesDir = classesDir -+ -+ testSourceDir = testDir -+ testClassesDir = "${jalviewDir}/${test_output_dir}" -+ -+ buildProperties = string("${classesDir}/${build_properties_file}") - getdownSetAppBaseProperty = false // whether to pass the appbase and appdistdir to the application +- 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 @@ -179,6 +181,7 @@ - } - install4jExtraScheme = "jalviewb" - break ++ useClover = false - case [ "RELEASE", "JALVIEWJS-RELEASE" ]: - getdownAppDistDir = getdown_app_dir_release @@ -336,12 +339,23 @@ - modules_compileClasspath = fileTree(dir: "${jalviewDir}/${j11modDir}", include: ["*.jar"]) - modules_runtimeClasspath = modules_compileClasspath - */ +- def details = versionDetails() +- gitHash = details.gitHash +- gitBranch = details.branchName ++ resourceClassesDir = classesDir ++ ++ testSourceDir = testDir ++ testClassesDir = "${jalviewDir}/${test_output_dir}" + ++ buildProperties = string("${classesDir}/${build_properties_file}") ++ getdownSetAppBaseProperty = false // whether to pass the appbase and appdistdir to the application ++ + install4jApplicationName = "${jalview_name}" + - def details = versionDetails() - gitHash = details.gitHash - gitBranch = details.branchName -@@ -396,71 +130,16 @@ + println("Using a ${CHANNEL} profile.") + + additional_compiler_args = [] +@@ -396,71 +109,16 @@ libDistDir = j8libDir compile_source_compatibility = 1.8 compile_target_compatibility = 1.8 @@ -413,7 +427,7 @@ resourceBuildDir = string("${buildDir}/resources") resourcesBuildDir = string("${resourceBuildDir}/resources_build") helpBuildDir = string("${resourceBuildDir}/help_build") -@@ -474,31 +153,6 @@ +@@ -474,31 +132,6 @@ helpSourceDir = string("${helpParentDir}/${help_dir}") helpFile = string("${helpBuildDir}/${help_dir}/help.jhm") @@ -445,7 +459,7 @@ // ENDEXT } -@@ -517,27 +171,12 @@ +@@ -517,27 +150,12 @@ compileClasspath = files(sourceSets.main.java.outputDir) compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"]) @@ -458,11 +472,11 @@ - srcDirs cloverInstrDir - outputDir = cloverClassesDir - } - +- - resources { - srcDirs = sourceSets.main.resources.srcDirs - } -- + - compileClasspath = files( sourceSets.clover.java.outputDir ) - //compileClasspath += files( testClassesDir ) + compileClasspath = files(sourceSets.main.java.outputDir) @@ -475,7 +489,7 @@ } test { -@@ -557,453 +196,41 @@ +@@ -557,453 +175,41 @@ runtimeClasspath = compileClasspath runtimeClasspath += files(sourceSets.test.resources.srcDirs) } @@ -887,11 +901,14 @@ - if (cloverreport_xml_options.length() > 0) { - argsList += cloverreport_xml_options.split(" ") - } - +- - args argsList.toArray() -} -- -- + ++ compileClasspath = files( sourceSets.test.java.outputDir ) ++ compileClasspath += sourceSets.main.compileClasspath ++ compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["** REMOVE_THIS_GAP /*.jar"]) + -task cloverReport { - group = "Verification" - description = "Creates clover reports" @@ -902,10 +919,7 @@ - - -compileCloverJava { -+ compileClasspath = files( sourceSets.test.java.outputDir ) -+ compileClasspath += sourceSets.main.compileClasspath -+ compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["** REMOVE_THIS_GAP /*.jar"]) - +- - doFirst { - sourceCompatibility = compile_source_compatibility - targetCompatibility = compile_target_compatibility @@ -943,7 +957,7 @@ print ("Setting target compatibility to "+targetCompatibility+"\n") } } -@@ -1017,7 +244,6 @@ +@@ -1017,7 +223,6 @@ cleanTest { @@ -951,7 +965,163 @@ doFirst { delete sourceSets.test.java.outputDir } -@@ -1306,12 +532,7 @@ +@@ -1031,85 +236,6 @@ + } + + +-def convertMdToHtml (FileTree mdFiles, File cssFile) { +- MutableDataSet options = new MutableDataSet() +- +- def extensions = new ArrayList<>() +- extensions.add(AnchorLinkExtension.create()) +- extensions.add(AutolinkExtension.create()) +- extensions.add(StrikethroughExtension.create()) +- extensions.add(TaskListExtension.create()) +- extensions.add(TablesExtension.create()) +- extensions.add(TocExtension.create()) +- +- options.set(Parser.EXTENSIONS, extensions) +- +- // set GFM table parsing options +- options.set(TablesExtension.WITH_CAPTION, false) +- options.set(TablesExtension.COLUMN_SPANS, false) +- options.set(TablesExtension.MIN_HEADER_ROWS, 1) +- options.set(TablesExtension.MAX_HEADER_ROWS, 1) +- options.set(TablesExtension.APPEND_MISSING_COLUMNS, true) +- options.set(TablesExtension.DISCARD_EXTRA_COLUMNS, true) +- options.set(TablesExtension.HEADER_SEPARATOR_COLUMN_MATCH, true) +- // GFM anchor links +- options.set(AnchorLinkExtension.ANCHORLINKS_SET_ID, false) +- options.set(AnchorLinkExtension.ANCHORLINKS_ANCHOR_CLASS, "anchor") +- options.set(AnchorLinkExtension.ANCHORLINKS_SET_NAME, true) +- options.set(AnchorLinkExtension.ANCHORLINKS_TEXT_PREFIX, "") +- +- Parser parser = Parser.builder(options).build() +- HtmlRenderer renderer = HtmlRenderer.builder(options).build() +- +- mdFiles.each { mdFile -> +- // add table of contents +- def mdText = "[TOC]\n"+mdFile.text +- +- // grab the first top-level title +- def title = null +- def titleRegex = /(?m)^#(\s+|([^#]))(.*)/ +- def matcher = mdText =~ titleRegex +- if (matcher.size() > 0) { +- // matcher[0][2] is the first character of the title if there wasn't any whitespace after the # +- title = (matcher[0][2] != null ? matcher[0][2] : "")+matcher[0][3] +- } +- // or use the filename if none found +- if (title == null) { +- title = mdFile.getName() +- } +- +- Node document = parser.parse(mdText) +- String htmlBody = renderer.render(document) +- def htmlText = ''' +- +- +- +- +- +- +-''' +- htmlText += ((title != null) ? " ${title}" : '' ) +- htmlText += ''' +- +-''' +- htmlText += ((cssFile != null) ? cssFile.text : '') +- htmlText += ''' +- +-''' +- htmlText += htmlBody +- htmlText += ''' +- +- +-''' +- +- def htmlFilePath = mdFile.getPath().replaceAll(/\..*?$/, ".html") +- def htmlFile = file(htmlFilePath) +- println("Creating ${htmlFilePath}") +- htmlFile.text = htmlText +- } +-} +- +- + task copyDocs(type: Copy) { + def inputDir = "${jalviewDir}/${doc_dir}" + def outputDir = "${docBuildDir}/${doc_dir}" +@@ -1140,27 +266,6 @@ + } + + +-task convertMdFiles { +- dependsOn copyDocs +- def mdFiles = fileTree(dir: docBuildDir, include: "**/*.md") +- def cssFile = file("${jalviewDir}/${flexmark_css}") +- +- doLast { +- convertMdToHtml(mdFiles, cssFile) +- } +- +- inputs.files(mdFiles) +- inputs.file(cssFile) +- +- def htmlFiles = [] +- mdFiles.each { mdFile -> +- def htmlFilePath = mdFile.getPath().replaceAll(/\..*?$/, ".html") +- htmlFiles.add(file(htmlFilePath)) +- } +- outputs.files(htmlFiles) +-} +- +- + task copyHelp(type: Copy) { + def inputDir = helpSourceDir + def outputDir = "${helpBuildDir}/${help_dir}" +@@ -1242,24 +347,15 @@ + 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 +- } ++task createBuildProperties(type: Copy) { ++ // using the build_properties already included in the source tarball ++ def inputFile = "build_properties" ++ def outputFile = buildProperties ++ from inputFile ++ into file(outputFile).getParent() ++ rename(file(inputFile).getName(), file(outputFile).getName()) ++ ++ inputs.file(inputFile) + outputs.file(outputFile) + } + +@@ -1293,7 +389,6 @@ + dependsOn buildResources + dependsOn copyDocs + dependsOn copyHelp +- dependsOn convertMdFiles + dependsOn buildIndices + } + +@@ -1306,12 +401,7 @@ //testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir test { dependsOn prepare @@ -965,7 +1135,7 @@ useTestNG() { includeGroups testng_groups -@@ -1323,6 +544,7 @@ +@@ -1323,6 +413,7 @@ maxHeapSize = "1024m" workingDir = jalviewDir @@ -973,7 +1143,7 @@ def testLaf = project.findProperty("test_laf") if (testLaf != null) { println("Setting Test LaF to '${testLaf}'") -@@ -1338,9 +560,6 @@ +@@ -1338,9 +429,6 @@ jvmArgs += additional_compiler_args doFirst { @@ -983,7 +1153,7 @@ } } -@@ -1420,1752 +639,7 @@ +@@ -1420,1752 +508,7 @@ sourceSets.main.resources.srcDirs.each{ dir -> inputs.dir(dir) } @@ -2039,7 +2209,7 @@ - println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}") - } - } -- + - //def projdir = eclipseWorkspace.getPath()+"/.metadata/.plugins/org.eclipse.core.resources/.projects/jalview/org.eclipse.jdt.core" - def projdir = eclipseWorkspace.getPath()+"/.metadata/.plugins/org.eclipse.core.resources/.projects/jalview" - executable(eclipseBinary) @@ -2059,7 +2229,7 @@ - } -} - - +- -task jalviewjsTranspile(type: Exec) { - dependsOn jalviewjsEclipseSetup - dependsOn jalviewjsProjectImport diff --git a/utils/debian/debian_build.gradle b/utils/debian/debian_build.gradle index 998645a..a0e8cd9 100644 --- a/utils/debian/debian_build.gradle +++ b/utils/debian/debian_build.gradle @@ -2,27 +2,10 @@ * For properties set within build.gradle, use camelCaseNoSpace. */ import org.apache.tools.ant.filters.ReplaceTokens -import com.vladsch.flexmark.util.ast.Node -import com.vladsch.flexmark.html.HtmlRenderer -import com.vladsch.flexmark.parser.Parser -import com.vladsch.flexmark.util.data.MutableDataSet -import com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension -import com.vladsch.flexmark.ext.tables.TablesExtension -import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughExtension -import com.vladsch.flexmark.ext.autolink.AutolinkExtension -import com.vladsch.flexmark.ext.anchorlink.AnchorLinkExtension -import com.vladsch.flexmark.ext.toc.TocExtension - -buildscript { - dependencies { - classpath "com.vladsch.flexmark:flexmark-all:0.62.0" - } -} plugins { id 'java' id 'application' - id 'com.palantir.git-version' version '0.12.3' } // in ext the values are cast to Object. Ensure string values are cast as String (and not GStringImpl) for later use @@ -65,7 +48,7 @@ def overrideProperties(String propsFileName, boolean output = false) { } } -ext { +project.ext { jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath() jalviewDirRelativePath = jalviewDir @@ -115,10 +98,6 @@ ext { install4jApplicationName = "${jalview_name}" - def details = versionDetails() - gitHash = details.gitHash - gitBranch = details.branchName - println("Using a ${CHANNEL} profile.") additional_compiler_args = [] @@ -257,85 +236,6 @@ def getDate(format) { } -def convertMdToHtml (FileTree mdFiles, File cssFile) { - MutableDataSet options = new MutableDataSet() - - def extensions = new ArrayList<>() - extensions.add(AnchorLinkExtension.create()) - extensions.add(AutolinkExtension.create()) - extensions.add(StrikethroughExtension.create()) - extensions.add(TaskListExtension.create()) - extensions.add(TablesExtension.create()) - extensions.add(TocExtension.create()) - - options.set(Parser.EXTENSIONS, extensions) - - // set GFM table parsing options - options.set(TablesExtension.WITH_CAPTION, false) - options.set(TablesExtension.COLUMN_SPANS, false) - options.set(TablesExtension.MIN_HEADER_ROWS, 1) - options.set(TablesExtension.MAX_HEADER_ROWS, 1) - options.set(TablesExtension.APPEND_MISSING_COLUMNS, true) - options.set(TablesExtension.DISCARD_EXTRA_COLUMNS, true) - options.set(TablesExtension.HEADER_SEPARATOR_COLUMN_MATCH, true) - // GFM anchor links - options.set(AnchorLinkExtension.ANCHORLINKS_SET_ID, false) - options.set(AnchorLinkExtension.ANCHORLINKS_ANCHOR_CLASS, "anchor") - options.set(AnchorLinkExtension.ANCHORLINKS_SET_NAME, true) - options.set(AnchorLinkExtension.ANCHORLINKS_TEXT_PREFIX, "") - - Parser parser = Parser.builder(options).build() - HtmlRenderer renderer = HtmlRenderer.builder(options).build() - - mdFiles.each { mdFile -> - // add table of contents - def mdText = "[TOC]\n"+mdFile.text - - // grab the first top-level title - def title = null - def titleRegex = /(?m)^#(\s+|([^#]))(.*)/ - def matcher = mdText =~ titleRegex - if (matcher.size() > 0) { - // matcher[0][2] is the first character of the title if there wasn't any whitespace after the # - title = (matcher[0][2] != null ? matcher[0][2] : "")+matcher[0][3] - } - // or use the filename if none found - if (title == null) { - title = mdFile.getName() - } - - Node document = parser.parse(mdText) - String htmlBody = renderer.render(document) - def htmlText = ''' - - - - - - -''' - htmlText += ((title != null) ? " ${title}" : '' ) - htmlText += ''' - -''' - htmlText += ((cssFile != null) ? cssFile.text : '') - htmlText += ''' - -''' - htmlText += htmlBody - htmlText += ''' - - -''' - - def htmlFilePath = mdFile.getPath().replaceAll(/\..*?$/, ".html") - def htmlFile = file(htmlFilePath) - println("Creating ${htmlFilePath}") - htmlFile.text = htmlText - } -} - - task copyDocs(type: Copy) { def inputDir = "${jalviewDir}/${doc_dir}" def outputDir = "${docBuildDir}/${doc_dir}" @@ -366,27 +266,6 @@ task copyDocs(type: Copy) { } -task convertMdFiles { - dependsOn copyDocs - def mdFiles = fileTree(dir: docBuildDir, include: "**/*.md") - def cssFile = file("${jalviewDir}/${flexmark_css}") - - doLast { - convertMdToHtml(mdFiles, cssFile) - } - - inputs.files(mdFiles) - inputs.file(cssFile) - - def htmlFiles = [] - mdFiles.each { mdFile -> - def htmlFilePath = mdFile.getPath().replaceAll(/\..*?$/, ".html") - htmlFiles.add(file(htmlFilePath)) - } - outputs.files(htmlFiles) -} - - task copyHelp(type: Copy) { def inputDir = helpSourceDir def outputDir = "${helpBuildDir}/${help_dir}" @@ -468,24 +347,15 @@ task copyChannelResources(type: Copy) { 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 - } +task createBuildProperties(type: Copy) { + // using the build_properties already included in the source tarball + def inputFile = "build_properties" + def outputFile = buildProperties + from inputFile + into file(outputFile).getParent() + rename(file(inputFile).getName(), file(outputFile).getName()) + + inputs.file(inputFile) outputs.file(outputFile) } @@ -519,7 +389,6 @@ task prepare { dependsOn buildResources dependsOn copyDocs dependsOn copyHelp - dependsOn convertMdFiles dependsOn buildIndices } -- 1.7.10.2