Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26831] TiAPI: Clarify a way to properly debug native modules

GitHub Issuen/a
TypeStory
PriorityHigh
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid, iOS
LabelsarchTriage
ReporterHans Knöchel
AssigneeAbir Mukherjee
Created2019-02-16T09:29:47.000+0000
Updated2021-02-06T10:01:17.000+0000

Description

We use a *lot* modules (~ 40, about half/half iOS/Android) in our project - many of them are maintained by ourselves which is fine. We love the performance of them, but find it nearly impossible to debug them in a proper way. *iOS* For iOS, we used to create a demo project that includes a pre-built version of module, open the generated project, drag the app.js to the Resources group, drag the module project into the Xcode project, link the module product into the main target and add the module project as a build dependency aaaand build. Sounds complicated? It is! Unfortunately, this is not even possible since 7.5.0 because of the new "ti.main" file that is not part of the project so it either needs to be copied from the SDK source to the Xcode project or just be renamed in the kroll core to "app.js" so it directly accesses the app.js. In SDK 8, this is also not possible anymore, because the TitaniumKit.framework manages the kroll-core, so it's precompiled already and cannot be changed during a generated project (except ripping it out again and re-referencing the project again). Still can follow? Ok, here is the suggestion: Fix the generated project (!). This has been discussed in numerous other tickets, Slack threads and StackOverflow posts. People should be able to just open the generated project and do whatever they want to with it. Practically, this means that all source files should be linked as resources *or* be copied to the product with a simple build-phase script. This would solve most of our iOS issues regarding developer-experience already. *Android* For Android, we still need to trial-and-error every module change, means to change something in the *.java files, compile it, add it to a project, clean the project, do a full build and see what comes out of it. I heard of a way to integrate modules into Android Studio, but there is zero documentation about that. As a developer, I'd love to just open the module directory in Android studio and Android studio would link all necessary libraries to it, so the module runs. Bonus: The best would be to just pick up the example/app.js that is available in every module project and link that one to a "module demo project". Maybe a new ti command or npm package could be "ti build -p ios --test-module" from the module project and it would be smart enough to a) check the directories for ios/android and b) check the example/app.js for an execution point and then just run the project. Something similar (I think) is already done when using "ti build" alone, which uses the app.js as well, but it doesn't link anything, so debugging is not possible either. Sorry for the long text, but I hope I get can something started with this! Maybe it's not too hard to do, as many of the required components are already in place and "just" need to be combined. Thx!

Comments

  1. Hans Knöchel 2021-02-06

    Since this ticket did not receive any feedback from Appcelerator, I took a look at it myself. The good thing: I found a way to run generated iOS projects from build/iphone (and even if they're Alloy-based). The bad thing: It will require some CLI changes that Appcelerator may not like. Trying to come up with a PR soon.

JSON Source