Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25748] iOS: Remove TiCore in favor of built-in JavaScriptCore #9798

Merged
merged 28 commits into from
Jul 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8c20c0a
Remove TiCore
hansemannn Feb 4, 2018
4346b2e
Remove Ti -> JS aliases, remove TiCore references in the CLI, unlink …
hansemannn Feb 4, 2018
31b1357
Fix sorted imports
hansemannn Feb 4, 2018
ee8bd34
Fix typo
hansemannn Feb 4, 2018
b42f740
Another typo
hansemannn Feb 4, 2018
f713a31
Merge branch 'master' into remove-ticore
hansemannn Feb 5, 2018
b8cc542
Remove TiProfiler and TiDebugger, cleanup build scripts
hansemannn Feb 6, 2018
3ea5e1e
Merge branch 'master' into remove-ticore
hansemannn Feb 6, 2018
dd968e6
Merge branch 'master' into remove-ticore
hansemannn Feb 7, 2018
c864ca4
Merge branch 'master' into remove-ticore
sgtcoolguy Feb 7, 2018
340f65b
Fix so Ti.UI.TextArea.editable defaults to true (matching our docs).
sgtcoolguy Feb 7, 2018
6ca4155
Don't try to copy headers folder that no longer exists. Clean up unus…
sgtcoolguy Feb 8, 2018
d1256d9
Merge branch 'master' into remove-ticore
sgtcoolguy May 14, 2018
1dd0fbd
Fix indentation, remove unused 'humanize' dependency
sgtcoolguy May 14, 2018
d5060c8
Merge branch 'master' into remove-ticore
hansemannn Jul 20, 2018
01593be
Resolve remaining merge conflicts
hansemannn Jul 20, 2018
a99030b
Linting
hansemannn Jul 20, 2018
5502a7d
Update PlatformModule.m
hansemannn Jul 20, 2018
378f387
Update TiDOMDocumentProxy.m
hansemannn Jul 20, 2018
292312d
Merge branch 'master' into remove-ticore
sgtcoolguy Jul 23, 2018
53562aa
Fix formatting
sgtcoolguy Jul 23, 2018
823f6e4
Restore package-lock.json, restore iOS CLI option
hansemannn Jul 25, 2018
5ed1827
Use Hyperloop 3.1.0
hansemannn Jul 24, 2018
f8a8ed9
[TIMOB-26055] Android: Fixed bug where CLI would only replace 1st ins…
jquick-axway Jul 25, 2018
dcc8cd6
[TIMOB-26204] Android: Fix transformAfterLayout NPE (#10202)
drauggres Jul 25, 2018
dbc3dda
[TIMOB-26211] Round percentage up instead of down (parity) (#10194)
hansemannn Jul 25, 2018
0c18778
Migrate tests to suite
sgtcoolguy Jul 25, 2018
f6d0a07
Bump to 8.0.0, publish 'next' branch.
sgtcoolguy Jul 25, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ properties([buildDiscarder(logRotator(numToKeepStr: '15', artifactNumToKeepStr:

// Some branch flags to alter behavior
def isPR = env.CHANGE_ID || false // CHANGE_ID is set if this is a PR. (We used to look whether branch name started with PR-, which would not be true for a branch from origin filed as PR)
def MAINLINE_BRANCH_REGEXP = /master|\d_\d_(X|\d)/ // a branch is considered mainline if 'master' or like: 6_2_X, 7_0_X, 6_2_1
def MAINLINE_BRANCH_REGEXP = /master|next|\d_\d_(X|\d)/ // a branch is considered mainline if 'master' or like: 6_2_X, 7_0_X, 6_2_1
def isMainlineBranch = (env.BRANCH_NAME ==~ MAINLINE_BRANCH_REGEXP)
def isGreenKeeper = env.BRANCH_NAME.startsWith('greenkeeper/') || 'greenkeeper[bot]'.equals(env.CHANGE_AUTHOR) // greenkeeper needs special handling to avoid using npm ci, and to use greenkeeper-lockfile

Expand Down
4 changes: 2 additions & 2 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3888,9 +3888,9 @@ AndroidBuilder.prototype.generateAndroidManifest = function generateAndroidManif
if (fs.existsSync(libraryManifestPath)) {
let libraryManifestContent = fs.readFileSync(libraryManifestPath).toString();

// handle injected build variables
// handle injected build variables such as ${applicationId}
// https://developer.android.com/studio/build/manifest-build-variables
libraryManifestContent = libraryManifestContent.replace('${applicationId}', this.appid); // eslint-disable-line no-template-curly-in-string
libraryManifestContent = libraryManifestContent.replace(/\$\{applicationId\}/g, this.appid); // eslint-disable-line no-template-curly-in-string

const libraryManifest = new AndroidManifest();
libraryManifest.parse(libraryManifestContent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ public void callAsync(KrollObject krollObject, HashMap args)
public void callAsync(KrollObject krollObject, Object[] args)
{
bTransformPending.set(false);
proxy.handlePendingAnimation(true);
p.handlePendingAnimation(true);
}
});
animBuilder.start(p, v);
Expand Down
59 changes: 7 additions & 52 deletions build/ios.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
'use strict';

const exec = require('child_process').exec, // eslint-disable-line security/detect-child-process
path = require('path'),
const path = require('path'),
async = require('async'),
fs = require('fs-extra'),
utils = require('./utils'),
copyFiles = utils.copyFiles,
copyAndModifyFile = utils.copyAndModifyFile,
copyAndModifyFiles = utils.copyAndModifyFiles,
globCopy = utils.globCopy,
downloadURL = utils.downloadURL,
ROOT_DIR = path.join(__dirname, '..'),
IOS_ROOT = path.join(ROOT_DIR, 'iphone'),
IOS_LIB = path.join(IOS_ROOT, 'lib'),
TI_CORE_VERSION = 24,
TI_CORE_INTEGRITY = 'sha512-iTyrzaMs6SfPlyEgO70pg8EW08mn211tjpAI5hAmRHQaZGu1ieuBnT8uEkEYcsO8hdzAFbouqPPEaXWcJH5SLA==';

function gunzip(gzFile, destFile, next) {
console.log('Gunzipping ' + gzFile + ' to ' + destFile);
exec('gunzip -dc "' + gzFile + '" > "' + destFile + '"', function (err) {
if (err) {
return next(err);
}
next();
});
}
IOS_LIB = path.join(IOS_ROOT, 'lib');

/**
* @param {Object} options options object
Expand All @@ -43,35 +29,9 @@ IOS.prototype.clean = function (next) {
next();
};

IOS.prototype.fetchLibTiCore = function (next) {
const url = 'http://timobile.appcelerator.com.s3.amazonaws.com/libTiCore-' + TI_CORE_VERSION + '.a.gz',
dest = path.join(IOS_LIB, 'libTiCore.a'),
markerFile = path.join(IOS_LIB, TI_CORE_VERSION.toString() + '.txt');

// Do we have the latest libTiCore?
if (fs.existsSync(dest) && fs.existsSync(markerFile)) {
return next();
}

console.log('You don\'t seem to have the appropriate thirdparty files. I\'ll fetch them.');
console.log('This could take awhile.. Might want to grab a cup of Joe or make fun of Nolan.');

downloadURL(url, TI_CORE_INTEGRITY, function (err, file) {
if (err) {
return next(err);
}
gunzip(file, dest, function (err) {
if (err) {
return next(err);
}
// Place "marker" file
fs.writeFile(markerFile, 'DO NOT DELETE THIS FILE', next);
});
});
};

IOS.prototype.build = function (next) {
this.fetchLibTiCore(next);
// no-op (used to fetch TiCore in the past)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearly not related to this PR, but this jogs my memory. Weren't we going to pre-build libraries for iOS like we do for the other platforms at some point? Do we have JIRA tickets/PRs to track that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember you had an angry TODO comment somewhere that states that we should just place libraries inside the repo instead of fetching them manually. In case you mean that, it should be obsolete now that we remove TiCore. Other libraries like libAPSHTTPClient and libAPSAnalytics are prepackaged, just like Hyperloop should / will be in the future.

next();
};

IOS.prototype.package = function (packager, next) {
Expand All @@ -80,17 +40,13 @@ IOS.prototype.package = function (packager, next) {
const DEST_IOS = path.join(packager.zipSDKDir, 'iphone');

async.parallel([
this.fetchLibTiCore.bind(this),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need to remove the step below where we try to copy iphone/headers/JavaScriptCore since there's no files there anymore (that's why the build is failing right now, lines 62-64 in your modified file) - and the 'headers' entry in the array of folders/files we try to copy (line 66 in your modified file)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also remove libti_ios_debugger.a? libti_ios_profiler.a?

Those were to be used against TiCore and do not work with JSCore.

I've been told several times we can kill off our profiler because it's not useful and no one uses/knows about it. The debugger has been replace by using the official debugger APIs built into JSCore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TiProfiler is dead. I think it was used in the past when Titanium wasn't fully compatible with Instruments, which works fine these days. I'll search related guides and docs to clarify that.

function (callback) {
async.series([
function (cb) {
globCopy('**/*.h', path.join(IOS_ROOT, 'Classes'), path.join(DEST_IOS, 'include'), cb);
},
function (cb) {
globCopy('**/*.h', path.join(IOS_ROOT, 'headers', 'JavaScriptCore'), path.join(DEST_IOS, 'include', 'JavaScriptCore'), cb);
},
function (cb) {
copyFiles(IOS_ROOT, DEST_IOS, [ 'AppledocSettings.plist', 'Classes', 'cli', 'headers', 'iphone', 'templates' ], cb);
copyFiles(IOS_ROOT, DEST_IOS, [ 'AppledocSettings.plist', 'Classes', 'cli', 'iphone', 'templates' ], cb);
},
// Copy and inject values for special source files
function (cb) {
Expand All @@ -102,7 +58,7 @@ IOS.prototype.package = function (packager, next) {
copyAndModifyFiles(path.join(IOS_ROOT, 'Classes'), path.join(DEST_IOS, 'Classes'), [ 'TopTiModule.m', 'TiApp.m' ], subs, cb);
}.bind(this),
function (cb) {
copyFiles(IOS_LIB, DEST_IOS, [ 'libtiverify.a', 'libti_ios_debugger.a', 'libti_ios_profiler.a' ], cb);
copyFiles(IOS_LIB, DEST_IOS, [ 'libtiverify.a' ], cb);
},
// copy iphone/package.json, but replace __VERSION__ with our version!
function (cb) {
Expand All @@ -118,8 +74,7 @@ IOS.prototype.package = function (packager, next) {
if (err) {
return next(err);
}
// Ensure we've fetched libTiCore before we copy it
copyFiles(IOS_LIB, DEST_IOS, [ 'libTiCore.a' ], next);
next();
});
};

Expand Down
43 changes: 2 additions & 41 deletions iphone/Classes/APIModule.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2009-2018 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
Expand All @@ -10,10 +10,6 @@
#import "TiExceptionHandler.h"
#import "TiUtils.h"

#ifndef USE_JSCORE_FRAMEWORK
#import "TiDebugger.h"
#endif

extern NSString *const TI_APPLICATION_DEPLOYTYPE;

@implementation APIModule
Expand All @@ -25,42 +21,7 @@ - (NSString *)apiName

- (void)logMessage:(NSArray *)args severity:(NSString *)severity
{

#ifndef USE_JSCORE_FRAMEWORK
NSString *lcSeverity = [severity lowercaseString];
DebuggerLogLevel level = OUT;
if ([lcSeverity isEqualToString:@"warn"]) {
level = WARN;
} else if ([lcSeverity isEqualToString:@"error"] ||
[lcSeverity isEqualToString:@"critical"] ||
[lcSeverity isEqualToString:@"fatal"]) {
level = ERR;
} else if ([lcSeverity isEqualToString:@"trace"]) {
level = TRACE;
} else if ([lcSeverity isEqualToString:@"debug"]) {
level = LOG_DEBUG;
}

if ([[TiApp app] debugMode]) {
NSMutableArray *messages = [NSMutableArray arrayWithArray:args];

if (![lcSeverity isEqualToString:@"info"]) { // Custom severity, or just a badly-formed log; either way, debugger treats it as info
[messages insertObject:[NSString stringWithFormat:@"[%@]", severity] atIndex:0];
}

TiDebuggerLogMessage(level, [messages componentsJoinedByString:@" "]);
} else
#endif
{
#ifndef USE_JSCORE_FRAMEWORK
if ([TI_APPLICATION_DEPLOYTYPE isEqualToString:@"production"]) {
if (level != ERR) {
return;
}
}
#endif
NSLog(@"[%@] %@", [severity uppercaseString], [args componentsJoinedByString:@" "]);
}
NSLog(@"[%@] %@", [severity uppercaseString], [args componentsJoinedByString:@" "]);
}

- (id)transform:(id)arg
Expand Down
3 changes: 2 additions & 1 deletion iphone/Classes/KrollBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
#import "TiEvaluator.h"
#import "TiModule.h"
#import "TiProxy.h"
#import "TiToJS.h"

#import <Foundation/Foundation.h>
#import <JavaScriptCore/JavaScriptCore.h>
#include <libkern/OSAtomic.h>

#ifdef KROLL_COVERAGE
Expand Down