Builder Reference

Building and packaging requires a complex set of steps. Within MTJ there are a number of different ways to launch builds and different types of outputs. This page provides some insight into the way that MTJ handles these different types of builds. This is advanced reference information and should not be necessary for standard use of MTJ.

Directory Structure

Contents of the /.mtj.tmp folder are internal and not meant to be manipulated or altered. The project JAR and JAD in the /.mtj.tmp/emulation folder is used when executing the emulator. This JAR/JAD is kept up to date incrementally by the builder.

NOTE: The ability to configure the verified folder name is no longer supported.

Build Types

Clean Build

  1. Clears all contents from /.mtj.tmp
  2. Eclipse will then launch a normal incremental build

Incremental Build

  1. Preprocessor (if configured) runs on source file
  2. Eclipse Java compiler runs on source file
  3. Preverifier is run on source file
  4. /.mtj.tmp/runtime/project.jar is incrementally updated
  5. /.mtj.tmp/runtime/project.jad is updated

Create Package

  1. Update JAD version if configured in preferences
  2. Clean project
  3. Clears all contents from /deployed
  4. Build project via Incremental Build
  5. Copy JAR to /deployed folder
  6. Write /deployed/project.jad

Create Package

  1. Update JAD version if configured in preferences
  2. Clean project
  3. Clears all contents from /deployed
  4. Build project via Incremental Build
  5. Obfuscate /.mtj.tmp/runtime/project.jar into /deployed/project_obf.jar
  6. Preverify /deployed/project_obf.jar into /deployed/project.jar
  7. Write /deployed/project.jad

Build Debugging

Controlling Build Logging

Logging of the build process can be enabled and controlled via a Java System property. See this for further information on how to set a System property. Build logging information is configured using the "mtj.build.logging" system property. The property supports a comma-separated list of logging items that may be enabled. The available options are:

For example:

-vmargs -Dmtj.build.logging=preverifierOutput,obfuscationOutput

The result of this logging will be written to the MTJ Build Console described below.

Build Output Console

Due to the potentially large amount of data that can be output by the build logging, the MTJ Build Console is being introduced. It should be noted that this is considered to be an advanced troubleshooting tool and is not really intended for average users. With that said, it is an important tool in collecting information when something goes wrong during the build.

The console must be explicitly launched from the Eclipse Console View, as shown below.

The console will not be opened automatically when logging is enabled. It must be explicitly opened as well as having the appropriate logging enabled using the "mtj.build.logging" System property. This is so that unwanted logging will not occur and cause performance problems. Once the console has been opened and build logging enabled, the results will then be displayed in the console. All of the standard console operations work against this console, including the ability to copy/paste text as well as the ability to clear the text of the console.