hulu / roca

A command-line tool for running brightscript tests
Apache License 2.0
25 stars 19 forks source link

Encountered an error when parsing component #35

Open adheus opened 4 years ago

adheus commented 4 years ago

Hi, I'm trying to run roca on my project but the following error is raised:

Interpreter found an error:  Error: Encountered an error when parsing component ButtonBar: TypeError [ERR_INVALID_URL]: Invalid URL: ButtonBar.brs
    at componentDefinitions.forEach (/Users/user/Projects/roca-test-roku/nod_modules/brs/lib/index.js:66:19)

This error is while it is trying to parse the ButtonBar.xml component from Roku SGDEX(https://github.com/rokudev/SceneGraphDeveloperExtensions/tree/master/extensions/SGDEX/ButtonBar).

Did I forget to do something or is there any way that I can skip that file?

sjbarag commented 4 years ago

Hey @adheus — thanks for the clear bug report! I suspect this is caused by the fact that SGDEX uses relative paths in its <script/> tags, but brs (the brightscript interpreter that roca runs in) doesn't support those yet. I'll file an issue over in that project to get that supported — hopefully we can get that released pretty soon 😅

In the meantime, you should be able to get around it by replacing the three relative path uri attributes in ButtonBar.xml with absolute paths (e.g. pkg:/path/to/ButtonBar.brs, pkg:/path/to/ContentManager/ContentManagerUtils.brs, and pkg:/path/to/Views/utils/Utils.brs). I know that's a pain to do repeatedly for all the SGDEX components, so hopefully this is a one-off change for now while we get relative paths supported upstream.

Sorry for the confusion!

adheus commented 4 years ago

In case anyone wants to quickly port a project. I've created a Python script Gist to patch this(don't run this unless you can revert any changes):

https://gist.github.com/adheus/aed5d859da761f4f36e89998c4354b35