jalviewjsCoreClasslists = []
jalviewjsJalviewTemplateName = string(jalviewjs_name)
jalviewjsJ2sSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_settings}")
+ jalviewjsJ2sAltSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_alt_settings}")
jalviewjsJ2sProps = null
jalviewjsJ2sPlugin = jalviewjs_j2s_plugin
}
+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
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"
property(siteDirProperty,"${jalviewDirRelativePath}/${jalviewjsTransferSiteJsDir}")
}
}
- outputFile = jalviewjsJ2sSettingsFileName
+ outputFile = jalviewjsJ2sAltSettingsFileName
if (! IN_ECLIPSE) {
inputs.properties(jalviewjsJ2sProps)
- outputs.file(jalviewjsJ2sSettingsFileName)
+ outputs.file(jalviewjsJ2sAltSettingsFileName)
}
}
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")
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
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
if (eclipseWorkspace != null && file(eclipseWorkspace.getAbsolutePath()+"/.metadata").exists()) {
delete file(eclipseWorkspace.getAbsolutePath()+"/.metadata")
}
- delete "${jalviewDir}/${jalviewjs_j2s_settings}"
+ delete jalviewjsJ2sAltSettingsFileName
}
outputs.upToDateWhen( { false } )
eclipse_bin_dir = bin
eclipse_debug = false
+## IMPORTANT for headless build
+# to enable `gradle jalviewjs` headless build you MUST set
+# j2s.config.altfileproperty = org.jalview.jalviewjsj2sfilename
+# (or set to whatever value jalviewjs_j2s_alt_file_property is set to)
+# in your ./.j2s file
+# OR run the task `gradle jalviewjsEnableAltFileProperty` to do that for you (before headless build task)
+jalviewjs_j2s_alt_file_property = org.jalview.jalviewjsj2sfilename
+jalviewjs_j2s_alt_settings = build/jalviewjs/config/j2s
+
+# these are used for actual .j2s file to pass on to alt j2s file
+jalviewjs_j2s_settings = .j2s
+jalviewjs_j2s_alt_file_property_config = j2s.config.altfileproperty
+
# for developing in Eclipse as IDE, set this to automatically copy current swingjs/net.sf.j2s.core.jar to your dropins dir
jalviewjs_eclipseIDE_auto_copy_j2s_plugin = false
# Override this in a local.properties file
jalviewjs_libjs_dir = utils/jalviewjs/libjs
jalviewjs_site_resource_dir = utils/jalviewjs/site-resources
jalviewjs_classlists_dir = utils/jalviewjs/classlists
-jalviewjs_j2s_settings = .j2s
+jalviewjs_classlist_jalview = utils/jalviewjs/_j2sclasslist.txt
#jalviewjs_eclipse_workspace = ~/tmp/eclipse-workspace
# these 3 files/dirs found in build/jalviewjs
jalviewjs_eclipse_tmp_dropins_dir = eclipse_dropins