rokucommunity / ropm

A package manager for the Roku platform.
MIT License
34 stars 6 forks source link

ropm is using plugins when doing ropm install/copy #26

Closed georgejecook closed 3 years ago

georgejecook commented 3 years ago

if plugins are defined bsconfig, then ropm will run all of it's sources through them. I've haredned my plugins to not crash when this happens; but it seems odd to me.

TwitchBronBron commented 3 years ago

I need some more context. Does ropm run the plugins during the bsc portion of each room module? Or does it happen only in the main project?

You should be excluding bsconfig from room module publishing. and plugins should be marked as devdependencies in published ropm modules so they don't get installed for consumers of that module..

georgejecook commented 3 years ago

oh sorry it's the host project (main project). so I do ropm copy/ropm install, and it then installs 5 ropm packages; but it runs the plugins against each source file from the ropm modules compiled brs files.

TwitchBronBron commented 3 years ago

Ok. So that is actually expected behavior. As of right now, bsc has no notion of ropm, and I'm not sure I want it to. It's up to the plug-in to determine whether it should operate on those files or not. For example, consider a logger plug-in that rips out all print statements. We would absolutely need that plug-in to work on ropm modules.

TwitchBronBron commented 3 years ago

@elsassph thoughts?

elsassph commented 3 years ago

Is the problem that ropm uses the current project's plugins/loads the project's bsconfig when installing modules?

elsassph commented 3 years ago

Or is the problem that when bsc runs to validate/build the main project you don't want ropm modules to be processed by plugins?

TwitchBronBron commented 3 years ago

Or is the problem that when bsc runs to validate/build the main project you don't want ropm modules to be processed by plugins?

This one

georgejecook commented 3 years ago

No - that's incorrect.

Is the problem that ropm uses the current project's plugins/loads the project's bsconfig when installing modules?

this is the issue. I do ropm copy and it runs the host plugins against the ropm modules being installed. I would never expect this.

I clearly expect a host project to configure it's plugins to work appropriately with whatever is in source/comps subfolders (such as roku_modules).

I do not expect doing a ropm install to cause the host projects plugins to execute against the ropm modules files, while they are being renamed.

TwitchBronBron commented 3 years ago

Ok, thanks for more info. that's the exact opposite of how I interpreted this message from you.

oh sorry. it's the host project (main project). so I do ropm copy/ropm install, and it then installs 5 ropm packages; but it runs the plugins against each source file from the ropm modules compiled brs files.

This read as: host project plugins operates against host project for every file found in ropm modules. But you are saying: ropm install executes host plugins against every ropm module during that ropm module's bsc build.

So in your example you have 1 host and 5 modules..this means your plugins executes for 6 total projects?

georgejecook commented 3 years ago

I'll verify tomorrow.

TwitchBronBron commented 3 years ago

Found the issue! Took me a while to be able to reproduce it in unit tests. Turns out it's related to how bsc uses cwd from whatever directory you are running the ropm cli.

The fix is to prevent ropm from loading any bsconfig file during ropm install of each module.