Can I compile Titanium mobile app from command line on my OSX?
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.
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.
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
there has been an updated document added to the wiki that should address this old issue
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%