Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ <h1>Hyperloop for iOS Programming Guide</h1>
<h2>Requirements</h2>
<p>You'll need to have the following minimum requirements to use Hyperloop for iOS:</p>
<ul>
<li>Titanium 5.4.0</li>
<li>Titanium 5.2.0</li>
<li>iOS 9.0 SDK</li>
</ul>
<p>Hyperloop only works with Titanium applications that are registered with the platform. If you are using a Titanium project that hasn't yet been registered, you can register it with the following command: <code>appc new --import</code>.</p>
<p>If you'd like to experience Hyperloop on your application before registering your application, you can use the following demo GUID in your tiapp.xml: <code>11111111-1111-1111-1111-111111111111</code>. However, when using a demo GUID, your application will only operate on the simulator.</p>
<h2>Pre-release Installation</h2>
<p>For pre-release, you'll need to update to the latest unreleased version of Titanium 5.4.0 by running <code>ti sdk install -b master -d</code>. Make sure you set the version of your application to use this version in your <code>tiapp.xml</code> <code>&lt;sdk-version&gt;</code>.</p>
<p>For pre-release, you'll need to update to the latest unreleased version of Titanium 5.2.0 by running <code>ti sdk install -b master -d</code>. Make sure you set the version of your application to use this version in your <code>tiapp.xml</code> <code>&lt;sdk-version&gt;</code>.</p>
<p>To run the examples application, you'll need to also install CocoaPods by running <code>sudo gem install cocoapods</code>. <em>NOTE: some users have reported problems with the built-in OSX Ruby version (1.9). CocoaPods seems to require a 2.0 or later version to install and work properly.</em></p>
<h3>Using the Hyperloop Examples project</h3>
<p>If you're going to run the <a href="https://s3-us-west-2.amazonaws.com/appc-labs-server/downloads/hyperloop-examples.zip">Hyperloop Example project</a>, you do not need to do any additional installation to use Hyperloop. The project will allow you to run on the simulator using <code>appc ti build -p ios</code>.</p>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 1.1.2
version: 1.1.4
apiversion: 2
architectures: armeabi armeabi-v7a x86
description: hyperloop-android
author: Appcelerator
license: Appcelerator Commercial License
copyright: Copyright (c) 2015 Appcelerator, Inc.
copyright: Copyright (c) 2016 Appcelerator, Inc.

# these should not be edited
name: hyperloop-android
moduleid: hyperloop
guid: bdaca69f-b316-4ce6-9065-7a61e1dafa39
platform: android
minsdk: 5.4.0
minsdk: 5.2.1
Binary file removed modules/iphone/hyperloop/1.1.2/libhyperloop-ticore.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 1.1.2
version: 1.1.4
apiversion: 2
architectures: armv7 arm64 i386 x86_64
description: hyperloop
author: Appcelerator
license: Appcelerator Commercial License
copyright: Copyright (c) 2015 by Appcelerator, Inc.
copyright: Copyright (c) 2016 by Appcelerator, Inc.

# these should not be edited
name: hyperloop
Expand Down
17 changes: 17 additions & 0 deletions plugins/hyperloop/hooks/android/metabase/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ function expandClassDependencies(metabaseJSON, className, done) {
// Mark that we visited this type so we don't multiple times
done.push(className);

//util.logger.trace('Expanding: ' + className);

// Include this class in our dependency list
expanded.push(className);

Expand Down Expand Up @@ -79,6 +81,21 @@ function expandClassDependencies(metabaseJSON, className, done) {
expanded = expanded.concat(expandClassDependencies(metabaseJSON, propertyDefinition.type, done));
}

// if this is an innerclass, add it's enclosing class as dependency
if (className.indexOf('$') != -1) {
// inner class, add it's enclosing class as dependency
expanded.push(className.slice(0, className.indexOf('$')));
} else {
// if this is not an inner class, add any inner classes underneath it as dependencies
for (var otherClass in metabaseJSON.classes) {
if (otherClass.indexOf(className + '$') == 0) {
classDef.innerClasses = classDef.innerClasses || [];
classDef.innerClasses.push(otherClass);
expanded.push(otherClass);
}
}
}

return expanded;
}

Expand Down
40 changes: 32 additions & 8 deletions plugins/hyperloop/hooks/android/metabase/templates/class.ejs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<%
var sanitizedName = classDefinition.name.replace('$', '.'),
fullName = sanitizedName,
parts = sanitizedName.split('.'),
baseName = parts[parts.length - 1],
isInnerClass = (classDefinition.name.indexOf('$') != -1),
enclosingClassName,
BASE_URL = 'http://developer.android.com/reference/' + classDefinition.name.replace(/\./g, '/').replace('$', '.') + '.html'; // Used to build up API URLs
-%>
/**
Expand All @@ -16,10 +20,12 @@ var Hyperloop = require('hyperloop');

<%
// build up the namespace to hang the class off of
if (classDefinition.name.indexOf('$') != -1) {
if (isInnerClass) {
// it's a nested class. Load up the parent, then just hang our class off of that.
enclosingClassName = classDefinition.name.slice(0, classDefinition.name.indexOf('$'));
sanitizedName = 'EnclosingClass.' + baseName;
-%>
var EnclosingClass = require('<%= classDefinition.name.slice(0, classDefinition.name.indexOf('$')) %>');
var EnclosingClass = require('<%= enclosingClassName %>');
<%
} else {
for (var i = 0; i < parts.length - 1; i++) { // don't include last segment: class base name
Expand All @@ -31,7 +37,7 @@ global.<%= parts.slice(0, i + 1).join('.') %> = global.<%= parts.slice(0, i + 1)
-%>

/**
* @class <%= sanitizedName %>
* @class <%= fullName %>
<% if (classDefinition.superClass) {-%> * @extends <%= classDefinition.superClass.replace('$', '.') %> <%} %>
* @constructor
* @see {@link <%- BASE_URL %>}
Expand Down Expand Up @@ -66,18 +72,18 @@ var SuperClass = require('<%- classDefinition.superClass %>');
} else {
-%>
<%= sanitizedName %>.toString = function() {
return "[object " + this.className + "]";
return '[object ' + this.className + ']';
};

<%= sanitizedName %>.prototype.toString = function() {
if (this._hasPointer) {
return "[object " + this.className + "]";
return '[object ' + this.className + ']';
}
return null;
};

<%= sanitizedName %>.isInstanceOf = function (self, cls) {
if (typeof cls !== "function" || typeof self !== "function") { return false; }
if (typeof cls !== 'function' || typeof self !== 'function') { return false; }
while (self) {
if (cls === self || self instanceof cls || self.className === cls.className) {
return true;
Expand All @@ -90,8 +96,8 @@ var SuperClass = require('<%- classDefinition.superClass %>');
}
-%>

<%= sanitizedName %>.className = "<%= classDefinition.name %>";
<%= sanitizedName %>.prototype.className = "<%= classDefinition.name %>";
<%= sanitizedName %>.className = '<%= classDefinition.name %>';
<%= sanitizedName %>.prototype.className = '<%= classDefinition.name %>';

// class property
Object.defineProperty(<%= sanitizedName %>, 'class', {
Expand Down Expand Up @@ -187,6 +193,24 @@ for (var propertyName in classDefinition.properties) {
}
-%>

// Inner classes
<%
if (classDefinition.innerClasses) {
for (var ic = 0; ic < classDefinition.innerClasses.length; ic++) {
var innerClassName = classDefinition.innerClasses[ic];
var baseInnerClassName = innerClassName.slice(innerClassName.indexOf('$') + 1);
-%>
Object.defineProperty(<%= sanitizedName %>, '<%= baseInnerClassName %>', {
get: function() {
return require('<%= innerClassName %>');
},
enumerable: true
});
<%
}
}
-%>

// Static fields
<%
for (var propertyName in classDefinition.properties) {
Expand Down
22 changes: 22 additions & 0 deletions plugins/hyperloop/hooks/android/metabase/templates/interface.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,27 @@ for (var propertyName in classDefinition.properties) {
}
-%>

<%= sanitizedName %>.prototype.equals = function (other) {
if (!this._hasPointer) return null;

var result = this.$native.callNativeFunction({
func: 'equals',
instanceMethod: true,
args: [other]
});
return result;
};

<%= sanitizedName %>.prototype.hashCode = function () {
if (!this._hasPointer) return null;

var result = this.$native.callNativeFunction({
func: 'hashCode',
instanceMethod: true,
args: Array.prototype.slice.call(arguments)
});
return result;
};

// export the interface
module.exports = <%= sanitizedName %>;
19 changes: 15 additions & 4 deletions plugins/hyperloop/hooks/ios/hyperloop.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function HyperloopiOSBuilder(logger, config, cli, appc, hyperloopConfig, builder
this.resourcesDir = path.join(builder.projectDir, 'Resources');
this.hyperloopBuildDir = path.join(builder.projectDir, 'build', 'hyperloop', 'ios');
this.hyperloopJSDir = path.join(this.hyperloopBuildDir, 'js');
this.hyperloopResourcesDir = path.join(this.resourcesDir, 'hyperloop');
this.hyperloopResourcesDir = path.join(this.resourcesDir, 'iphone', 'hyperloop');

this.forceMetabase = false;
this.forceStubGeneration = false;
Expand Down Expand Up @@ -496,6 +496,7 @@ HyperloopiOSBuilder.prototype.generateSourceFiles = function generateSourceFiles
this.frameworks.$metadata.sdkType,
this.frameworks.$metadata.sdkPath,
this.frameworks.$metadata.minVersion,
this.builder.xcodeTargetOS,
this.metabase,
entry.framework,
entry.source,
Expand Down Expand Up @@ -526,9 +527,13 @@ HyperloopiOSBuilder.prototype.generateSourceFiles = function generateSourceFiles
* Generates the symbol reference based on the references from the metabase's parser state.
*/
HyperloopiOSBuilder.prototype.generateSymbolReference = function generateSymbolReference() {
var symbolRefFile = path.join(this.hyperloopBuildDir, 'symbol_references.json');
var json = JSON.stringify(this.parserState.getReferences(), null, 2);

if (!this.parserState) {
this.logger.info('Skipping ' + HL + ' generating of symbol references. Empty AST. ');
return;
}
var symbolRefFile = path.join(this.hyperloopBuildDir, 'symbol_references.json'),
json = JSON.stringify(this.parserState.getReferences(), null, 2);
if (!fs.existsSync(symbolRefFile) || fs.readFileSync(symbolRefFile).toString() !== json) {
this.forceStubGeneration = true;
this.logger.trace('Forcing regeneration of wrappers');
Expand All @@ -550,6 +555,11 @@ HyperloopiOSBuilder.prototype.compileResources = function compileResources(callb
* Generates stubs from the metabase.
*/
HyperloopiOSBuilder.prototype.generateStubs = function generateStubs(callback) {

if (!this.parserState) {
this.logger.info('Skipping ' + HL + ' stub generation. Empty AST.');
return callback();
}
if (!this.forceStubGeneration) {
this.logger.debug('Skipping stub generation');
return callback();
Expand Down Expand Up @@ -921,7 +931,8 @@ HyperloopiOSBuilder.prototype.hookUpdateXcodeProject = function hookUpdateXcodeP
xobjs.PBXBuildFile[buildFileUuid] = {
isa: 'PBXBuildFile',
fileRef: fileRefUuid,
fileRef_comment: name
fileRef_comment: name,
settings: {COMPILER_FLAGS : '"-fobjc-arc"' }
};
xobjs.PBXBuildFile[buildFileUuid + '_comment'] = name + ' in Sources';

Expand Down
Binary file modified plugins/hyperloop/node_modules/hyperloop-metabase/bin/metabase
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading