X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=utils%2Fdebian%2Fdebian_build.gradle;h=a0e8cd9bc449b91d9b60e78a39c45394da032277;hb=f9574ab683df8d0c9dfda092c9005ca773c38e55;hp=b609ec6efe86d160a426de6278d7e36ff5da6fcf;hpb=165bed9cee440af8e75b74e799b1c477eb08445b;p=jalview.git diff --git a/utils/debian/debian_build.gradle b/utils/debian/debian_build.gradle index b609ec6..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 @@ -103,6 +86,8 @@ project.ext { classesDir = string("${jalviewDir}/${classes_dir}") + useClover = false + resourceClassesDir = classesDir testSourceDir = testDir @@ -113,10 +98,6 @@ project.ext { install4jApplicationName = "${jalview_name}" - def details = versionDetails() - gitHash = details.gitHash - gitBranch = details.branchName - println("Using a ${CHANNEL} profile.") additional_compiler_args = [] @@ -163,16 +144,18 @@ 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"]) + compileClasspath = files(sourceSets.main.java.outputDir) compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"]) runtimeClasspath = compileClasspath + runtimeClasspath += files(sourceSets.main.resources.srcDirs) } test { @@ -182,16 +165,33 @@ sourceSets { } resources { - srcDirs = sourceSets.main.resources.srcDirs + srcDirs = useClover ? sourceSets.clover.resources.srcDirs : sourceSets.main.resources.srcDirs } compileClasspath = files( sourceSets.test.java.outputDir ) - compileClasspath += sourceSets.main.compileClasspath + compileClasspath += useClover ? sourceSets.clover.compileClasspath : sourceSets.main.compileClasspath compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["**/*.jar"]) runtimeClasspath = compileClasspath + runtimeClasspath += files(sourceSets.test.resources.srcDirs) } + /* test { + java { + srcDirs testSourceDir + outputDir = file(testClassesDir) + } + + resources { + srcDirs = sourceSets.main.resources.srcDirs + } + + compileClasspath = files( sourceSets.test.java.outputDir ) + compileClasspath += sourceSets.main.compileClasspath + compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["** REMOVE_THIS_GAP /*.jar"]) + runtimeClasspath = compileClasspath + } +*/ } @@ -236,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}" @@ -345,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}" @@ -447,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) } @@ -498,7 +389,6 @@ task prepare { dependsOn buildResources dependsOn copyDocs dependsOn copyHelp - dependsOn convertMdFiles dependsOn buildIndices } @@ -615,6 +505,10 @@ jar { exclude "**/*.jar.*" inputs.dir(sourceSets.main.java.outputDir) + sourceSets.main.resources.srcDirs.each{ dir -> + inputs.dir(dir) + } + outputs.file("${outputDir}/${archiveFileName}") }