TheInfiniteKind / appbundler

72 stars 24 forks source link

Revert "Remove unnecessary global static state" #46

Closed rschmunk closed 5 years ago

rschmunk commented 5 years ago

Commit dd16fd6 made on Bitbucket and included here as part of a commit on May 31 causes a doubled set of command-line arguments to be passed the second time that launch is called. See for example the logs included in Issues #44 and #45.

rschmunk commented 5 years ago

Multiple commits of my fork included in this PR. The main thing is the "Revert "Remove unnecessary global static state"" commit. The subsequent updates are because in the past, appbundler did not print isDebugging log msgs until the second time that launch was called. I'm trying to re-instate that, but haven't figured out yet why debugging msgs are getting logged during the first call.

joewiz commented 5 years ago

@sreilly Could you please review and merge this? I'd like to get the fix into the maven build and eXist as soon as possible.

rschmunk commented 5 years ago

@joewiz, What sort of (or how much) logging output do you see if you enable isDebugging while using this? I am encountering differences, which I am guessing is because of different macOS and Xcode versions.

joewiz commented 5 years ago

@msdsoftware Sorry, I'm not sure how to "enable isDebugging". Guessing that it's via a -disDebugging=true property, the app fails much as before:

$ /Users/joe/workspace/exist/dist/eXist-db.app/Contents/MacOS/eXist-JavaAppLauncher -DisDebugging=true

Loading Application 'eXist-db'
Working Directory: '/Users/joe'
Searching for a JRE.
Searching for a Java 8
JRE search exception: 'launch path not accessible'
No matching JRE found.
Found a Java 8.jdk JDK
Looks like major version 8
JDK version qualifies
Java Runtime Dylib Path: '/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib'
Launchpath: /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib
Main Bundle Path: '/Users/joe/workspace/exist/dist/eXist-db.app'
Main Class Name: 'org.exist.start.Main'
Option: -Dexist.home=/Users/joe/workspace/exist/dist/eXist-db.app/Contents/Resources/eXist-db
Option: -Xdock:name=eXist-db
Command line passed to application:
Arg 0: '/Users/joe/workspace/exist/dist/eXist-db.app/Contents/MacOS/eXist-JavaAppLauncher'
Arg 1: '-Djava.library.path=/Users/joe/workspace/exist/dist/eXist-db.app/Contents/MacOS'
Arg 2: '-Djava.class.path=/Users/joe/workspace/exist/dist/eXist-db.app/Contents/Java/Classes:/Users/joe/workspace/exist/dist/eXist-db.app/Contents/Java/start.jar'
Arg 3: '-DLibraryDirectory=/Users/joe/Library'
Arg 4: '-DDocumentsDirectory=/Users/joe/Documents'
Arg 5: '-DApplicationSupportDirectory=/Users/joe/Library/Application Support'
Arg 6: '-DCachesDirectory=/Users/joe/Library/Caches'
Arg 7: '-DApplicationDirectory=/Users/joe/Applications'
Arg 8: '-DAutosavedInformationDirectory=/Users/joe/Library/Autosave Information'
Arg 9: '-DDesktopDirectory=/Users/joe/Desktop'
Arg 10: '-DDownloadsDirectory=/Users/joe/Downloads'
Arg 11: '-DMoviesDirectory=/Users/joe/Movies'
Arg 12: '-DMusicDirectory=/Users/joe/Music'
Arg 13: '-DPicturesDirectory=/Users/joe/Pictures'
Arg 14: '-DSharedPublicDirectory=/Users/joe/Public'
Arg 15: '-DSystemLibraryDirectory=/Library'
Arg 16: '-DSystemApplicationSupportDirectory=/Library/Application Support'
Arg 17: '-DSystemCachesDirectory=/Library/Caches'
Arg 18: '-DSystemApplicationDirectory=/Applications'
Arg 19: '-DSystemUserDirectory=/Users'
Arg 20: '-DUserHome=/Users/joe'
Arg 21: '-DSandboxEnabled=true'
Arg 22: '-DDarkMode=false'
Arg 23: '-DLaunchModifierFlags=0'
Arg 24: '-DLaunchModifierFlagCapsLock=false'
Arg 25: '-DLaunchModifierFlagShift=false'
Arg 26: '-DLaunchModifierFlagControl=false'
Arg 27: '-DLaunchModifierFlagOption=false'
Arg 28: '-DLaunchModifierFlagCommand=false'
Arg 29: '-DLaunchModifierFlagNumericPad=false'
Arg 30: '-DLaunchModifierFlagHelp=false'
Arg 31: '-DLaunchModifierFlagFunction=false'
Arg 32: '-Dexist.home=/Users/joe/workspace/exist/dist/eXist-db.app/Contents/Resources/eXist-db'
Arg 33: '-Xdock:name=eXist-db'
Arg 34: 'org.exist.start.Main'
Arg 35: '-DisDebugging=true'

Loading Application 'eXist-db'
Working Directory: '/Users/joe'
Searching for a JRE.
Searching for a Java 8
JRE search exception: 'launch path not accessible'
No matching JRE found.
Found a Java 8.jdk JDK
Looks like major version 8
JDK version qualifies
Java Runtime Dylib Path: '/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib'
Launchpath: /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib
Main Bundle Path: '/Users/joe/workspace/exist/dist/eXist-db.app'
Main Class Name: 'org.exist.start.Main'
Option: -Dexist.home=/Users/joe/workspace/exist/dist/eXist-db.app/Contents/Resources/eXist-db
Option: -Xdock:name=eXist-db
Command line passed to application:
Arg 0: '/Users/joe/workspace/exist/dist/eXist-db.app/Contents/MacOS/eXist-JavaAppLauncher'
Arg 1: '-Djava.library.path=/Users/joe/workspace/exist/dist/eXist-db.app/Contents/MacOS'
Arg 2: '-Djava.class.path=/Users/joe/workspace/exist/dist/eXist-db.app/Contents/Java/Classes:/Users/joe/workspace/exist/dist/eXist-db.app/Contents/Java/start.jar'
Arg 3: '-DLibraryDirectory=/Users/joe/Library'
Arg 4: '-DDocumentsDirectory=/Users/joe/Documents'
Arg 5: '-DApplicationSupportDirectory=/Users/joe/Library/Application Support'
Arg 6: '-DCachesDirectory=/Users/joe/Library/Caches'
Arg 7: '-DApplicationDirectory=/Users/joe/Applications'
Arg 8: '-DAutosavedInformationDirectory=/Users/joe/Library/Autosave Information'
Arg 9: '-DDesktopDirectory=/Users/joe/Desktop'
Arg 10: '-DDownloadsDirectory=/Users/joe/Downloads'
Arg 11: '-DMoviesDirectory=/Users/joe/Movies'
Arg 12: '-DMusicDirectory=/Users/joe/Music'
Arg 13: '-DPicturesDirectory=/Users/joe/Pictures'
Arg 14: '-DSharedPublicDirectory=/Users/joe/Public'
Arg 15: '-DSystemLibraryDirectory=/Library'
Arg 16: '-DSystemApplicationSupportDirectory=/Library/Application Support'
Arg 17: '-DSystemCachesDirectory=/Library/Caches'
Arg 18: '-DSystemApplicationDirectory=/Applications'
Arg 19: '-DSystemUserDirectory=/Users'
Arg 20: '-DUserHome=/Users/joe'
Arg 21: '-DSandboxEnabled=true'
Arg 22: '-DDarkMode=false'
Arg 23: '-DLaunchModifierFlags=0'
Arg 24: '-DLaunchModifierFlagCapsLock=false'
Arg 25: '-DLaunchModifierFlagShift=false'
Arg 26: '-DLaunchModifierFlagControl=false'
Arg 27: '-DLaunchModifierFlagOption=false'
Arg 28: '-DLaunchModifierFlagCommand=false'
Arg 29: '-DLaunchModifierFlagNumericPad=false'
Arg 30: '-DLaunchModifierFlagHelp=false'
Arg 31: '-DLaunchModifierFlagFunction=false'
Arg 32: '-Dexist.home=/Users/joe/workspace/exist/dist/eXist-db.app/Contents/Resources/eXist-db'
Arg 33: '-Xdock:name=eXist-db'
Arg 34: 'org.exist.start.Main'
Arg 35: '-DisDebugging=true'
java.lang.ClassNotFoundException: -DisDebugging=true
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.exist.start.Main.invokeMain(Main.java:131)
    at org.exist.start.Main.run(Main.java:453)
    at org.exist.start.Main.main(Main.java:64)

However, without setting this option, the app starts as expected:

$ /Users/joe/workspace/exist/dist/eXist-db.app/Contents/MacOS/eXist-JavaAppLauncher
First launch: opening configuration dialog

Here's the same pair of results on Test.app:

$ /Users/joe/workspace/appbundler/Test.app/Contents/MacOS/JavaAppLauncher -DisDebugging=true

Loading Application 'Test'
Working Directory: '/Users/joe'
Java Runtime (zulu-8.jdk) Relative Path: '/Users/joe/workspace/appbundler/Test.app/Contents/PlugIns/zulu-8.jdk' (dylib: /Users/joe/workspace/appbundler/Test.app/Contents/PlugIns/zulu-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib)
Launchpath: /Users/joe/workspace/appbundler/Test.app/Contents/PlugIns/zulu-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib
Main Bundle Path: '/Users/joe/workspace/appbundler/Test.app'
Main Class Name: 'com/javafx/main/Main'
Option: -Dapple.laf.useScreenMenuBar=true
Command line passed to application:
Arg 0: 'Test.app/Contents/MacOS/JavaAppLauncher'
Arg 1: '-Djava.library.path=/Users/joe/workspace/appbundler/Test.app/Contents/MacOS'
Arg 2: '-DLibraryDirectory=/Users/joe/Library'
Arg 3: '-DDocumentsDirectory=/Users/joe/Documents'
Arg 4: '-DApplicationSupportDirectory=/Users/joe/Library/Application Support'
Arg 5: '-DCachesDirectory=/Users/joe/Library/Caches'
Arg 6: '-DApplicationDirectory=/Users/joe/Applications'
Arg 7: '-DAutosavedInformationDirectory=/Users/joe/Library/Autosave Information'
Arg 8: '-DDesktopDirectory=/Users/joe/Desktop'
Arg 9: '-DDownloadsDirectory=/Users/joe/Downloads'
Arg 10: '-DMoviesDirectory=/Users/joe/Movies'
Arg 11: '-DMusicDirectory=/Users/joe/Music'
Arg 12: '-DPicturesDirectory=/Users/joe/Pictures'
Arg 13: '-DSharedPublicDirectory=/Users/joe/Public'
Arg 14: '-DSystemLibraryDirectory=/Library'
Arg 15: '-DSystemApplicationSupportDirectory=/Library/Application Support'
Arg 16: '-DSystemCachesDirectory=/Library/Caches'
Arg 17: '-DSystemApplicationDirectory=/Applications'
Arg 18: '-DSystemUserDirectory=/Users'
Arg 19: '-DUserHome=/Users/joe'
Arg 20: '-DSandboxEnabled=true'
Arg 21: '-DDarkMode=false'
Arg 22: '-DLaunchModifierFlags=0'
Arg 23: '-DLaunchModifierFlagCapsLock=false'
Arg 24: '-DLaunchModifierFlagShift=false'
Arg 25: '-DLaunchModifierFlagControl=false'
Arg 26: '-DLaunchModifierFlagOption=false'
Arg 27: '-DLaunchModifierFlagCommand=false'
Arg 28: '-DLaunchModifierFlagNumericPad=false'
Arg 29: '-DLaunchModifierFlagHelp=false'
Arg 30: '-DLaunchModifierFlagFunction=false'
Arg 31: '-Dapple.laf.useScreenMenuBar=true'
Arg 32: '-m'
Arg 33: 'com/javafx/main/Main'
Arg 34: 'foo=bar'
Arg 35: '-DisDebugging=true'

Loading Application 'Test'
Working Directory: '/Users/joe'
Java Runtime (zulu-8.jdk) Relative Path: '/Users/joe/workspace/appbundler/Test.app/Contents/PlugIns/zulu-8.jdk' (dylib: /Users/joe/workspace/appbundler/Test.app/Contents/PlugIns/zulu-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib)
Launchpath: /Users/joe/workspace/appbundler/Test.app/Contents/PlugIns/zulu-8.jdk/Contents/Home/jre/lib/jli/libjli.dylib
Main Bundle Path: '/Users/joe/workspace/appbundler/Test.app'
Main Class Name: 'com/javafx/main/Main'
Option: -Dapple.laf.useScreenMenuBar=true
Command line passed to application:
Arg 0: 'Test.app/Contents/MacOS/JavaAppLauncher'
Arg 1: '-Djava.library.path=/Users/joe/workspace/appbundler/Test.app/Contents/MacOS'
Arg 2: '-DLibraryDirectory=/Users/joe/Library'
Arg 3: '-DDocumentsDirectory=/Users/joe/Documents'
Arg 4: '-DApplicationSupportDirectory=/Users/joe/Library/Application Support'
Arg 5: '-DCachesDirectory=/Users/joe/Library/Caches'
Arg 6: '-DApplicationDirectory=/Users/joe/Applications'
Arg 7: '-DAutosavedInformationDirectory=/Users/joe/Library/Autosave Information'
Arg 8: '-DDesktopDirectory=/Users/joe/Desktop'
Arg 9: '-DDownloadsDirectory=/Users/joe/Downloads'
Arg 10: '-DMoviesDirectory=/Users/joe/Movies'
Arg 11: '-DMusicDirectory=/Users/joe/Music'
Arg 12: '-DPicturesDirectory=/Users/joe/Pictures'
Arg 13: '-DSharedPublicDirectory=/Users/joe/Public'
Arg 14: '-DSystemLibraryDirectory=/Library'
Arg 15: '-DSystemApplicationSupportDirectory=/Library/Application Support'
Arg 16: '-DSystemCachesDirectory=/Library/Caches'
Arg 17: '-DSystemApplicationDirectory=/Applications'
Arg 18: '-DSystemUserDirectory=/Users'
Arg 19: '-DUserHome=/Users/joe'
Arg 20: '-DSandboxEnabled=true'
Arg 21: '-DDarkMode=false'
Arg 22: '-DLaunchModifierFlags=0'
Arg 23: '-DLaunchModifierFlagCapsLock=false'
Arg 24: '-DLaunchModifierFlagShift=false'
Arg 25: '-DLaunchModifierFlagControl=false'
Arg 26: '-DLaunchModifierFlagOption=false'
Arg 27: '-DLaunchModifierFlagCommand=false'
Arg 28: '-DLaunchModifierFlagNumericPad=false'
Arg 29: '-DLaunchModifierFlagHelp=false'
Arg 30: '-DLaunchModifierFlagFunction=false'
Arg 31: '-Dapple.laf.useScreenMenuBar=true'
Arg 32: '-m'
Arg 33: 'com/javafx/main/Main'
Arg 34: 'foo=bar'
Arg 35: '-DisDebugging=true'
Unrecognized option: -m
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
$ /Users/joe/workspace/appbundler/Test.app/Contents/MacOS/JavaAppLauncher 
Unrecognized option: -m
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Does this provide the info you need?

joewiz commented 5 years ago

Also, possibly related, see #23.

rschmunk commented 5 years ago

I think issue #23 was something I posted on the Bitbucket repo a few years ago and which was subsequently resolved by a commit.

No, what I seem to be getting now is that depending on which of my two Macs I use, I either get too much logging or none. One of the two systems is office-IT-controlled, so the macOS version is locked down, which also limits which Xcode I'm able to use on that machine.

Anyhow, that issue doesn't really come into play as far as what this PR is intended to do.

rschmunk commented 5 years ago

My memory is slipping. It looks like I did file the original issue for #23, but apparently it was not resolved. Certainly it was never closed.