stuckyb / ontopilot

15 stars 2 forks source link

Java-only distribution #50

Closed stuckyb closed 7 years ago

stuckyb commented 7 years ago

It would be really cool to distribute ontobuilder in a way that required nothing more than the JRE on users' computers. E.g., it might be possible to compile all of the Jython code to Java classes and distribute the whole package as a jar file.

jdeck88 commented 7 years ago

That could be really useful, assuming its not too much trouble!

On Mon, Mar 6, 2017 at 11:40 AM, stuckyb notifications@github.com wrote:

It would be really cool to distribute ontobuilder in a way that required nothing more than the JRE on users' computers. E.g., it might be possible to compile all of the Jython code to Java classes and distribute the whole package as a jar file.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stuckyb/ontobuilder/issues/50, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGdxVzfkSN0OvylF4klk0v7CPQd8SMgks5rjGEdgaJpZM4MUmUB .

-- John Deck (541) 914-4739

Annhiluc commented 7 years ago

Following this repository: https://github.com/jsbruneau/jython-selfcontained-jar/

It should allow for all the file structure to remain the same.

stuckyb commented 7 years ago

Just took a first look at the "jar_creation" branch. Looking good! One bug I noticed -- if you execute the OntoApp jar file without any command-line arguments, it dies with an "IndexError: index out of range: 0" exception. I haven't investigated it any further.

stuckyb commented 7 years ago

Command-line argument parsing is proving to be a roadblock. To document the behavior in the different execution contexts, here are the results of invoking OntoPilot three different ways:

  1. Using an installed jython environment.
    • Launch command: $ jython python-src/bin/ontopilot_main.py
    • sys.argv: ['python-src/bin/ontopilot_main.py']
    • Console output: Unable to load the project configuration file.
  2. Using standalone jython JAR runtime environment.
    • Launch command: $ java -jar java-lib/jython-full.jar python-src/bin/ontopilot_main.py
    • sys.argv: ['python-src/bin/ontopilot_main.py']
    • Console outut: Unknown build target: "python-src/bin/ontopilot_main.py".
  3. Using single-JAR package (jython + OntoPilot in a single JAR file).
    • Launch command: $ java -jar dist/OntoApp.jar
    • sys.argv: []
    • Console output: IndexError: index out of range: 0

The console output of (1) is correct. Why (2) produces different output is not clear, since the value of the argument list is identical. (3) looks like a pain (as @Annhiluc already discovered) since the interpretation of sys.argv would have to be different.

The most important goal is to develop a distribution that doesn't require Jython installation as a prerequisite. Either option (2) or option (3) would achieve that, so for now, we should probably go with whichever is easiest to get working, while preserving the ability to run OntoPilot as in option (1).

stuckyb commented 7 years ago

Thanks to commit 55e0d8904e98af4543aa4add1e81a339e617b263, argument parsing in all 3 runtime contexts is now working. The incorrect console output in option (2) in the previous comment was evidently caused by a malfunctioning Jython JAR file; this file was updated in commit 55e0d8904e98af4543aa4add1e81a339e617b263.

stuckyb commented 7 years ago

Done!