Skip to content

Commit

Permalink
Merge pull request #66 from airsquared/master
Browse files Browse the repository at this point in the history
Add universalJavaApplicationStub option as appStyle
  • Loading branch information
crotwell authored Nov 27, 2018
2 parents 7ed8c56 + a81c2cb commit d11592f
Show file tree
Hide file tree
Showing 4 changed files with 811 additions and 5 deletions.
26 changes: 26 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -959,3 +959,29 @@ necessary. Here is a sample; alter the names:

That's all there is to it!

------------------------------------------------------------------------------
License for universalJavaApplicationStub
------------------------------------------------------------------------------
The MIT License (MIT)

Copyright (c) 2014-2018 Tobias Fischer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

------------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class GenerateInfoPlistTask extends DefaultTask {

@TaskAction
def void writeInfoPlist() {
if (project.macAppBundle.appStyle == 'Oracle') {
if (project.macAppBundle.appStyle == 'Oracle' || project.macAppBundle.appStyle == 'universalJavaApplicationStub') {
writeInfoPlistOracleJava();
} else {
writeInfoPlistAppleJava();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ class MacAppBundlePluginExtension implements Serializable {
the executable stub are different. Setting this will also change the
bundleExecutable and the jarSubdir as both of these are different in Oracle versus Apple styles.
The default is 'Oracle'.
More information on the new Oracle style .app can be found <a href="https://java.net/projects/appbundler">here</a>.
Test your application before switching to universalJavaApplicationStub as it may not be compatible with certain features
More information on the universalJavaApplicationStub can be found <a href="https://github.com/tofi86/universalJavaApplicationStub">here</a>.
*/
String appStyle = 'Oracle'

Expand All @@ -45,8 +48,11 @@ class MacAppBundlePluginExtension implements Serializable {
} else if (val == 'Apple') {
bundleExecutable = 'JavaApplicationStub'
jarSubdir = 'Resources/Java'
} else if (val == "universalJavaApplicationStub") {
bundleExecutable = 'universalJavaApplicationStub'
jarSubdir = 'Java'
} else {
throw new InvalidUserDataException("I don't understand appStyle='${appStyle}', should be one of 'Apple' or 'Oracle'")
throw new InvalidUserDataException("I don't understand appStyle='${appStyle}', should be one of 'Oracle', 'universalJavaApplicationStub' or 'Apple'")
}
}

Expand Down Expand Up @@ -121,7 +127,7 @@ class MacAppBundlePluginExtension implements Serializable {
String jarSubdir = 'Java'

/** The name of the executable run by the bundle.
* Default is 'JavaAppLauncher'. This is also set when setting the style to Oracle or Apple.
* Default is 'JavaAppLauncher'. This is also set when setting the style to Oracle, universalJavaApplicationStub, or Apple.
*/
String bundleExecutable = 'JavaAppLauncher'

Expand Down Expand Up @@ -222,7 +228,7 @@ class MacAppBundlePluginExtension implements Serializable {

String getJreHome() {
// ensure jreHome is set, finding it if needed, before running task
if (jreHome == null && Os.isFamily(Os.FAMILY_MAC) && appStyle == 'Oracle') {
if (jreHome == null && Os.isFamily(Os.FAMILY_MAC) && (appStyle == 'Oracle' || appStyle == 'universalJavaApplicationStub')) {
String javaHomeCommand = """/usr/libexec/java_home"""// Create the String
File jhFile = new File((String)javaHomeCommand);
if ( ! jhFile.exists()) {
Expand Down
Loading

0 comments on commit d11592f

Please sign in to comment.