Titanium 3.2 CLI
Chris Barber
Titanium Engineer Extraordinaire

TiAppCamp 2 / Nov 2, 2013
About Me
• Been with Appc 3 ½ years
• Stuff I've done
– Early versions of www site
– Dev center Q&A
– Titanium Mobile Web
platform
– Titanium CLI
– Titanium platform build
scripts

• JavaScript Guru
What's New in 3.2

Titanium 3.0.0,
3.0.1, 3.0.2, 3.0.3

Titanium 3.1.0,
3.1.1, 3.1.2, 3.1.3

Titanium 3.2.0

778

816

1717+
Titanium CLI
Titanium CLI
•
•
•
•

Complete overhaul
Better selected SDK handling
New setup wizard
New prompting library
– http://npmjs.org/package/fields

• Command improvments
– info, module, plugin, sdk, setup

• More config settings
• Unit tests
Setup Command

• New menu design
• Improved quick setup
• New check environment
Info Command
• node-appc versions
• Mac OS X command line
tools
• Intel HAXM (Hardware
Accelerated Execution
Manager)
• Xcode support
• Improved iOS cert and
provisioning profile detection
• Android & iOS Devices &
Emulators/Simulators
• Environment Issues
Config Settings
•
•
•
•
•
•
•
•
•
•

cli.ignoreDirs
cli.ignoreFiles
cli.progressBars (true)
cli.width (100)
paths.hooks
paths.modules
paths.plugins
paths.sdks
sdk.defaultInstallLocation
sdk.selected (formerly
app.sdk)
Android Build
Android Build
•
•
•
•
•
•

Complete rewrite from Python to Node.js
Support for CLI plugins
Android 2.3.3 no longer required
Builds are about 13% faster
Nearly 100 bug fixes
Distribution builds much, much faster thanks
to UglifyJS
• Support for multiple emulators AND devices
• No longer creates AVDs, you manage your
own
•
•
•
•
•

Fast x86 Android emulator
Built on top of VirtualBox
Beta support with Titanium
http://www.genymotion.com/
titanium config
genymotion.enabled true
iOS Build
iOS Build
•
•
•
•
•
•
•
•

Builds are about 20% faster
Xcode 5.0.1 and iOS 7.0.3 support
64-bit iOS Simulator support
iOS Simulator profiles
Fixed several bugs
Improved validation
Improved symbol detection
Certificate and provisioning profile
selection
No More iTunes Sync
• Direct install to iOS device
• Insanely fast
• Supports install to multiple devices
simultaneously
• https://npmjs.org/package/node-ios-device
CLI Plugins
CLI Plugins
• Contains commands, event hooks, &
function hooks
• Global and per-project
• Global and Module hooks
Anatomy of a CLI Command
• /some/dir/mycommand.js
• ti config -a paths.commands /some/dir
• ti mycommand -baz wow
Anatomy of a CLI Hook
• /some/dir/myhook.js
• ti config -a paths.hooks /some/dir
Packaging a CLI Plugin
• Global plugins go in ~/Library/Application
Support/Titanium/plugins
– Can contain commands and hooks
– Automatically loaded for every Titanium
command
Packaging a CLI Plugin
• Project plugins go in <project dir>/plugins
• Can contain hooks only
– Loaded by "build" and "clean" commands

• Must be enabled in tiapp.xml
Available Plugin Hooks
Event Hooks

Function Hooks

•
•
•
•
•
•
•
•
•
•
•

•
•
•
•
•
•
•
•
•
•
•
•
•
•

cli:command-not-found
cli:command-loaded
cli:pre-validate
cli:post-validate
cli:pre-execute
cli:post-execute
help:header
build.pre.construct
build.pre.compile
build.post.compile
build.finalize

build.config
build.android.config
build.android.copyResource
build.android.compileJsFile
build.android.dexerArgs
build.android.javacArgs
build.android.writeBuildManifest
build.android.startEmulator
build.ios.config
build.ios.writeBuildManifest
build.ios.copyResource
build.ios.compileJsFile
build.mobileweb.config
clean.config
How to get it:
npm install -g
git://github.com/appcelerator/titaniu
m.git
ti sdk install -b master -d
DISCLAIMER: This is not fully tested. This is not stable code. Use at your own risk.
Future Ideas
Build Profiles
• Controls build settings
– JavaScript minification
– JavaScript encryption
– Debugging
– etc

• Global or per-project
• Project-level defined in
tiapp.xml
– Can contain any tag
Build Profiles
Export Command
• Generate standalone Xcode (iOS) or
Eclipse (Android) projects
• No dependency on Titanium
• Replaces transport.py
Improved Logging
•
•
•
•
•

Console-only today
File logging, especially for builds
Destination specific logging
Timestamps
Force specific locale
Titanium Daemon
• Server that runs in background
• Plugin architecture
• Device notifications
– Connected devices

• Environment caching
• Check for Titanium updates
• Web server plugin w/ interface
– Environment info (same as "ti info")
– Debug proxy
– Serve Titanium Mobile Web apps

• Run similar to "adb"
– Do not require root priviledges
?
Questions?
Thank you!
cbarber@appcelerator.com
Twitter: @cb1kenobi
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013

Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013

  • 1.
    Titanium 3.2 CLI ChrisBarber Titanium Engineer Extraordinaire TiAppCamp 2 / Nov 2, 2013
  • 2.
    About Me • Beenwith Appc 3 ½ years • Stuff I've done – Early versions of www site – Dev center Q&A – Titanium Mobile Web platform – Titanium CLI – Titanium platform build scripts • JavaScript Guru
  • 3.
    What's New in3.2 Titanium 3.0.0, 3.0.1, 3.0.2, 3.0.3 Titanium 3.1.0, 3.1.1, 3.1.2, 3.1.3 Titanium 3.2.0 778 816 1717+
  • 4.
  • 5.
    Titanium CLI • • • • Complete overhaul Betterselected SDK handling New setup wizard New prompting library – http://npmjs.org/package/fields • Command improvments – info, module, plugin, sdk, setup • More config settings • Unit tests
  • 6.
    Setup Command • Newmenu design • Improved quick setup • New check environment
  • 7.
    Info Command • node-appcversions • Mac OS X command line tools • Intel HAXM (Hardware Accelerated Execution Manager) • Xcode support • Improved iOS cert and provisioning profile detection • Android & iOS Devices & Emulators/Simulators • Environment Issues
  • 8.
    Config Settings • • • • • • • • • • cli.ignoreDirs cli.ignoreFiles cli.progressBars (true) cli.width(100) paths.hooks paths.modules paths.plugins paths.sdks sdk.defaultInstallLocation sdk.selected (formerly app.sdk)
  • 9.
  • 10.
    Android Build • • • • • • Complete rewritefrom Python to Node.js Support for CLI plugins Android 2.3.3 no longer required Builds are about 13% faster Nearly 100 bug fixes Distribution builds much, much faster thanks to UglifyJS • Support for multiple emulators AND devices • No longer creates AVDs, you manage your own
  • 11.
    • • • • • Fast x86 Androidemulator Built on top of VirtualBox Beta support with Titanium http://www.genymotion.com/ titanium config genymotion.enabled true
  • 12.
  • 13.
    iOS Build • • • • • • • • Builds areabout 20% faster Xcode 5.0.1 and iOS 7.0.3 support 64-bit iOS Simulator support iOS Simulator profiles Fixed several bugs Improved validation Improved symbol detection Certificate and provisioning profile selection
  • 14.
    No More iTunesSync • Direct install to iOS device • Insanely fast • Supports install to multiple devices simultaneously • https://npmjs.org/package/node-ios-device
  • 15.
  • 16.
    CLI Plugins • Containscommands, event hooks, & function hooks • Global and per-project • Global and Module hooks
  • 17.
    Anatomy of aCLI Command • /some/dir/mycommand.js • ti config -a paths.commands /some/dir • ti mycommand -baz wow
  • 18.
    Anatomy of aCLI Hook • /some/dir/myhook.js • ti config -a paths.hooks /some/dir
  • 19.
    Packaging a CLIPlugin • Global plugins go in ~/Library/Application Support/Titanium/plugins – Can contain commands and hooks – Automatically loaded for every Titanium command
  • 20.
    Packaging a CLIPlugin • Project plugins go in <project dir>/plugins • Can contain hooks only – Loaded by "build" and "clean" commands • Must be enabled in tiapp.xml
  • 21.
    Available Plugin Hooks EventHooks Function Hooks • • • • • • • • • • • • • • • • • • • • • • • • • cli:command-not-found cli:command-loaded cli:pre-validate cli:post-validate cli:pre-execute cli:post-execute help:header build.pre.construct build.pre.compile build.post.compile build.finalize build.config build.android.config build.android.copyResource build.android.compileJsFile build.android.dexerArgs build.android.javacArgs build.android.writeBuildManifest build.android.startEmulator build.ios.config build.ios.writeBuildManifest build.ios.copyResource build.ios.compileJsFile build.mobileweb.config clean.config
  • 22.
    How to getit: npm install -g git://github.com/appcelerator/titaniu m.git ti sdk install -b master -d DISCLAIMER: This is not fully tested. This is not stable code. Use at your own risk.
  • 23.
  • 24.
    Build Profiles • Controlsbuild settings – JavaScript minification – JavaScript encryption – Debugging – etc • Global or per-project • Project-level defined in tiapp.xml – Can contain any tag
  • 25.
  • 26.
    Export Command • Generatestandalone Xcode (iOS) or Eclipse (Android) projects • No dependency on Titanium • Replaces transport.py
  • 27.
    Improved Logging • • • • • Console-only today Filelogging, especially for builds Destination specific logging Timestamps Force specific locale
  • 28.
    Titanium Daemon • Serverthat runs in background • Plugin architecture • Device notifications – Connected devices • Environment caching • Check for Titanium updates • Web server plugin w/ interface – Environment info (same as "ti info") – Debug proxy – Serve Titanium Mobile Web apps • Run similar to "adb" – Do not require root priviledges
  • 29.
  • 30.

Editor's Notes

  • #2 Titanium 3.2… or &quot;how I spent the last 6 months of my life&quot;
  • #3 Follow me for important info like what I ate for breakfast
  • #4 Titanium 3.2… or &quot;how I spent the last 6 months of my life&quot;
  • #5 Titanium 3.2… or &quot;how I spent the last 6 months of my life&quot;
  • #10 Titanium 3.2… or &quot;how I spent the last 6 months of my life&quot;
  • #13 Titanium 3.2… or &quot;how I spent the last 6 months of my life&quot;
  • #16 Titanium 3.2… or &quot;how I spent the last 6 months of my life&quot;
  • #23 Titanium 3.2… or &quot;how I spent the last 6 months of my life&quot;
  • #24 Titanium 3.2… or &quot;how I spent the last 6 months of my life&quot;
  • #30 !!! Presentation Tip !!! Use relevant icons to mark each section.Sectional transition sides help divide up the presentation and the guide the audience to the next topic of discussion