[TIMOB-26876] iOS: Cannot debug a project with hyperloop enabled
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-06-25T20:46:00.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Hyperloop 4.0.3 |
Components | Hyperloop, iOS |
Labels | n/a |
Reporter | Satyam Sekhri |
Assignee | Christopher Williams |
Created | 2019-03-04T18:15:25.000+0000 |
Updated | 2019-06-25T20:46:00.000+0000 |
Description
Cannot debug a project that has hyperloop enabled. The issue is with debug on iOS only as the debug on same project works fine wth Android
Steps to Reproduce:
1. Create a default titanium project with services enabled
2. Add a breakpoint in the js file
3. Debug on iOS simulator or device
Actual Result:
The breakpoints are not hit during the debug. If we remove hyperloop from the project the same breakpoints are hit successfully.
Expected Result:
The debug should work even for projects with hyperloop
I took a look at this today and with my testing I was able to use the debugger with Hyperloop enabled in the
tiapp.xml
. *Test Environment*Still can see some issues with debug when hyperloop is enabled. There is a distinguished difference in debug behaviour when hyperloop is enabled for the project and when it's removed. Follow the steps below to notice the difference in debug behaviour: 1. Create a new alloy project using the "Default Alloy Project" template and with services enabled. 2. In index.js file, add a breakpoint at line 2 which is _alert($.label.text);_ 3. Now debug on iOS simulator 4. Next from tiapp.xml, remove the hyperloop module for iOS. 5. Again debug on iOS simulator Actual Results: After Step 3: Notice the debug suspends during app launch and the breakpoint we added on line 2 is hit during app launch itself. It was supposed to be hit when we click on the label not on app launch. Click on resume. When app launches click on the "Hello, World" label. No breakpoint is hit. After Step 5: No breakpoint is hit during app launch. The app launches. Click on "Hello, World" label and the breakpoint on line 2 is hit. Note: On Android we see the same behaviour on step 3 and step 5 which is same as what we see on step 5 when debug on iOS. Verified using Studio: 5.2.0.201905172239 and Ti SDK: 8.1.0.v20190520081553
Note that [~eharris] and [~shaig] also ran into an issue here. It appears that adding hyperloop to the project will result in it injecting additional newlines into the generated code - leading to the breakpoint lines not matching up. The most likely culprit here is hyperloop transforming the code via babel in some way that does not retain the same line numbers. Hopefully the fix is as simple as passing an option to tell babel to retain lines. The more complicated options is to try and merge source maps again like we do in node-titanium-sdk's jsanalyze method.
Hyperloop is unnecessarily modifying JS files on iOS when nothing should be changing. On Android, it doesn't seem to cause a bug, but it is still doing unnecessary work (re-generating source from the AST) if we don't change the AST (find usage of a hyperloop require/import).
https://github.com/appcelerator/hyperloop.next/pull/321
FR Passed. Debug of project with Hyperloop works fine on iOS and android.
Verified on: Mac OS 10.14.3 Ti SDK: 8.1.0.v20190619134801 Appc CLI: 7.1.0-master.22 Node: 10.13.0 Alloy: 1.14.0-1 Hyperloop: 4.0.3 JDK: 1.8.0_144 Xcode: 10.2.1