org.codehaus.mojo.javascript.titanium
Class TitaniumBuilder

java.lang.Object
  extended by org.codehaus.mojo.javascript.titanium.TitaniumBuilder

public class TitaniumBuilder
extends java.lang.Object

Helper class to issue titanium builder calls.


Constructor Summary
TitaniumBuilder(java.io.File androidBuilder, java.io.File iosBuilder, java.io.File androidSdk)
          Create a new TitaniumBuilder instance.
 
Method Summary
 java.lang.ProcessBuilder createAndroidBuilderProcess(java.lang.String command, java.lang.String projectName, java.lang.String tiProjectDirectory, java.lang.String appId, java.lang.String androidAPI, java.lang.String skin)
          Create an android ProcessBuilder.
 java.lang.ProcessBuilder createAndroidDistributeBuilderProcess(java.io.File outputDirectory, java.lang.String projectName, java.lang.String tiProjectDirectory, java.lang.String appId, java.lang.String keystore, java.lang.String keystorePassword, java.lang.String keystoreAlias, java.lang.String androidAPI, java.lang.String skin)
          Create an android distribute ProcessBuilder.
static boolean isProcessRunning(java.lang.Process p)
          Check if a process is running.
 void launchIphoneDevice(java.lang.String iosVersion, java.io.File tiProjectDirectory, java.lang.String appId, java.lang.String projectName, java.lang.String appuuid, java.lang.String distName, java.lang.String family, org.apache.maven.plugin.logging.Log log)
          Launch the specified titanium project on an iOs device.
 void launchIphoneDistribute(java.lang.String iosVersion, java.io.File tiProjectDirectory, java.lang.String appId, java.lang.String projectName, java.lang.String appuuid, java.lang.String distName, java.io.File targetDir, java.lang.String family, org.apache.maven.plugin.logging.Log log)
          Launch the titanium ios builder distribute command and log its output.
 void launchIphoneEmulator(java.lang.String iosVersion, java.lang.String tiProjectDirectory, java.lang.String projectName, java.lang.String family, java.lang.String simulatorFamily, org.apache.maven.plugin.logging.Log log)
          Launch a titanium project on an iOs simulator.
 void launchOnAndroidEmulator(java.lang.String projectName, java.io.File tiProjectDirectory, java.lang.String appId, java.lang.String androidAPI, java.lang.String androidDeviceAPI, java.lang.String androidDeviceSkin, java.lang.Long androidDeviceWait, org.apache.maven.plugin.logging.Log log)
          Launch the android emulator and start the simulator after.
static void logProcess(java.lang.Process p, org.apache.maven.plugin.logging.Log log)
          Log the process output and error stream to the specified logger.
static void logProcess(java.lang.Process p, org.apache.maven.plugin.logging.Log log, java.lang.StringBuilder builder, boolean skipErrStream)
          Log the process to the specified logger.
static void logProcessLine(org.apache.maven.plugin.logging.Log log, java.io.BufferedReader reader)
          Read a line from the reader and log it to the specified logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TitaniumBuilder

public TitaniumBuilder(java.io.File androidBuilder,
                       java.io.File iosBuilder,
                       java.io.File androidSdk)
Create a new TitaniumBuilder instance.

Parameters:
androidBuilder - The location of the android builder file.
iosBuilder - The location of the iphone/ipad builder file.
androidSdk - The location of the android SDK home folder.
Method Detail

launchOnAndroidEmulator

public void launchOnAndroidEmulator(java.lang.String projectName,
                                    java.io.File tiProjectDirectory,
                                    java.lang.String appId,
                                    java.lang.String androidAPI,
                                    java.lang.String androidDeviceAPI,
                                    java.lang.String androidDeviceSkin,
                                    java.lang.Long androidDeviceWait,
                                    org.apache.maven.plugin.logging.Log log)
                             throws org.apache.maven.plugin.MojoFailureException,
                                    org.apache.maven.plugin.MojoExecutionException,
                                    java.io.IOException,
                                    java.lang.InterruptedException
Launch the android emulator and start the simulator after.

Parameters:
projectName - The project name.
tiProjectDirectory - The directory containing the titanium project files.
appId - The Titanium application id.

Must use the com.company.name format and not containing -.

androidAPI - The API to use to build the application.
androidDeviceAPI - The API the android emulator should use.
androidDeviceSkin - The skin of the android emulator to use.
androidDeviceWait - The interval between the emulator launch and the simulator launch. In milliseconds.
log - The Maven logger
Throws:
org.apache.maven.plugin.MojoFailureException - When the builder process return an error.
org.apache.maven.plugin.MojoExecutionException - When an error occurs during the call.
java.io.IOException - When an error occurs during the call.
java.lang.InterruptedException - When an error occurs during the call.

createAndroidBuilderProcess

public java.lang.ProcessBuilder createAndroidBuilderProcess(java.lang.String command,
                                                            java.lang.String projectName,
                                                            java.lang.String tiProjectDirectory,
                                                            java.lang.String appId,
                                                            java.lang.String androidAPI,
                                                            java.lang.String skin)
                                                     throws org.apache.maven.plugin.MojoExecutionException
Create an android ProcessBuilder.

Parameters:
command - The builder command.
projectName - The name of the project
tiProjectDirectory - The titanium project directory.
appId - The titanium application id.
androidAPI - The android API.
skin - The skin.
Returns:
The ProcessBuilder to use to launch the process.
Throws:
org.apache.maven.plugin.MojoExecutionException - When an error occured during the processbuilder creation.

createAndroidDistributeBuilderProcess

public java.lang.ProcessBuilder createAndroidDistributeBuilderProcess(java.io.File outputDirectory,
                                                                      java.lang.String projectName,
                                                                      java.lang.String tiProjectDirectory,
                                                                      java.lang.String appId,
                                                                      java.lang.String keystore,
                                                                      java.lang.String keystorePassword,
                                                                      java.lang.String keystoreAlias,
                                                                      java.lang.String androidAPI,
                                                                      java.lang.String skin)
                                                               throws org.apache.maven.plugin.MojoExecutionException
Create an android distribute ProcessBuilder.

Parameters:
outputDirectory - The outputDirectory location.
projectName - The name of the project.
tiProjectDirectory - The titanium project directory.
appId - The titanium application id.
keystore - The keystore.
keystorePassword - The keystore password
keystoreAlias - The keystore alias.
androidAPI - The android API
skin - The skin
Returns:
The ProcessBuilder to use to create the android distribute process.
Throws:
org.apache.maven.plugin.MojoExecutionException - When an error occured during the processbuilder creation.

launchIphoneDevice

public void launchIphoneDevice(java.lang.String iosVersion,
                               java.io.File tiProjectDirectory,
                               java.lang.String appId,
                               java.lang.String projectName,
                               java.lang.String appuuid,
                               java.lang.String distName,
                               java.lang.String family,
                               org.apache.maven.plugin.logging.Log log)
                        throws org.apache.maven.plugin.MojoExecutionException,
                               org.apache.maven.plugin.MojoFailureException
Launch the specified titanium project on an iOs device.

Parameters:
iosVersion - The iOS version to use to build the application.
tiProjectDirectory - The titanium project directory.
appId - The titanium application identifier.
projectName - The project name.
appuuid - The project uuid
distName - The project dist name.
family - The family to use when building the project.
log - The Maven logger.
Throws:
org.apache.maven.plugin.MojoFailureException - When the builder process return an error.
org.apache.maven.plugin.MojoExecutionException - When an error occured while launching on the device.

launchIphoneEmulator

public void launchIphoneEmulator(java.lang.String iosVersion,
                                 java.lang.String tiProjectDirectory,
                                 java.lang.String projectName,
                                 java.lang.String family,
                                 java.lang.String simulatorFamily,
                                 org.apache.maven.plugin.logging.Log log)
                          throws org.apache.maven.plugin.MojoFailureException,
                                 org.apache.maven.plugin.MojoExecutionException
Launch a titanium project on an iOs simulator.

Parameters:
iosVersion - The ios version to use to build the application.
tiProjectDirectory - The titanium project directory.
projectName - The name of the project.
family - The family to use to build the application.
simulatorFamily - family The family of the simulator ("universal" translates to "iphone").
log - The maven logger.
Throws:
org.apache.maven.plugin.MojoFailureException - When the builder process return an error.
org.apache.maven.plugin.MojoExecutionException - When an error occurs during the simulator process.

launchIphoneDistribute

public void launchIphoneDistribute(java.lang.String iosVersion,
                                   java.io.File tiProjectDirectory,
                                   java.lang.String appId,
                                   java.lang.String projectName,
                                   java.lang.String appuuid,
                                   java.lang.String distName,
                                   java.io.File targetDir,
                                   java.lang.String family,
                                   org.apache.maven.plugin.logging.Log log)
                            throws org.apache.maven.plugin.MojoExecutionException,
                                   org.apache.maven.plugin.MojoFailureException
Launch the titanium ios builder distribute command and log its output.

Parameters:
iosVersion - The ios version.
tiProjectDirectory - The titanium project directory.
appId - The application identifier.
projectName - The project name.
appuuid - The application uuid.
distName - The distribution name.
targetDir - The folder where the resulting file will be created.
family - The device family.
log - The maven logger.
Throws:
org.apache.maven.plugin.MojoFailureException - When the builder process return an error.
org.apache.maven.plugin.MojoExecutionException - When an error occurs while creating the distribution.

logProcessLine

public static void logProcessLine(org.apache.maven.plugin.logging.Log log,
                                  java.io.BufferedReader reader)

Read a line from the reader and log it to the specified logger.

This method doesn't block while no data is available. If no data is present when the method is called, nothing is outputed to the log

Parameters:
log - The logger to use to log the message.
reader - The reader from which a line should be read.

logProcess

public static void logProcess(java.lang.Process p,
                              org.apache.maven.plugin.logging.Log log)

Log the process output and error stream to the specified logger.

This method will start by read and log lines from the output and error stream while the process is running.

Parameters:
p - The process to log.
log - The logger where the messages should be outputted.

logProcess

public static void logProcess(java.lang.Process p,
                              org.apache.maven.plugin.logging.Log log,
                              java.lang.StringBuilder builder,
                              boolean skipErrStream)

Log the process to the specified logger.

Parameters:
p - The process to log.
log - The logger where the message should be outputted.
builder - A StringBuilder where each line will be appended. May be null.
skipErrStream - true if the error stream should not be logged.

isProcessRunning

public static boolean isProcessRunning(java.lang.Process p)
Check if a process is running.

Parameters:
p - The process to check.
Returns:
true if the process is running, false otherwise.


Copyright © 2011 SOFTEC sa. All Rights Reserved.