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-23136] iOS: Deprecate TiJSCore / Kroll-Thread #9237

Merged
merged 2 commits into from
Jul 21, 2017
Merged
Changes from 1 commit
Commits
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
43 changes: 35 additions & 8 deletions iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,37 @@ var platformsRegExp = /^(android|ios|iphone|ipad|mobileweb|blackberry|windows|ti
function iOSBuilder() {
Builder.apply(this, arguments);

// the minimum supported iOS SDK required when building
this.minSupportedIosSdk = parseInt(version.parseMin(this.packageJson.vendorDependencies['ios sdk']));

// the maximum supported iOS SDK required when building
this.maxSupportedIosSdk = parseInt(version.parseMax(this.packageJson.vendorDependencies['ios sdk']));

// object mapping the build-targets to their deploy-types
this.deployTypes = {
'simulator': 'development',
'device': 'test',
'dist-appstore': 'production',
'dist-adhoc': 'production'
};

// list of available build-targets
this.targets = ['simulator', 'device', 'dist-appstore', 'dist-adhoc'];

// object of device families to map the --device-family parameter to the
// native TARGETED_DEVICE_FAMILY build-setting
this.deviceFamilies = {
iphone: '1',
ipad: '2',
universal: '1,2',
watch: '4'
};

// device-family set by the --device-family parameter
this.deviceFamily = null;

// blacklisted files and directories that throw an error when used and will
// lead to a rejection when submitted
this.blacklistDirectories = [
'contents',
'resources',
Expand All @@ -85,20 +95,26 @@ function iOSBuilder() {
'hyperloop'
];

// graylisted directories that throw a warning when used and may lead to a
// rejection when submitted
this.graylistDirectories = [
'frameworks'
];

// templates-directory to render the ApplicationRouting.m into
this.templatesDir = path.join(this.platformPath, 'templates', 'build');

// object of all used Titanium symbols, used to determine preprocessor statements, e.g. USE_TI_UIWINDOW
this.tiSymbols = {};

// when true, uses the JavaScriptCore that ships with iOS instead of the original Titanium version
this.useJSCore = false;
this.useJSCore = true;

// when false, JavaScript will run on its own thread - the Kroll Thread
this.runOnMainThread = false;
this.runOnMainThread = true;

this.useAutoLayout = false;

// populated the first time getDeviceInfo() is called
this.deviceInfoCache = null;

Expand Down Expand Up @@ -2269,19 +2285,30 @@ iOSBuilder.prototype.initialize = function initialize() {
this.currentBuildManifest.encryptJS = !!this.encryptJS
this.currentBuildManifest.showErrorController = this.showErrorController

// This is default behavior for now. Move this to true in phase 2.
// Remove the debugHost/profilerHost check when we have debugging/profiling support with JSCore framework
// TIMOB-17892
this.currentBuildManifest.useJSCore = this.useJSCore = !this.debugHost && !this.profilerHost && (this.tiapp.ios['use-jscore-framework'] || false);
// Remove this check on 6.0.0
// Use native JSCore by default (TIMOB-23136)
this.currentBuildManifest.useJSCore = this.useJSCore = !this.debugHost && !this.profilerHost && (this.tiapp.ios['use-jscore-framework'] || true);
Copy link
Contributor

Choose a reason for hiding this comment

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

The check is wrong. Try:

this.currentBuildManifest.useJSCore = this.useJSCore = !this.debugHost && !this.profilerHost && this.tiapp.ios['use-jscore-framework'] !== false;


// Remove this check on 7.0.0
if (this.tiapp.ios && (this.tiapp.ios.hasOwnProperty('run-on-main-thread'))) {
this.logger.info(__('run-on-main-thread no longer set in the <ios> section of the tiapp.xml. Use <property name="run-on-main-thread" type="bool">true</property> instead'));
this.logger.warn(__('run-on-main-thread no longer set in the <ios> section of the tiapp.xml. Use <property name="run-on-main-thread" type="bool">true</property> instead'));
this.currentBuildManifest.runOnMainThread = this.runOnMainThread = (this.tiapp.ios['run-on-main-thread'] === true);
} else {
this.currentBuildManifest.runOnMainThread = this.runOnMainThread = (this.tiapp.properties && this.tiapp.properties.hasOwnProperty('run-on-main-thread') && this.tiapp.properties['run-on-main-thread'].value || false);
}
this.currentBuildManifest.useAutoLayout = this.useAutoLayout = this.tiapp.ios && (this.tiapp.ios['use-autolayout'] === true);

// Deprecate TiJSCore and leave a warning if used anyway
if (!this.useJSCore) {
this.logger.warn(__('Titanium 7.0.0 deprecates the legacy JavaScriptCore library in favor of the built-in JavaScriptCore'.));
Copy link
Contributor

Choose a reason for hiding this comment

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

Period at the end of the line is in the wrong place:

... JavaScriptCore'.));

should be

... JavaScriptCore.'));

this.logger.warn(__('The legacy JavaScriptCore library will be removed in Titanium SDK 8.0.0.'));
}

// Deprecate KrollThread and leave a warning if used anyway
if (!this.runOnMainThread) {
this.logger.warn(__('Titanium 7.0.0 deprecates the legacy UI-execution on Kroll-Thread in favor of the Main-Thread.'));
this.logger.warn(__('The legacy execution will be removed in Titanium SDK 8.0.0.'));
}

this.moduleSearchPaths = [ this.projectDir, appc.fs.resolvePath(this.platformPath, '..', '..', '..', '..') ];
if (this.config.paths && Array.isArray(this.config.paths.modules)) {
this.moduleSearchPaths = this.moduleSearchPaths.concat(this.config.paths.modules);
Expand Down