Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Compile Titanium mobile app from command line?

Can I compile Titanium mobile app from command line on my OSX?

— asked May 17th 2010 by Yuichiro MASUI
  • commandline
  • mobile
0 Comments

6 Answers

  • I have no idea if this is the "official way to do this, but on Mobile SDK 1.6.0 this commandline works for me (I only use Android):

    ~/.titanium/mobilesdk/linux/1.6.0/android/builder.py  "run" \
    "/home/john/eclipse/workspace/TitaniumTests/Test002/Test002/" \
    "/opt/android-sdk"
    

    where "~/.titanium" is the location where I have Titanium installed, "/home/john/eclipse/workspace.." is my Titanium project directory and "/opt/android-sdk" is the path to the Android SDK.

    I use this to compile once and then install and start the application on a bunch of different Android emulators (different screen sizes and densities) by running a single script.

    Kind regards,
    John

    — answered March 6th 2011 by John Zweng
    permalink
    0 Comments
  • I'd love to see official support for this.

    I managed to get it working with iPhone on OS X with the following command (I made a shell-script in my project root folder):

    /Library/Application\ Support/Titanium/mobilesdk/osx/1.6.0/iphone/builder.py "simulator" "4.2" . "com.company.appid" "App Name"
    

    The only issue I've encountered is that my splash-screen isn't copied to the build-folder, instead it uses the Titanium-default.

    — answered March 6th 2011 by Marcus Olovsson
    permalink
    0 Comments
  • The real order is:

    python build.py COMMAND VERSION PROJECT_PATH PROJECT_ID PROJECT_NAME
    

    it's better to put into a python script and run it instead of type all that in the command line.

    To confirm what I said here is the output of the help command:

    python builder.py --help
    builder.py <command> <version> <project_dir> <appid> <name> [options]
    
    available commands: 
    
      install       install the app to itunes for testing on iphone
      simulator     build and run on the iphone simulator
      distribute    build final distribution bundle
      xcode         build from within xcode
      run           build and run app from project folder
    
    — answered May 23rd 2011 by Ghassen Telmoudi
    permalink
    2 Comments
    • These no longer seem to be the options. I get

      Appcelerator Titanium
      Copyright (c) 2010-2011 by Appcelerator, Inc.
      
      commands:
      
        create      - create a project
        run         - run an existing project
        emulator    - start the emulator (android)
        docgen      - generate html docs for a module (android)
        fastdev     - management for the Android fastdev server
        help        - get help
      

      Where did the iPhone options go?

      — commented June 23rd 2011 by Phil Oye
    • Scratch that. I was using titanium.py per the wiki. Your options are indeed available from builder.py.

      — commented June 23rd 2011 by Phil Oye
  • Checking through the build.py source code, I found a "build" target suitable for automated build since it does not spawn an emulator or require an attached device. Unlike the "run" and "run-emulator" commands, the "build" command requires the 5 arguments as per build.py –help:

    builder.py <command> <project_name> <sdk_dir> <project_dir> <app_id>
    

    For windows a build batch file would look something like:

    @ECHO OFF
    SET PROJECT_NAME="Example Project"
    SET PROJECT_ID="com.example.automatedbuild"
    SET TITANIUM_SDK=C:\Users\All Users\Titanium\mobilesdk\win32\1.6.0
    SET ANDROID_SDK=C:\android-sdk-windows
    "%TITANIUM_SDK%\android\builder.py" "build" %PROJECT_NAME% "%ANDROID_SDK%" . %PROJECT_ID%
    
    — answered March 6th 2011 by Daniel Cameron
    permalink
    1 Comment
    • The real order is:
      python build.py COMMAND VERSION PROJECT_PATH PROJECT_ID PROJECT_NAME

      it's better to put into a python script and run it instead of type all that in the command line

      — commented May 23rd 2011 by Ghassen Telmoudi
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.