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
- Clears all contents from /.mtj.tmp
- Eclipse will then launch a normal incremental build
Incremental Build
- Preprocessor (if configured) runs on source file
- Eclipse Java compiler runs on source file
- Preverifier is run on source file
- /.mtj.tmp/runtime/project.jar is incrementally updated
- /.mtj.tmp/runtime/project.jad is updated
Create Package
- Update JAD version if configured in preferences
- Clean project
- Clears all contents from /deployed
- Build project via Incremental Build
- Copy JAR to /deployed folder
- Write /deployed/project.jad
Create Package
- Update JAD version if configured in preferences
- Clean project
- Clears all contents from /deployed
- Build project via Incremental Build
- Obfuscate /.mtj.tmp/runtime/project.jar into /deployed/project_obf.jar
- Preverify /deployed/project_obf.jar into /deployed/project.jar
- 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:
- obfuscationOutput
Logs the standard error and output streams of the Proguard obfuscator.
- preprocessorTrace
Logs a trace of the preprocessor builder.
- preverifierOutput
Logs the standard error and output streams of the external preverifier.
- preverifierTrace
Logs a trace of the preverification builder.
- all
Turns on all of the available logging options.
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.