Build scripts

You can create Ant build scripts for Worklight® projects that contain applications and adapters. By using these build scripts, you can automate your mobile application builds.

Build script tasks

You can create build scripts that use the following types of Ant tasks:
Type of Ant task Description
Built in tasks from Apache Ant Includes tasks such as:
  • <echo>
  • <report>
  • <mkdir>
  • <exec>
  • <replaceregexp>
Tasks from IBM® Worklight These tasks perform the following actions:
  • Build hybrid applications and adapters, such as <app-builder> and <adapter-builder>. IBM Worklight provides a set of Ant tasks that help you to build adapters and hybrid applications for your IBM Worklight Server.
  • Build IBM Worklight web archive projects. IBM Worklight provides the <war-builder> Ant task for building the Worklight project WAR file.
Tasks from the Rational Team Concert™ Build System Toolkit These tasks provide information to the build results. Tasks include:
  • <startBuildActivity>
  • <linkPublisher>
  • <artifactPublisher>

Sample build script task flow

You can create build scripts for Worklight projects that contain different numbers of applications or adapters. The following sample task flow describes the overall design of a build script for a Worklight project that has a single hybrid application and a single adapter.
  1. Use Ant <property> elements to set the properties.
  2. Use a hybrid target to build hybrid applications, adapters, and Worklight web archive projects. The hybrid target contains the following actions:
    1. URLs that point to the Worklight Server Console and the Application Center are published to either the Ant build log or the Rational Team Concert build results.
    2. The Worklight <app-builder> Ant task builds the hybrid application.
    3. The resulting .wlapp file is stored in the build output.
    4. The Worklight <adapter-builder> Ant task builds the adapter.
    5. The resulting .adapter file is stored in the build output.
    6. The Worklight <war-builder> Ant task builds the Worklight web archive project.
    7. The resulting WAR file is stored in the build output.
    8. Optional. If you use Rational Team Concert, you can publish the .wlapp, .adapter, and WAR files to the Rational Team Concert build results.
  3. When you build an Android application, include the following actions to build the native Android APK file:
    1. Run the android command-line tool from the Android SDK to generate the Android build.xml file.
    2. Run the generated Android build.xml file to build the APK file.
    3. Optional. Publish the Android APK file to the location where you store your build output. For example, if you use Rational Team Concert, publish the APK file to the Rational Team Concert build results.
  4. When you build an iOS application, include the following actions to build the native iOS IPA file:
    1. Run the xcodebuild command-line tool from the Xcode SDK to build the iOS application.
    2. Run the xcrun command-line tools from the Xcode SDK to package the iOS application into an IPA file.
    3. Optional. Publish the iOS IPA file to the location where you store your build output. For example, if you use Rational Team Concert, publish the IPA file to the Rational Team Concert build results.
  5. Add your hybrid application, adapter, Worklight web archive project (WAR file), and native application (Android APK file or iOS IPA file) to UrbanCode Deploy as a new version.
    Tip: You can have multiple hybrid applications and adapters. If you have more than one hybrid application or adapter, repeat calls to tasks to build the mobile artifacts, add new property values, and then add the new artifacts to UrbanCode Deploy.

Feedback