w8wjb / gradle-macappbundle-plugin

Fork of google code hosted gradle-macappbundle

Home Page:https://code.google.com/p/gradle-macappbundle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gradle-macappbundle-plugin Download

Create OS X application bundles from Java projects using gradle. A JVM can optionally be included.

It's not my work, though...

This is a fork of gradle-macappbundle by @crotwell. However, it differs in a few things:

  • Instead of providing two binary stubs (for Apple Java and Oracle Java) this version uses infinitekind's extended JavaAppLauncher which is available at bitbucket.
  • Now it's also possible to extend the classpath! Oracle's version did not allow altering the classpath, in fact it always used the default Java folder within an app bundle. Using the new JVMClassPath property in Info.plist the classpath can include either single jars or whole folders when the wildcard * is used. Of course, the contents of the (by default) Java folder within the bundle are also included.
  • Support for Apple Java has been removed since Apple stopped the development and recommends using Oracle's version.

How to use

First, you need to include the macappbundle plugin using the following fancy gradle 2.1+ syntax. The plugin is/should be available at jcenter.

plugins {
  id "com.github.cr0.macappbundle" version "3.0.1"
}

Please have a look at bintray for more details.

The following example shows a working configuration including the extendable classpath feature.

macAppBundle {
	appName = "Foo App"
	appCategory = "public.app-category.utilities"
	icon = "gradle/icon/fooapp.icns"
	agent = true

	version = "0.1.3-alpha+SNAPSHOT.123456789"
	shortVersion = "0.1.3a (nightly)"

	mainClassName = "org.foo.app.Launcher"

	bundleJRE = false
	bundleExecutable = "FooApp"
	bundleIdentifier = "org.foo.app"
	bundleCopyright = "Copyright 2015 Foo App"

	bundleExtras.put("NSHighResolutionCapable", "true")

	javaProperties.put("file.encoding", "utf-8")
	javaXProperties.add("mx2048M")
	javaXProperties.add("startOnFirstThread")

	javaClassPath.add("/Users/\$CURRENT_USER/.config/fooapp/plugins/*")

	archiveName = "Foo App ${pluginVersion}"
}

There are a few other options available -- if you're interested have a look at the source code.

If you use createApp, the plugin creates an app named Foo App.app in the build/macApp (settable using archiveOutputDir) directory.

You can also package the app as either a ZIP file (createAppZip) or a DMG with an optional background image (createDmg; applicable only on OS X).

A note on external cp's

As of 3.0.1, external class paths, i.e. all paths which are not in the app bundle, are optional. This is needed since many apps use external class path directories for e.g. plugins. Hence, such directories do not exist at first launch which caused a JavaDirectoryNotFound exception.

Licenses

Shoutouts to crotwell and infinitekind.

Where is 1.0.0 and 2.0.0?

Since this is a fork of crotwell's version which already was 2.0.0 I decided to bump the version again.

About

Fork of google code hosted gradle-macappbundle

https://code.google.com/p/gradle-macappbundle/


Languages

Language:Groovy 60.7%Language:M 39.3%