cdd / bioassay-template

Other
7 stars 2 forks source link

Issue #110: load properties from build.properties; optionally build for JDK 1.8 or JDK 11. #112

Closed kodecharlie closed 5 years ago

kodecharlie commented 5 years ago

This is a 1st draft of how we will resolve compilation for either Java 1.8 or Java 11. Changes to build.xml assume the existence of build.properties. Latter file has these contents on my setup:

jdk.version=jdk1.8
jfx.module.home=/opt/local/javafx-sdk-11.0.1/lib

If we approve these changes, then we will need to install the JFX module for Java 11 on the server responsible for building / testing WIP-PRs; I am using the JFX module from openjfx.io, which is available here (yes, it's downloaded from a different domain). As well, we will need to create said build.properties for that environment; it must reside in the same place as build.xml.

I am now testing this approach for Java 11 builds within a more recent snapshot for Eclipse that supports Java 11.

gedeck commented 5 years ago

Circle-CI fails here:

#!/bin/bash -eo pipefail
cd ~/bax; ant clean junit check pkg pkgAPI
Picked up _JAVA_OPTIONS: -Xms512m -Xmx3072m
Buildfile: /home/circleci/bax/build.xml

clean:
   [delete] Deleting directory /home/circleci/bax/bin
   [delete] Deleting directory /home/circleci/bax/pkg

check:
[bax_checkstyle] Running Checkstyle 8.4 on 45 files

init:
    [mkdir] Created dir: /home/circleci/bax/bin
    [mkdir] Created dir: /home/circleci/bax/pkg

build:

build-jdk11:

build-jdk1.8:
     [copy] Copying 1 file to /home/circleci/bax/bin

test-compile:
    [mkdir] Created dir: /home/circleci/bax/build/test

test-compile-jdk11:

test-compile-jdk1.8:
     [copy] Copying 13 files to /home/circleci/bax/build/test

junit:
    [junit] Running com.cdd.bao.axioms.ScanAxiomsTest
    [junit] Testsuite: com.cdd.bao.axioms.ScanAxiomsTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
    [junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
    [junit] 
    [junit] Null Test:  Caused an ERROR
    [junit] com.cdd.bao.axioms.ScanAxiomsTest
    [junit] java.lang.ClassNotFoundException: com.cdd.bao.axioms.ScanAxiomsTest
    [junit]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    [junit]     at java.lang.Class.forName0(Native Method)
    [junit]     at java.lang.Class.forName(Class.java:348)
    [junit] 
    [junit] 

BUILD FAILED
/home/circleci/bax/build.xml:205: Test com.cdd.bao.axioms.ScanAxiomsTest failed
gedeck commented 5 years ago

I guess the failure is linked to the missing properties file.

Can you add two property files to the PR so that we can either compile for JDK8 or JDK11? Ideally, you could also extend the circleci config file (https://github.com/cdd/bioassay-template/blob/master/.circleci/config.yml) to prepare jar files for both targets.

CircleCI allows to rerun with the possibility to ssh into the build machine. That helps to work on the config file.

kodecharlie commented 5 years ago

If we have a single build.properties in the repo, can you programmatically change one of the properties declared therein from CircleCI ?

gedeck commented 5 years ago

What about having the following files:

the build.xml has a property with the value build.properties. The property value is used to load the actual property file. If a build is required for a different environment, the value can be overwritten using a -D argument.

gedeck commented 5 years ago

Would it work to add the javafx library to the lib path?

Maybe it's time to consider using a package manager like maven to handle our dependencies.

aclarkxyz commented 5 years ago

(1) I tried that separately and everything worked, except launching from Eclipse (2) I'll paraphrase Larry Wall on this one: I'm totally OK with switching to Maven, as long as it's after I'm dead.

kodecharlie commented 5 years ago

Regarding the launch from Eclipse: after I installed JDK 11, I had to change eclipse.ini to coerce Eclipse JVM explicitly to launch with JVM 1.8. In my case (OSX), the file was in /Applications/Eclipse.app/Contents/Eclipse/eclipse.ini, and the change is shown below in the line following -vm:

-startup
../Eclipse/plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
../Eclipse/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.551.v20171108-1834
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
--add-modules=ALL-SYSTEM
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts