Build definition Ant script templates

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

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:
  1. Properties are set through Ant <property> elements.
  2. The default “all” target drives three other targets that do the real work.
  3. The “hybrid” target prepares, builds, and deploys hybrid applications and adapters. The following basic actions take place within the “hybrid” target:
    1. URLs to the Worklight Server Console and Application Center are published to the Rational Team Concert build results.
    2. 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.
    3. The hybrid application is built by the Worklight <app-builder> Ant task.
    4. The resulting “.wlapp” file is deployed to Worklight Server.
    5. The adapter is built by the Worklight <adapter-builder> Ant task.
    6. The resulting “.adapter” file is deployed to Worklight Server.
    7. The “.wlapp” and “.adapter” files are published to the Rational Team Concert build results.
  4. In the android.build.xml script, the “androidNative” target builds the native Android APK file by taking the following basic actions:
    1. The "android" command-line tool from the Android SDK is run to generate the Android build.xml file.
    2. The generated Android build.xml file is run to build the APK file.
    3. The APK file is published to the Rational Team Concert build results.
  5. In the ios.build.xml script, the “iosNative” target builds the native iOS IPA file by taking the following basic actions:
    1. The "xcodebuild" command-line tool from the Xcode SDK is run to build the iOS application.
    2. The “xcrun” command-line tools from the Xcode SDK are run to package the iOS application into an IPA file.
    3. The IPA file is published to the Rational Team Concert build results.
  6. The “appcenterPush” target uploads the Android APK or iOS IPA file to the Worklight Application Center.
  7. 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.


Feedback