The IBM® Mobile Development
Lifecycle Solution includes two templates of Ant build scripts. The
scripts are designed for use in Rational Team Concert build definitions,
and to be run by Jazz™ Build
Engines running on build computers.
The Ant build script templates are:
- android.build.xml
- Script android.build.xml builds and deploys
hybrid applications and adapters to Worklight Server, and builds and
uploads native Android APK applications to the Application Center.
- ios.build.xml
- Script ios.build.xml builds and deploys hybrid
applications and adapters to Worklight Server, and builds and uploads native
iOS IPA applications to the Application Center.
Both scripts are templates. For particular Worklight projects they
might work without modification; however, in general you have to modify
them to suit the particular projects, applications, and adapters in
your repository workspaces.
Location of the scripts
- On Windows the scripts
are located under .
- On Linux, the scripts are
at Installation location\imdls\templates directory,
where Installation location is the directory that
you selected when you installed the software.
- On MacOS, the scripts are in the /Applications/IBM/IMDLS/templates/ directory.
Build script tasks
Both scripts drive a
mixture of three kinds of Ant tasks:
Design and task flow of the scripts
The android.build.xml and ios.build.xml scripts
follow the same overall design. The main difference between the scripts
is in the details of how they build Android APK or iOS IPA application
files. The template scripts are written for a project that contains
one application and one adapter. Changes to the scripts are necessary
for projects that contain different numbers of applications or adapters.
The
overall design of the scripts:
- Properties are set through Ant <property> elements.
- The default “all” target drives three other targets that do the
real work.
- The “hybrid” target prepares, builds, and deploys hybrid applications
and adapters. The following basic actions take place within the “hybrid”
target:
- URLs to the Worklight Server Console and Application Center are
published to the Rational Team Concert build results.
- The value of the <worklightServerRootURL> element in the application-descriptor.xml file
of the application is updated with the URL of a Worklight Server that
is designated to test the application.
- The hybrid application is built by the Worklight <app-builder>
Ant task.
- The resulting “.wlapp” file is deployed to Worklight Server.
- The adapter is built by the Worklight <adapter-builder> Ant
task.
- The resulting “.adapter” file is deployed to Worklight Server.
- The “.wlapp” and “.adapter” files are published to the Rational
Team Concert build results.
- In the android.build.xml script, the “androidNative”
target builds the native Android APK file by taking the following
basic actions:
- The "android" command-line tool from the Android SDK is run to
generate the Android build.xml file.
- The generated Android build.xml file is run
to build the APK file.
- The APK file is published to the Rational Team Concert build results.
- In the ios.build.xml script, the “iosNative”
target builds the native iOS IPA file by taking the following basic
actions:
- The "xcodebuild" command-line tool from the Xcode SDK is run to
build the iOS application.
- The “xcrun” command-line tools from the Xcode SDK are run to package
the iOS application into an IPA file.
- The IPA file is published to the Rational Team Concert build results.
- The “appcenterPush” target uploads the Android APK or iOS IPA
file to the Worklight Application Center.
- Ant tasks are defined through Ant <taskdef> elements.
Modifying the scripts
A number of aspects
of the build scripts can be adjusted by editing property values in
the build definition. For more elaborate customization, you might
have to copy and edit the template build scripts.
The template
build scripts are written for any Worklight project that has exactly
one hybrid application and exactly one adapter. Perhaps the most common
reason to edit and customize the build scripts is to handle projects
that have more or less applications or adapters. Embedded in the template
build scripts are comments to explain how to alter the build scripts
to suit projects with different numbers of applications and adapters.