+ jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath()
+ jalviewDirRelativePath = jalviewDir
+
+ // local build environment properties
+ // can be "projectDir/local.properties"
+ def localProps = "${projectDir}/local.properties"
+ def propsFile = null;
+ if (file(localProps).exists()) {
+ propsFile = localProps
+ }
+ // or "../projectDir_local.properties"
+ def dirLocalProps = projectDir.getParent() + "/" + projectDir.getName() + "_local.properties"
+ if (file(dirLocalProps).exists()) {
+ propsFile = dirLocalProps
+ }
+ if (propsFile != null) {
+ try {
+ def p = new Properties()
+ def localPropsFIS = new FileInputStream(propsFile)
+ p.load(localPropsFIS)
+ localPropsFIS.close()
+ p.each {
+ key, val ->
+ def oldval = findProperty(key)
+ setProperty(key, val)
+ if (oldval != null) {
+ println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'")
+ } else {
+ println("Setting unknown property '${key}' with ${file(propsFile).getName()}s value '${val}'")
+ }
+ }
+ } catch (Exception e) {
+ System.out.println("Exception reading local.properties")
+ }
+ }
+
+ ////
+ // Import releaseProps from the RELEASE file
+ // or a file specified via JALVIEW_RELEASE_FILE if defined
+ // Expect jalview.version and target release branch in jalview.release
+ def releaseProps = new Properties();
+ def releasePropFile = findProperty("JALVIEW_RELEASE_FILE");
+ def defaultReleasePropFile = "${jalviewDirAbsolutePath}/RELEASE";
+ try {
+ (new File(releasePropFile!=null ? releasePropFile : defaultReleasePropFile)).withInputStream {
+ releaseProps.load(it)
+ }
+ } catch (Exception fileLoadError) {
+ throw new Error("Couldn't load release properties file "+(releasePropFile==null ? defaultReleasePropFile : "from custom location: releasePropFile"),fileLoadError);
+ }
+ ////
+ // Set JALVIEW_VERSION if it is not already set
+ if (findProperty(JALVIEW_VERSION)==null || "".equals(JALVIEW_VERSION)) {
+ JALVIEW_VERSION = releaseProps.get("jalview.version")
+ }
+
+ // this property set when running Eclipse headlessly
+ j2sHeadlessBuildProperty = string("net.sf.j2s.core.headlessbuild")
+ // this property set by Eclipse
+ eclipseApplicationProperty = string("eclipse.application")
+ // 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}'")
+ }
+ /-* *-/
+ if (false && IN_ECLIPSE) {
+ jalviewDir = jalviewDirAbsolutePath
+ }
+ */
+
+ // essentials
+ bareSourceDir = string(source_dir)
+ sourceDir = string("${jalviewDir}/${bareSourceDir}")
+ resourceDir = string("${jalviewDir}/${resource_dir}")
+ bareTestSourceDir = string(test_source_dir)
+ testSourceDir = string("${jalviewDir}/${bareTestSourceDir}")
+
+ // clover
+ cloverInstrDir = file("${buildDir}/${cloverSourcesInstrDir}")
+ cloverDb = string("${buildDir}/clover/clover.db")
+ classesDir = string("${jalviewDir}/${classes_dir}")
+ if (clover.equals("true")) {
+ use_clover = true
+ classesDir = string("${buildDir}/${cloverClassesDir}")
+ } else {
+ use_clover = false
+ classesDir = string("${jalviewDir}/${classes_dir}")
+ }
+
+ classes = classesDir
+
+ getdownWebsiteDir = string("${jalviewDir}/${getdown_website_dir}/${JAVA_VERSION}")