From a4c440c39fc37f9b8168f9c8766f7adaf9fec0eb Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Mon, 4 Nov 2019 12:21:41 +0000 Subject: [PATCH] JAL-3210 added a 'transfer' dir for unzip files to improve incremental site-building when using Eclipse as IDE --- build.gradle | 56 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index 902b896..2682208 100644 --- a/build.gradle +++ b/build.gradle @@ -1274,12 +1274,14 @@ task helppages { def jalviewjsBuildDir def jalviewjsSiteDir -def jalviewjsTransferSiteDir +def jalviewjsTransferSiteJSDir +def jalviewjsTransferSiteLibDir task jalviewjsSitePath { def relativeBuildDir = file(jalviewDirAbsolutePath).toPath().relativize(buildDir.toPath()) jalviewjsBuildDir = "${relativeBuildDir}/jalviewjs" jalviewjsSiteDir = "${jalviewjsBuildDir}/${jalviewjs_site_dir}" - jalviewjsTransferSiteDir = "${jalviewjsBuildDir}/tmp/site" + jalviewjsTransferSiteJSDir = "${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_js" + jalviewjsTransferSiteLibDir = "${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_lib" } def eclipseWorkspace @@ -1458,7 +1460,8 @@ y jalviewjsEclipseCopyDropins.finalizedBy jalviewjsCleanEclipse */ -task jalviewjsUnzipFiles { +def jalviewjsTransferSiteUnzipDir +task jalviewjsTransferUnzipLib { dependsOn jalviewjsSitePath def zipFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_libjs_dir}", include: "*.zip") @@ -1468,13 +1471,13 @@ task jalviewjsUnzipFiles { zipFiles.each { file_zip -> copy { from zipTree(file_zip) - into "${jalviewDir}/${jalviewjsSiteDir}" + into "${jalviewDir}/${jalviewjsTransferSiteLibDir}" } } } inputs.files zipFiles - outputs.dir "${jalviewDir}/${jalviewjsSiteDir}" + outputs.dir "${jalviewDir}/${jalviewjsTransferSiteLibDir}" } task jalviewjsCreateJ2sSettings(type: WriteProperties) { @@ -1491,14 +1494,14 @@ task jalviewjsCreateJ2sSettings(type: WriteProperties) { if (val != null) { if (prop == siteDirProperty) { if (!(val.startsWith('/') || val.startsWith("file://") )) { - val = "${jalviewDir}/${jalviewjsTransferSiteDir}/${val}" + val = "${jalviewDir}/${jalviewjsTransferSiteJSDir}/${val}" } setSiteDir = true } property(prop,val) } if (!setSiteDir) { // default site location, don't override specifically set property - property(siteDirProperty,"${jalviewDir}/${jalviewjsTransferSiteDir}") + property(siteDirProperty,"${jalviewDir}/${jalviewjsTransferSiteJSDir}") } } inputs.properties(j2s_props) @@ -1511,6 +1514,26 @@ task jalviewjsEclipseSetup { dependsOn jalviewjsCreateJ2sSettings } +task jalviewjsSyncLib (type: Sync) { + dependsOn jalviewjsSitePath + dependsOn jalviewjsTransferUnzipLib + def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteLibDir}") + def outputDir = "${jalviewDir}/${jalviewjsSiteDir}" + + from inputFiles + into outputDir + def outputFiles = [] + rename { filename -> + outputFiles += "${outputDir}/${filename}" + null + } + preserve { + include "**" + } + outputs.files outputFiles + inputs.files inputFiles +} + task jalviewjsSyncResources (type: Sync) { dependsOn jalviewjsSitePath def inputFiles = fileTree(dir: "${jalviewDir}/${resourceDir}") @@ -1631,19 +1654,19 @@ DEBUG: ${eclipseDebug} } inputs.dir("${jalviewDir}/${sourceDir}") - outputs.dir("${jalviewDir}/${jalviewjsTransferSiteDir}") - outputs.upToDateWhen( { file("${jalviewDir}/${jalviewjsTransferSiteDir}${jalviewjs_server_resource}").exists() } ) + outputs.dir("${jalviewDir}/${jalviewjsTransferSiteJSDir}") + outputs.upToDateWhen( { file("${jalviewDir}/${jalviewjsTransferSiteJSDir}${jalviewjs_server_resource}").exists() } ) } task jalviewjsCopyTransferSite(type: Copy) { dependsOn jalviewjsTranspile - from "${jalviewDir}/${jalviewjsTransferSiteDir}" + from "${jalviewDir}/${jalviewjsTransferSiteJSDir}" into "${jalviewDir}/${jalviewjsSiteDir}" } // this Sync version is used by buildship to keep the website automatically up to date when a file changes task jalviewjsSyncTransferSite(type: Sync) { - from "${jalviewDir}/${jalviewjsTransferSiteDir}" + from "${jalviewDir}/${jalviewjsTransferSiteJSDir}" include "**/*.*" into "${jalviewDir}/${jalviewjsSiteDir}" preserve { @@ -1651,19 +1674,18 @@ task jalviewjsSyncTransferSite(type: Sync) { } } -jalviewjsUnzipFiles.mustRunAfter jalviewjsCopyTransferSite +jalviewjsSyncLib.mustRunAfter jalviewjsCopyTransferSite jalviewjsSyncResources.mustRunAfter jalviewjsCopyTransferSite jalviewjsSyncSiteResources.mustRunAfter jalviewjsCopyTransferSite -jalviewjsUnzipFiles.mustRunAfter jalviewjsSyncTransferSite +jalviewjsSyncLib.mustRunAfter jalviewjsSyncTransferSite jalviewjsSyncResources.mustRunAfter jalviewjsSyncTransferSite jalviewjsSyncSiteResources.mustRunAfter jalviewjsSyncTransferSite task jalviewjsPrepareSite { group "JalviewJS" description "Prepares the website folder including unzipping files and copying resources" - dependsOn jalviewjsSitePath - dependsOn jalviewjsUnzipFiles + dependsOn jalviewjsSyncLib dependsOn jalviewjsSyncResources dependsOn jalviewjsSyncSiteResources } @@ -1677,7 +1699,7 @@ task jalviewjsBuildSite { task cleanJalviewjsSite { doFirst { - delete "${jalviewDir}/${jalviewjsTransferSiteDir}" + delete "${jalviewDir}/${jalviewjsTransferSiteJSDir}" delete "${jalviewDir}/${jalviewjsSiteDir}" } } @@ -1766,7 +1788,7 @@ task jalviewjs { task jalviewjsIDE_CopyTransferSite(type: Copy) { - from "${jalviewDir}/${jalviewjsTransferSiteDir}" + from "${jalviewDir}/${jalviewjsTransferSiteJSDir}" into "${jalviewDir}/${jalviewjsSiteDir}" } -- 1.7.10.2