Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26438] CLI: Not all arguments/options forwarded to forked SDK call when tiapp version isn't selected SDK

GitHub Issuen/a
TypeBug
PriorityHigh
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 7.4.0
Fix Version/sn/a
ComponentsCLI
Labelscb-tooling
ReporterChristopher Williams
AssigneeEwan Harris
Created2018-10-05T16:51:08.000+0000
Updated2020-01-30T22:02:16.000+0000

Description

I was attempting to manually debug an Android project through Chrome's DevTools. To do so, I was running: ti build -p android --debug-host /127.0.0.1:51388 But since my selected SDK was a locally built 8.0.0 dev SDK, it "forked" the call to the SDK versions from the project's tiapp.xml - but it *did not forward the debug-host option/value*

Comments

  1. Ewan Harris 2018-12-18

    So I took a quick look at this, I believe this occurs because when we fork an sdk [here](https://github.com/appcelerator/node-titanium-sdk/blob/bb0a93a33fd2999a65950a1fce8955e3b3103c1f/lib/titanium.js#L586-L591) we copy across all the known flags and options by looking at the various contexts (global context, command context, platform specific command context) When I had an SDK that I built locally for iOS only it would drop all the options/flags that were android specific i.e. the --debug-host flag, if i built that SDK for android then they would be forwarded as they are known to the command context. I would guess that this is expected behaviour, but maybe we do want to forward unknown args to the forked SDK? I think the best person to ask is [~cbarber] :)
  2. Chris Barber 2018-12-18

    I'm not sure why it's not picking up the \-\-debug\-host flag. It should work.
  3. Ewan Harris 2018-12-18

    I think it makes sense (given the current code) why it's not picking it up. In the fail case the SDK forking the command only has iOS as a platform, so it can't know about any options/flags defined by android (such as --debug-host), so when it loops over the various command contexts trying to decide what flags should be copied over it will drop the things it doesn't know. Once I build that SDK with Android and iOS, it knows to pass through --debug-host because it now is aware of the flag through Android command context. I'm assuming that this was intended behaviour, and that there is reasoning for us not forwarding unknown args, but I can see why we would also want possibly forward unknown args.
  4. Chris Barber 2018-12-18

    We don't forward args because there was a time when we thought we were going to have to map options where the option name would change. That hasn't really happened. So the question comes down to this: does the SDK that [~cwilliams] built locally include Android? If yes, then add the output where it says forking the correct SDK. If no, then build the SDK with Android, give it a try, and resolve this ticket.

JSON Source