[TIMOB-27102] iOS: "appc run" wrongly edits a Titanium SDK installed file causing studio to beachball and rebuild its workspace
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-06-06T17:32:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.0.2 |
Components | CLI, iOS, Tooling |
Labels | appc, cli, engSchedule, ios, run, studio |
Reporter | Joshua Quick |
Assignee | Ewan Harris |
Created | 2019-05-25T00:33:52.000+0000 |
Updated | 2019-06-06T17:32:46.000+0000 |
Description
*Summary:*
Every time you click "Run" in Appcelator Studio to the iOS simulator, the IDE will *beachball* while rebuilding the workspace once the built app is launched in the simulator. The IDE can block for 5-60 seconds depending on the machine. While beachballing, the IDE cannot be used. Nor can you view anything being logged by the app.
_(Studio always beachballs for 1 minute for me.)_
*Cause:*
The CLI is changing the following Titanium SDK file whenever you do an
appc run
to the iOS Simulator.
./node_modules/ioslib/lib/sim_focus.scpt
Appcelerator Studio monitors for any Titanium SDK changes under the below directory. If at least 1 file is added/changed/deleted under this directory, then the IDE will "Rebuild the Workspace". The above file change is triggering this behavior for iOS simulator builds.
~/Library/Application Support/Titanium/mobilesdk
*Note:*
You can monitor file tree changes with the below node.js script. You'll need to change the below path to your equivalent SDK version folder that you plan on building with (don't forget to change <UserName
in path) and then run it in the terminal via the node
command line tool.
var fs = require("fs");
var folderPath = "/Users/<UserName>/Library/Application Support/Titanium/mobilesdk/osx/8.1.0";
fs.watch(folderPath, { recursive: true }, function(eventType, fileName) {
console.log("- [" + eventType + "] " + fileName);
});
This looks to be down to us spawning osascript to run the sim focus script. If I run
osascript "/Users/eharris/Documents/git/titanium_mobile/node_modules/ioslib/lib/sim_focus.scpt" "Simulator"
manually then I se the same changes, it looks like osascript changes the modified time every time it runs that file. Some googling threw up https://stackoverflow.com/questions/9487469/prevent-an-applescript-script-from-changing-its-own-modification-date-when-using, and it looks like because we don't declare the variables we use as local they're implicitly global, declaring them with "local" at the start of the run handler fixes this for me. I'll verify with the folks in Dublin and then PR on Monday. We could potentially ship this in 8.0.2 if it's causing issues for Studio. Note, moved to TIMOB as this is a problem with ioslib which is part of the SDK and not the appc clihttps://github.com/appcelerator/ioslib/pull/87
8_0_X PR: https://github.com/appcelerator/titanium_mobile/pull/10915 master PR: https://github.com/appcelerator/titanium_mobile/pull/10916
FR passed. No file changes in the SDK folder after build to iOS simulator. Also no more beachball/temporary hang in the studio after iOS simulator launch.
merged to master and 8_0_X
Verified the fix on SDK 8.2.0.v20190605080023, 8.1.0.v20190605095601 and 8.0.2.v20190605070127 .No beach ball occurs on running simulators *Test Enviornment:* Name = Mac OS X Version = 10.13.6 Architecture = 64bit Node.js Node.js Version = 8.9.1 npm Version = 5.5.1 Titanium CLI CLI Version = 5.1.1 Titanium SDK SDK Version = 8.2.0.v20190605080023, 8.1.0.v20190605095601 8.0.2.v2019060507012 Simulator = iphon6s iOS 11, iPhone xr iOS 12, iPhone 7 iOS 12.