Skip to content
Gerry Weißbach edited this page Aug 13, 2019 · 13 revisions

Setup Builder DSL

This page describes the task DSL of the main component of the Setup Builder. The setupBuilder is an extension of the CopySpec and CopySpecSource definitions of gradle, thus supporting the source input of them.

Basic Setup Builder options that apply to the setupBuilder main task and certain sub-areas:

setupBuilder {
    vendor          = "i-net software GmbH";
    copyright       = "Copyright © 2019 i-net software GmbH"
    application     = "My Application";	// optional, defaults to project name
    description     = "This is my application";

    version         = "1.0.0";

    appIdentifier   = "com.application.my";
    archiveName     = "com.application.my-1.0.0"; // optional, defaults to {appIdentifier}-{version}

    icons           = "icon-file.icns";

    mainClass       = "com.application.my.Main";
    mainJar         = "java/MyApplication.jar";  // main jar file in the installed structure,
                                                 // relative to root.
    destinationDir  = "";

    bundleJre       = <JRE DEFINITION>; // optional, see below
    bundleJreTarget = "runtime"; // optional, a directory in the installed structure

    failOnEmptyFrom = "true"; // optional, will make the gradle job fail if not CopySpec source is given
}

Extended setupBuilder task options:

setupBuilder {
    defaultResourceLanguage  = "en"; // default language of the given resource files.
	
    licenseFile              = "path/to/license.txt" // the license file with the default language

    licenseFile {            // optional, alternative definition of the license file with specific language
         locale              = "de" // language of the license
         resource            = "path/to/license-de.txt" // the license file with the given language
    }

    longDescription          = ""; // optional, longer description of the application
	
    runAfter           { ... } // optional, defines a desktopStarter-like application to run after installation
    runBeforeUninstall { ... } // optional, defines a desktopStarter-like application to run before uninstallation
	
    service            { ... } // optional, defines system services. Multiple definitions allowed.
	
    desktopStarter     { ... } // optional, create desktop links. Multiple definitions allowed.
	
    deleteFiles              = [ "old/file.txt", "old/file2.txt" ]; // List of files to remove before INSTALLATION. Relative to installation destiantion. Can be used to clean up the installation directory from files not created by the setup
    deleteFiles                "old/file.txt" // alternative syntax with single entry
	
    deleteFolders            = [ "old" ]; // List of folders to remove before INSTALLATION. They have to be empty.
    deleteFolders              "old" // alternative syntax with single entry
}

Hints

The following properties may require further explanation.

Property: icons

The icons property supports the .png, .ico and .icns formats. Depending on the platform type to build the setup for it will try to genereate either from the other. Since .icns is most compatible it is recommended to use it.

Property: bundleJre

Bundling a specific java runtime is recommended by Oracle to ensure the application works as expected. The parameter accepts either a version number (e.g. either 1.8 or a "1.8.1") or a file path.

Version Number

If a version number is given, the Setup Builder will try with standard measures to determine where the runtime is installed and embeds it. Please note: You have to have this runtime installed.

  • Windows: Checks the Program Files directory for an installed Java instance with the given number
  • macOS: uses the /usr/libexec/java_home tool to determine the home directory of the given version number
  • Linux: does not apply.

File Path

The given path has to be the Java's home directory. It has to exist (and make sense) in the system.

You should check your options with platform specific Java VMs. AdoptOpenJDK offers a wide range of supported versions and platforms.

This is the recommended way.

Properties: runAfter, runBeforeUninstall, desktopStarter

These options define a specific program that can be launched. It usually has different settings (but the same settings) than the default setupBuilder offers. Options not explicitly set will be reused from the setupBuilder definition.

Please have a look at the documentation at of the desktopStarter.

Property: service

These options define a specific program that can be launched. It usually has different settings (but the same settings) than the default setupBuilder offers. Options not explicitly set will be reused from the setupBuilder definition.

Please have a look at the documentation at of the desktopStarter.