TiConf EU 2014

Post on 16-Apr-2017

3.379 views 1 download

Transcript of TiConf EU 2014

TiConf EU AmsterdamINGO MUSCHENETZSr. Director of Platform and Tooling, Appcelerator@bingomar

About Me

Currently responsible for all “Client” productsLed design of Aptana, an open-source Web IDEAptana acquired by Appcelerator. Aptana folded into Titanium Studio10+ years fostering vibrant open source communitiesArchitected web-based framework for secure DoD healthcare applications (acquired by Humana)

We can’t build it alone…

The Titanium CommunityA FORCE FOR GOOD

TITANIUM IS GROWING UP

NUMBER OF UNIQUE MOBILE DEVICES

250,000,000

NUMBER OF REGISTERED TITANIUM DEVELOPERS

604,000

NUMBER OF CLOUD API REQUESTS

30,000,000,000

FORTUNE 100 COMPANIES USING TITANIUM

68% of F100

The road ahead

Upcoming Titanium Release

3.3.0 – targeted for mid-July800+ issues addressed (50% bugs, 50% features)Continued performance & parity improvements

Ti.include()[gone!]*

*deprecated in 3.3.0. Will go away in 3.4.0

Alloy

Custom TSS queries<Annotation> tag support in maps, plus data-binding for annotation generationWidget themesCustomizing the Android ActionBar using the <Menu> tagCreating Date/Time pickersKeyboard and returnkey type shortcuts

Demo: AlloyCUSTOM TSS QUERIES

Custom TSS Queries

'#boydlee': {image: '/boydlee.jpg',width: '75%',top: 10,borderWidth: 3

}

/* CUSTOM TSS QUERIES */

'#boydlee[if=Alloy.Globals.isTalliPhone]': {image: '/boydlee0.jpg',borderColor: '#4682b4'

}

'#boydlee[if=Alloy.Globals.isGalaxyS5]': {image: '/boydlee1.jpg',borderColor: '#70a050'

}

CLI

Windows HybridProject templatesConsolidated module projectsdeploy.json is baked into the APKNo more version number formatting for iOS and AndroidDisplay iOS logging when running app on deviceGenymotion officially supported (includes debugging)

SDK

NSURLConnectionAppCompat libraryCoreMotion moduleView Clipping/View ShadowsFull-text search of documentationBlackBerry updates

Studio

Push to device is default (no iTunes sync)Improved Studio Packaging (smaller, more robust)Configuring Studio proxy configures CLI proxyAlloy productivity features:

Jump to event/class/id definitions from controller classCreate event/class /id definitions from controller classCreate new view and style files through context menu

Active Committers• Opened up Appcelerator

Community• Reduced active PRs

backlog by 50%• Invited Open-Source

module committers• Move wiki guides public

and invite comments• Prettify public spaces

Automation and Testing

ti-mochaFramework for running Mocha-based unit tests in TitaniumBeta stagehttps://github.com/tonylukasavage/ti-mocha

tio2Framework for running Ti-mocha tests on emulators and devices and reporting resultsAlpha stagehttps://github.com/appcelerator/tio2

That was the first half (H1) of 2014.How about H2 …or H6?

Ti.Next

Next major release of Titanium (aka 4.0)Significant re-architecture of Titanium(Mostly) same APIHuge performance boost and reduction in app sizeImproved extensibilityWindows support

Ti.Next Foundation

Foundation of Ti.Next is a new compiler, built from the ground up for performance, extensibility

Open Source under Apache Public License v2http://github.com/appcelerator/hyperloopOver a year of R&D already on Hyperloop (6th generation compiler under development)

Hyperloop fundamentally changes game

Hyperloop will allow mixed modes of integration:Titanium traditional (all-in)Titanium in NativeNative in TitaniumTitanium in other frameworks (Phonegap, Xamarin)Pure Native (Hyperloop only)

What is Hyperloop?

Hyperloop turns JS code into native code by mapping the native APIs into JS syntaxHyperloop will be (mainly) used by Titanium platform developers to build Titanium APIs or modulesA more traditional compiler architecture:

Front-end (parse and transform JS AST)Back-end (generate native, platform specific code)+Metabase (metadata about target platform)

Hyperloop iOS Example

“use hyperloop”

var view = new UIView(CGRectMake(100,100,50,50));

view.backgroundColor = UIColor.redColor();

var window = new UIWindow();

window.addSubview(view);

window.makeKeyAndVisible()

Need to revist (dn’t pollute the global namespace)

Hyperloop Front-end

Front-end turns JS code into an AST and then performs transformations on the code to make it more suitable for native generation.

JavaScript to Native

Ti.Current

app.js

Titanium SDK (JS)

Titanium SDK

(Native)

Ti.Next (Dev-Time)

app.js

Titanium SDK (JS)

Ti.SDK (Native)

Ti.Next (Runtime)

Ti.SDK (Native)

app.js (JS)

app.js (Native)

Ti.SDK (JS)

Example Generation

app.js:

var b = 1;

HL_jscode.mm:

// variable:12 auto b = JSValueMakeNumber(ctx,1);auto var13 = JSStringCreateWithUTF8CString("b");JSObjectSetProperty(ctx,object,var13,b,0,exception);CHECK_EXCEPTION(exception);

JavaScript to Native Compilation

Ti.Current FutureImproved HeuristicsHyperloop

(H1)Hyperloop

(H6)

JavaScript

Native

JavaScriptCore

Hyperloop Back-end

Back-end generates C/C++ code for target platform

~90% of the back-end code is reusable for all platforms supported10% is basically specific syntax for things like calling methods, properties, etc. and other platform specific nuances (differences in file extensions, etc.)

Hyperloop Metabase

Defined platform APIs in JSON formatAutomatically generated for all platforms supportedComplete tree of a platform’s public API (classes, functions, types, etc.)Supports C and platform-specific languages (Objective-C, Java, etc.)Uses Clang (+platform specific tools) to generateRich metadata about the platform

Hyperloop Android Metabase example

"java.lang.String": { "package": "java.lang", "interfaces": [ "java.io.Serializable", "java.lang.Comparable", "java.lang.CharSequence" ], "superClass": "java.lang.Object", "attributes": [ "final", "public" ], "metatype": "class", "methods": { "<init>": [ { "exceptions": [], "args": [], "name": "<init>", "attributes": [ "public" ],

Hyperloop iOS Metabase example

"NSString": { "metatype": "interface", "framework": "Foundation", "superClass": "NSObject", "protocols": [ "NSCopying", "NSMutableCopying", "NSSecureCoding" ], "name": "NSString", "methods": { "length": [ { "name": "length", "metatype": "method", "instance": true, "selector": "length", "returnType": "unsigned int", "returnSubtype": "NSUInteger", "requiresSentinel": false, "args": [] } ],

Hyperloop Windows Metabase example

"Platform.String": { "methods": { ".ctor": [ { "attributes": [ "public", "hidebysig", "specialname", "rtspecialname", "instance", "runtime", "managed" ], "returnType": "void", "name": ".ctor", "args": [] } ], "modopt": [ { "attributes": [ "public", "hidebysig”,

Hyperloop JS engine

Unified JS engine for all platforms based on JavaScriptCore

iOS 7.0+ comes with engine installedPort for Windows and Android

Performance testing showed JSC was basically native speed

Hyperloop code re-writing

Huge blocks of code are optimized into pure native code generationNo penalty for “JS bridge” like in Ti.currentJS engine runs on main UI thread:

No thread context switching / creation overheadWill provide background worker for asynchronous non-blocking tasks

Hyperloop Experimentation

git clone https://github.com/appcelerator/hyperloop.gitgit checkout v2.0.0./setup.shcd hyperloop-clisudo npm link

Hyperloop Run (iOS)

cd <project directory>hyperloop clean library compile package launch --src=. --arch=i386

Interesting options:--dump-ir.hyperloop file, add { "obfuscate": false }

Demo: Hyperloop On AndroidGENERATION 6 COMPILER (H6)

Demo: Hyperloop On WindowsGENERATION 6 COMPILER (H6)

Ti.Next

Titanium APIs are being implemented using Hyperloop and compiled using Hyperloop compiler

Titanium APIs (and native APIs) will be first-class JS objectsGoal is to generate API interfaces, test cases from API documentationFull Node.js require implementationWill likely deprecate platform specific APIs and provide a compatibility moduleLikely will reduce size of overall APITitanium APIs will use module design

Ti.Next Modules

Migration path for modules (still trying to determine)Packaging likely will change and modules will be expressed in Hyperloop syntaxPossibility of a module compatibility shim

Hyperloop in Ti.Current

Hyperloop is already being used in Ti.Current!

URLSession API in Titanium 3.2CoreMotion API in Titanium 3.3https://github.com/appcelerator/hyperloop/wiki/Using-Hyperloop-code-in-Ti.Current-SDKProbably our compatibility layer (so API will be same to developer, implementation different)

When?

Gen6 compiler close to release:Almost have enough completed for all 3 major backends (iOS, Android, Windows) before Ti.Next API framework design can startLikely 6+ months from this pointTarget is beta before end of year…could be soonerLikely Windows Developer Preview Release first

iOS 8

Similar approach to iOS 7. Pre-releases track public betasIn planning stages now. Gathering feedback on areas of interest

Capability of adding interactive widgets to the notifications areaHealth Kit / Home KitAdding Extensions to the Share SheetMultiple keyboardsCamera APIs / Touch API

TO NEW ADVENTURES

Thank YouINGO MUSCHENETZ@bingomar