From: Ben Soares Date: Mon, 11 Nov 2019 17:17:36 +0000 (+0000) Subject: JAL-3210 Better ustEclipse IDE/CLI refinements X-Git-Tag: Release_2_11_4_0~45^2~18^2~63 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6135e98f5282eef6240642fef5688fc70af33e31;p=jalview.git JAL-3210 Better ustEclipse IDE/CLI refinements --- diff --git a/build.gradle b/build.gradle index ed026ef..5dd64df 100644 --- a/build.gradle +++ b/build.gradle @@ -69,12 +69,19 @@ ext { j2sHeadlessBuildProperty = string("net.sf.j2s.core.headlessbuild") // this property set by Eclipse eclipseApplicationProperty = string("eclipse.application") - // CHECK IF IN ECLIPSE - IN_ECLIPSE = System.properties[eclipseApplicationProperty].startsWith("org.eclipse.ui.") - if (System.properties[j2sHeadlessBuildProperty].equals("true")) { // headless build property has been set + // CHECK IF RUNNING FROM WITHIN ECLIPSE + def eclipseApplicationPropertyVal = System.properties[eclipseApplicationProperty] + IN_ECLIPSE = eclipseApplicationPropertyVal != null && eclipseApplicationPropertyVal.startsWith("org.eclipse.ui.") + // BUT WITHOUT THE HEADLESS BUILD PROPERTY SET + if (System.properties[j2sHeadlessBuildProperty].equals("true")) { println("Setting IN_ECLIPSE to ${IN_ECLIPSE} as System.properties['${j2sHeadlessBuildProperty}'] == '${System.properties[j2sHeadlessBuildProperty]}'") IN_ECLIPSE = false } + if (IN_ECLIPSE) { + println("WITHIN ECLIPSE IDE") + } else { + println("HEADLESS BUILD") + } /* System.properties.sort { it.key }.each { key, val -> println("SYSTEM PROPERTY ${key}='${val}'") @@ -278,11 +285,16 @@ ext { relativeBuildDir = file(jalviewDirAbsolutePath).toPath().relativize(buildDir.toPath()) jalviewjsBuildDir = string("${relativeBuildDir}/jalviewjs") jalviewjsSiteDir = string("${jalviewjsBuildDir}/${jalviewjs_site_dir}") - jalviewjsTransferSiteJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_js") + if (IN_ECLIPSE) { + jalviewjsTransferSiteJsDir = string(jalviewjsSiteDir) + } else { + jalviewjsTransferSiteJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_js") + } jalviewjsTransferSiteLibDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_lib") jalviewjsTransferSiteSwingJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_swingjs") jalviewjsTransferSiteCoreDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_core") - jalviewjsJalviewCoreName = jalviewjs_core_name + jalviewjsJalviewCoreHtmlFile = string("") + jalviewjsJalviewCoreName = string(jalviewjs_core_name) jalviewjsJalviewTemplateName = string(jalviewjs_name) eclipseWorkspace = null @@ -495,8 +507,11 @@ eclipse { } // jdt - synchronizationTasks "eclipseSynchronizationTask" - autoBuildTasks "eclipseAutoBuildTask" + if (IN_ECLIPSE) { + // Don't want these to be activated if in headless build + synchronizationTasks "eclipseSynchronizationTask" + autoBuildTasks "eclipseAutoBuildTask" + } } @@ -1748,6 +1763,9 @@ task jalviewjsTranspile(type: Exec) { args += "-debug" } args += [ "--launcher.appendVmargs", "-vmargs", "-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}" ] + if (!IN_ECLIPSE) { + args += [ "-D${j2sHeadlessBuildProperty}=true" ] + } def stdout def stderr @@ -1876,7 +1894,10 @@ def jalviewjsCallCore(FileCollection list, String prefixFile, String suffixFile, } -task jalviewjsNoTranspileBuildAllCores { +task jalviewjsBuildAllCores { + group "JalviewJS" + description "Build the core js lib closures listed in the classlists dir" + dependsOn jalviewjsTranspile dependsOn jalviewjsTransferUnzipSwingJs def j2sDir = "${jalviewDir}/${jalviewjsTransferSiteJsDir}/${jalviewjs_j2s_subdir}" @@ -1955,7 +1976,7 @@ task jalviewjsNoTranspileBuildAllCores { def logOutFile = file("${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_j2s_closure_stdout}") logOutFile.getParentFile().mkdirs() logOutFile.createNewFile() - logOutFile.write(getDate("yyyy-MM-dd HH:mm:ss")+" jalviewjsNoTranspileBuildAllCores\n----\n") + logOutFile.write(getDate("yyyy-MM-dd HH:mm:ss")+" jalviewjsBuildAllCores\n----\n") classlists.each { jalviewjsCallCore(it.list, prefixFile, suffixFile, it.jsfile, it.zjsfile, logOutFile, jalviewjs_j2s_to_console.equals("true")) @@ -1965,20 +1986,8 @@ task jalviewjsNoTranspileBuildAllCores { } -jalviewjsNoTranspileBuildAllCores.mustRunAfter jalviewjsTranspile - - -task jalviewjsBuildAllCores { - group "JalviewJS" - description "Build the core js lib closures listed in the classlists dir" - dependsOn jalviewjsTranspile - dependsOn jalviewjsNoTranspileBuildAllCores -} - - -def jalviewjsJalviewCoreHtmlFile -task jalviewjsNoTranspilePublishCoreTemplate(type: Sync) { - dependsOn jalviewjsNoTranspileBuildAllCores +task jalviewjsPublishCoreTemplate(type: Sync) { + dependsOn jalviewjsBuildAllCores def inputFile = file("${jalviewDir}/${j2s_template_html}") def outputDir = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}" @@ -1998,7 +2007,7 @@ task jalviewjsNoTranspilePublishCoreTemplate(type: Sync) { beginToken: '_', endToken: '_', tokens: [ - 'MAIN': '"'+mainClass+'"', + 'MAIN': '"'+mainClassName+'"', 'CODE': "null", 'NAME': jalviewjsJalviewTemplateName ] @@ -2018,15 +2027,9 @@ task jalviewjsNoTranspilePublishCoreTemplate(type: Sync) { } -task jalviewjsPublishCoreTemplate { - dependsOn jalviewjsTranspile +task jalviewjsSyncCore (type: Sync) { + dependsOn jalviewjsBuildAllCores dependsOn jalviewjsPublishCoreTemplate -} - - -task jalviewjsNoTranspileSyncCore (type: Sync) { - dependsOn jalviewjsNoTranspileBuildAllCores - dependsOn jalviewjsNoTranspilePublishCoreTemplate def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteCoreDir}") def outputDir = "${jalviewDir}/${jalviewjsSiteDir}" @@ -2045,13 +2048,6 @@ task jalviewjsNoTranspileSyncCore (type: Sync) { } -task jalviewjsSyncCore (type: Sync) { - dependsOn jalviewjsTranspile - dependsOn jalviewjsNoTranspileSyncCore - dependsOn "jalviewjsBuildAllCores" -} - - // this Copy version of TransferSiteJs will delete anything else in the target dir task jalviewjsCopyTransferSiteJs(type: Copy) { dependsOn jalviewjsTranspile @@ -2061,7 +2057,7 @@ task jalviewjsCopyTransferSiteJs(type: Copy) { // this Sync version of TransferSite is used by buildship to keep the website automatically up to date when a file changes -task jalviewjsNoTranspileSyncTransferSiteJs(type: Sync) { +task jalviewjsSyncTransferSiteJs(type: Sync) { from "${jalviewDir}/${jalviewjsTransferSiteJsDir}" include "**/*.*" into "${jalviewDir}/${jalviewjsSiteDir}" @@ -2070,24 +2066,16 @@ task jalviewjsNoTranspileSyncTransferSiteJs(type: Sync) { } } + jalviewjsSyncAllLibs.mustRunAfter jalviewjsCopyTransferSiteJs jalviewjsSyncResources.mustRunAfter jalviewjsCopyTransferSiteJs jalviewjsSyncSiteResources.mustRunAfter jalviewjsCopyTransferSiteJs jalviewjsSyncBuildProperties.mustRunAfter jalviewjsCopyTransferSiteJs -jalviewjsSyncAllLibs.mustRunAfter jalviewjsNoTranspileSyncTransferSiteJs -jalviewjsSyncResources.mustRunAfter jalviewjsNoTranspileSyncTransferSiteJs -jalviewjsSyncSiteResources.mustRunAfter jalviewjsNoTranspileSyncTransferSiteJs -jalviewjsSyncBuildProperties.mustRunAfter jalviewjsNoTranspileSyncTransferSiteJs - - -task jalviewjsNoTranspilePrepareSite { - dependsOn jalviewjsSyncAllLibs - dependsOn jalviewjsSyncResources - dependsOn jalviewjsSyncSiteResources - dependsOn jalviewjsSyncBuildProperties - dependsOn jalviewjsNoTranspileSyncCore -} +jalviewjsSyncAllLibs.mustRunAfter jalviewjsSyncTransferSiteJs +jalviewjsSyncResources.mustRunAfter jalviewjsSyncTransferSiteJs +jalviewjsSyncSiteResources.mustRunAfter jalviewjsSyncTransferSiteJs +jalviewjsSyncBuildProperties.mustRunAfter jalviewjsSyncTransferSiteJs task jalviewjsPrepareSite { @@ -2216,10 +2204,20 @@ task jalviewjsIDE_j2sFile { } -task jalviewjsIDE_BuildAllCores { +task jalviewjsIDE_SyncCore { group "00 JalviewJS in Eclipse" - description "Build the core js lib closures listed in the classlists dir" - dependsOn jalviewjsNoTranspileBuildAllCores + description "Build the core js lib closures listed in the classlists dir and publish core html from template" + dependsOn jalviewjsSyncCore +} + + +task jalviewjsIDE_PrepareSite { + group "00 JalviewJS in Eclipse" + description "Sync libs and resources to site dir, but not closure cores" + dependsOn jalviewjsSyncAllLibs + dependsOn jalviewjsSyncResources + dependsOn jalviewjsSyncSiteResources + dependsOn jalviewjsSyncBuildProperties } @@ -2227,7 +2225,7 @@ task jalviewjsIDE_AssembleSite { group "00 JalviewJS in Eclipse" description "Assembles the Eclipse transpiled site and unzips supporting zipfiles" dependsOn jalviewjsIDE_CopyTransferSiteJs - dependsOn jalviewjsNoTranspilePrepareSite + dependsOn jalviewjsPrepareSite } @@ -2254,8 +2252,7 @@ task eclipseSynchronizationTask { // buildship runs this at build time task eclipseAutoBuildTask { - dependsOn jalviewjsNoTranspileSyncTransferSiteJs - dependsOn jalviewjsNoTranspilePrepareSite + dependsOn jalviewjsIDE_PrepareSite }