Creating the Installers

This article is intended for the NautDrafter maintainer and explains how to generate the installer for each platform.

Setup

The installer files are hosted on Bitbucket in the nautdrafter-installer repo, which you'll need to clone to your local machine. You will need to be a member of the NautDrafter team to access the repo.

Once the repo has been cloned, there are a few more files that must be added:

  • In the /install-files/ folder, create a folder called jrex.x.x_x. This will hold the Java Runtime for each platform.
    • Download the latest JREs zips from the BitRock website. You'll need:
      • JRE Windows
      • JRE Windows x64
      • JRE Linux
      • JRE Linux x64
      • JRE Mac OS X
    • Each of these zips will be structured like:

      jrex.x.x_x-<platform>/
      └── java-<platform>/
          ├── bin/
          │   ...
          └── lib/
              ...
    • From each of the zips, copy the java-<platform> folder into /install-files/jrex.x.x_x/
      Your folder structure should look like:

      .
      └── install-files/
          ├── icons/
          ├── images/
          └── jrex.x.x_x/
              ├── java-linux/
              │   ├── bin/
              │   └   ...
              ├── java-linux-x64/
              ├── java-osx/
              ├── java-windows/
              └── java-windows-x64/

    • Edit the java.xml file to update the jre version.  The jre version is throughout the file.  So its best to use a text editor that can do a search and replace.

      install-files/java.xml
                  <distributionFileList>
                      <distributionFile>
                          <allowWildcards>1</allowWildcards>
                          <origin>install-files/jre1.8.0_25/java-windows/*</origin>
                      </distributionFile>
                  </distributionFileList>

      For instance, if the jre version is upgraded to jre1.8.0_26, use the following command with vim.

      VIM search & replace
      %s/jre1.8.0_25/jre1.8.0_26

 

  • The NautDrafter compiled distributable must also be added.
    • In the main NautDrafter repo (cloned from https://bitbucket.org/nautdrafter/nautdrafter), run ./gradlew distZip (in the root directory). This will generate zip files in <project>/build/distributions/<project>.zip.
    • Extract <main-nautdrafter-repo>/NautDrafter/build/distributions/NautDrafter.zip to the root of the installer repo.
      You should now have the following folder structure:

      .
      ├── install-files/
      │   ├── icons/
      │   ├── images/
      │   └── jre1.8.0_20/
      └── NautDrafter/
          ├── assets/
          ├── bin/
          ├── bundles/
          ├── lib/
          └── style/
  • You are now ready to generate an installer!

Configuring the Installers

In the root of the repo is a file called nautdrafter-installer-tidy.xml - this is the BitRock Install Builder config file that all the installers are generated from. While the file can be edited with the Install Builder GUI, it is usually best to do it by hand (the file also contains comments explaining what several of the section are for).

Changing the version number

Changing the value within the <version> tag in the config file will change the installer version. This is used in the installer file name and in the Windows registry. NautDrafter itself does not use this value in any way - it gets its version information from the Constants.java file in the NautDrafter_Common project.

Generating the Installers

For every NautDrafter release 10 installers must be generated - each platform has a main installer and an updater. The main difference between these two installers is that the updater does not bundle Java. The updater also performs some extra actions to check whether the user has Java 8 installed and (if they don't have Java 8) if a previous version of NautDrafter is installed (this is done by checking the selected installation directory for the NautDrafter.jar file. On Windows the registry is used to automatically find the previous install location).

Auotmation

If on linux, the scripts directory allows for automation in build and uploading to bitbucket.    See the following commands.

build the installers
scripts/build.bash
Upload to Bitbucket
scripts/upload.bash <username> <password>

 

Manual

The table below gives the command to run in order to generate the installer for each platform

PlatformInstaller TypeCommand


Windows

Full<path-to-installbuilder>/bin/builder build ./nautdrafter-installer-tidy.xml windows
Updater<path-to-installbuilder>/bin/builder build ./nautdrafter-installer-tidy.xml windows --setvars project.installationType=upgrade

Windows 64 bit
Full<path-to-installbuilder>/bin/builder build ./nautdrafter-installer-tidy.xml windows --setvars project.windows64bitMode=1
Updater<path-to-installbuilder>/bin/builder build ./nautdrafter-installer-tidy.xml windows --setvars project.installationType=upgrade project.windows64bitMode=1

Linux
Full<path-to-installbuilder>/bin/builder build ./nautdrafter-installer-tidy.xml linux
Updater<path-to-installbuilder>/bin/builder build ./nautdrafter-installer-tidy.xml linux --setvars project.installationType=upgrade

Linux 64 bit
Full<path-to-installbuilder>/bin/builder build ./nautdrafter-installer-tidy.xml linux-x64
Updater<path-to-installbuilder>/bin/builder build ./nautdrafter-installer-tidy.xml linux-x64 --setvars project.installationType=upgrade

Mac OSX
Full<path-to-installbuilder>/bin/builder build ./nautdrafter-installer-tidy.xml osx
Updater<path-to-installbuilder>/bin/builder build ./nautdrafter-installer-tidy.xml osx --setvars project.installationType=upgrade

The generated installers will be output to <path-to-installbuilder>/output/ and named in the format NautDrafter-<version>-<platform>-<installer|updater>.<exe|run|app>

Before distributing/uploading the OSX installers, they should be zipped (e.g. zip -r NautDrafter-0.2.0-osx-updater.app.zip NautDrafter-0.2.0-osx-updater.app/). Once this is done, all the installers are ready to upload.