If you don't use cros workon you can stop reading now.
TL;DR: cros workon -b $BOARD start ./source_code.c
Support for path arguments has landed for cros workon!
If you find yourself making changes to a file but you're not sure what package it belongs to, rather than manually looking up the package you can now just pass the file path to cros workon. It should work with files and directories, and inside and outside of the chroot (but the `cros-workon-$BOARD` wrappers are still only available inside).
The commands are the same as before, you can just pass a path instead of the package name.
If a file affects multiple packages, for now it'll just select the first one and tell you what the other packages were. This is just matching what it does when you start/stop a package it can't resolve uniquely. If different behaviors could be useful, let me know what the use case is, I'd be happy to look into it.
The caveat is that it's not a fast operation (~45-60s). Passing a package is going to be much faster if you already know it, but hopefully passing a file will be much faster than manually looking it up.
I do have some plans to make additional tools with the path->package lookup functionality, but if you have a use case where it could be helpful, I'd love to hear about it!
Thanks,
Alex