X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=180d4ad0b3e5a8b28c3589af2a8cfa1c0856053b;hb=7b64243974c397a651fab57090dba203b332e406;hp=0be087f0e18c3883ef9f7e18e1732aaf87d396ec;hpb=762f874a3fb43e5b56250a33154d3f37872360b8;p=jalview.git diff --git a/build.gradle b/build.gradle index 0be087f..180d4ad 100644 --- a/build.gradle +++ b/build.gradle @@ -110,7 +110,7 @@ ext { } //// // Set JALVIEW_VERSION if it is not already set - if (findProperty(JALVIEW_VERSION)==null || "".equals(JALVIEW_VERSION)) { + if (findProperty("JALVIEW_VERSION")==null || "".equals(JALVIEW_VERSION)) { JALVIEW_VERSION = releaseProps.get("jalview.version") } @@ -457,10 +457,10 @@ ext { jalviewjsTransferSiteSwingJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_swingjs") jalviewjsTransferSiteCoreDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_core") jalviewjsJalviewCoreHtmlFile = string("") - jalviewjsJalviewCoreName = string(jalviewjs_core_name) jalviewjsCoreClasslists = [] jalviewjsJalviewTemplateName = string(jalviewjs_name) jalviewjsJ2sSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_settings}") + jalviewjsJ2sAltSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_alt_settings}") jalviewjsJ2sProps = null jalviewjsJ2sPlugin = jalviewjs_j2s_plugin @@ -1976,6 +1976,33 @@ task j2sSetHeadlessBuild { } +task jalviewjsEnableAltFileProperty(type: WriteProperties) { + group "jalviewjs" + description "Enable the alternative J2S Config file for headless build" + + outputFile = jalviewjsJ2sSettingsFileName + def j2sPropsFile = file(jalviewjsJ2sSettingsFileName) + def j2sProps = new Properties() + if (j2sPropsFile.exists()) { + try { + def j2sPropsFileFIS = new FileInputStream(j2sPropsFile) + j2sProps.load(j2sPropsFileFIS) + j2sPropsFileFIS.close() + + j2sProps.each { prop, val -> + property(prop, val) + } + } catch (Exception e) { + println("Exception reading ${jalviewjsJ2sSettingsFileName}") + e.printStackTrace() + } + } + if (! j2sProps.stringPropertyNames().contains(jalviewjs_j2s_alt_file_property_config)) { + property(jalviewjs_j2s_alt_file_property_config, jalviewjs_j2s_alt_file_property) + } +} + + task jalviewjsSetEclipseWorkspace { def propKey = "jalviewjs_eclipse_workspace" def propVal = null @@ -2188,7 +2215,7 @@ task jalviewjsTransferUnzipAllLibs { task jalviewjsCreateJ2sSettings(type: WriteProperties) { group "JalviewJS" - description "Create the .j2s file from the j2s.* properties" + description "Create the alternative j2s file from the j2s.* properties" jalviewjsJ2sProps = project.properties.findAll { it.key.startsWith("j2s.") }.sort { it.key } def siteDirProperty = "j2s.site.directory" @@ -2207,11 +2234,11 @@ task jalviewjsCreateJ2sSettings(type: WriteProperties) { property(siteDirProperty,"${jalviewDirRelativePath}/${jalviewjsTransferSiteJsDir}") } } - outputFile = jalviewjsJ2sSettingsFileName + outputFile = jalviewjsJ2sAltSettingsFileName if (! IN_ECLIPSE) { inputs.properties(jalviewjsJ2sProps) - outputs.file(jalviewjsJ2sSettingsFileName) + outputs.file(jalviewjsJ2sAltSettingsFileName) } } @@ -2327,6 +2354,7 @@ task jalviewjsProjectImport(type: Exec) { 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" ] + args += [ "-D${jalviewjs_j2s_alt_file_property}=${jalviewjsJ2sAltSettingsFileName}" ] } inputs.file("${jalviewDir}/.project") @@ -2340,6 +2368,9 @@ task jalviewjsTranspile(type: Exec) { dependsOn jalviewjsEclipseSetup dependsOn jalviewjsProjectImport dependsOn jalviewjsEclipsePaths + if (!IN_ECLIPSE) { + dependsOn jalviewjsEnableAltFileProperty + } doFirst { // do not run a headless transpile when we claim to be in Eclipse @@ -2359,6 +2390,7 @@ task jalviewjsTranspile(type: Exec) { 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" ] + args += [ "-D${jalviewjs_j2s_alt_file_property}=${jalviewjsJ2sAltSettingsFileName}" ] } def stdout @@ -2523,10 +2555,6 @@ task jalviewjsBuildAllCores { ] } - // _jmol and _jalview cores. Add any other peculiar classlist.txt files here - //classlistFiles += [ 'file': file("${jalviewDir}/${jalviewjs_classlist_jmol}"), 'name': "_jvjmol" ] - classlistFiles += [ 'file': file("${jalviewDir}/${jalviewjs_classlist_jalview}"), 'name': jalviewjsJalviewCoreName ] - jalviewjsCoreClasslists = [] classlistFiles.each { @@ -2549,8 +2577,8 @@ task jalviewjsBuildAllCores { } def list = fileTree(dir: j2sDir, includes: filelist) - def jsfile = "${outputDir}/core${name}.js" - def zjsfile = "${outputDir}/core${name}.z.js" + def jsfile = "${outputDir}/core_${name}.js" + def zjsfile = "${outputDir}/core_${name}.z.js" jalviewjsCoreClasslists += [ 'jsfile': jsfile, @@ -2565,21 +2593,8 @@ task jalviewjsBuildAllCores { outputs.file(zjsfile) } - // _stevesoft core. add any cores without a classlist here (and the inputs and outputs) - def stevesoftClasslistName = "_stevesoft" - def stevesoftClasslist = [ - 'jsfile': "${outputDir}/core${stevesoftClasslistName}.js", - 'zjsfile': "${outputDir}/core${stevesoftClasslistName}.z.js", - 'list': fileTree(dir: j2sDir, include: "com/stevesoft/pat/**/*.js"), - 'name': stevesoftClasslistName - ] - jalviewjsCoreClasslists += stevesoftClasslist - inputs.files(stevesoftClasslist['list']) - outputs.file(stevesoftClasslist['jsfile']) - outputs.file(stevesoftClasslist['zjsfile']) - // _all core - def allClasslistName = "_all" + def allClasslistName = "all" def allJsFiles = fileTree(dir: j2sDir, include: "**/*.js") allJsFiles += fileTree( dir: libJ2sDir, @@ -2602,8 +2617,8 @@ task jalviewjsBuildAllCores { ] ) def allClasslist = [ - 'jsfile': "${outputDir}/core${allClasslistName}.js", - 'zjsfile': "${outputDir}/core${allClasslistName}.z.js", + 'jsfile': "${outputDir}/core_${allClasslistName}.js", + 'zjsfile': "${outputDir}/core_${allClasslistName}.z.js", 'list': allJsFiles, 'name': allClasslistName ] @@ -2843,7 +2858,7 @@ task cleanJalviewjsAll { if (eclipseWorkspace != null && file(eclipseWorkspace.getAbsolutePath()+"/.metadata").exists()) { delete file(eclipseWorkspace.getAbsolutePath()+"/.metadata") } - delete "${jalviewDir}/${jalviewjs_j2s_settings}" + delete jalviewjsJ2sAltSettingsFileName } outputs.upToDateWhen( { false } ) @@ -2861,10 +2876,25 @@ task jalviewjsIDE_checkJ2sPlugin { if (eclipseHome == null || ! IN_ECLIPSE) { throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. Skipping J2S Plugin Check.") } - def eclipseJ2sPlugin = "${eclipseHome}/dropins/${j2sPluginFile.getName()}" - def eclipseJ2sPluginFile = file(eclipseJ2sPlugin) - if (!eclipseJ2sPluginFile.exists()) { - def msg = "Eclipse J2S Plugin is not installed (could not find '${eclipseJ2sPlugin}')\nTry running task jalviewjsIDE_copyJ2sPlugin" + def eclipseJ2sPluginDirs = [ "${eclipseHome}/dropins" ] + def altPluginsDir = System.properties["org.eclipse.equinox.p2.reconciler.dropins.directory"] + if (altPluginsDir != null && file(altPluginsDir).exists()) { + eclipseJ2sPluginDirs += altPluginsDir + } + def foundPlugin = false + def j2sPluginFileName = j2sPluginFile.getName() + def eclipseJ2sPlugin + def eclipseJ2sPluginFile + eclipseJ2sPluginDirs.any { dir -> + eclipseJ2sPlugin = "${dir}/${j2sPluginFileName}" + eclipseJ2sPluginFile = file(eclipseJ2sPlugin) + if (eclipseJ2sPluginFile.exists()) { + foundPlugin = true + return true + } + } + if (!foundPlugin) { + def msg = "Eclipse J2S Plugin is not installed (could not find '${j2sPluginFileName}' in\n"+eclipseJ2sPluginDirs.join("\n")+"\n)\nTry running task jalviewjsIDE_copyJ2sPlugin" System.err.println(msg) throw new StopExecutionException(msg) } @@ -2882,7 +2912,7 @@ task jalviewjsIDE_checkJ2sPlugin { System.err.println(msg) throw new StopExecutionException(msg) } else { - def msg = "Eclipse J2S Plugin is the same as '${j2sPlugin}' (this is good)" + def msg = "Eclipse J2S Plugin '${eclipseJ2sPlugin}' is the same as '${j2sPlugin}' (this is good)" println(msg) } }