rojo-rbx / rojo

Rojo enables Roblox developers to use professional-grade software engineering tools
https://rojo.space
Mozilla Public License 2.0
966 stars 182 forks source link

Support user plugins #55

Open LPGhatguy opened 6 years ago

LPGhatguy commented 6 years ago

Implementing this, alongside plugin config, would unblock a lot of people and let them have custom workflows.

LouieK22 commented 6 years ago

Any updates on this? This would be very useful in a lot of my workflows.

LPGhatguy commented 6 years ago

I think this is a feature that's going to have to wait until the 0.5.0 refactor, but it should happen very soon after it.

I'm not entirely sure what the interface would look like for plugins. Internal plugins use a fairly simple (but not very robust interface): https://github.com/LPGhatguy/rojo/blob/master/server/src/plugin.rs#L17-L25

One approach is to have plugins communicate with Rojo via the HTTP API (or something like JSON-RPC), which would let plugins drive their own execution and have a lot of flexibility. This would let Rojo act as a sort of mediator between Roblox Studio and any program, allowing other programs to perform commands and create instances inside the editor. This would make developing plugins pretty complicated, but would be the most flexible.

Another approach is to just have Rojo invoke a command and use stdout to determine what operations to perform. This would make Rojo the controller of anything a plugin can do. It would be less flexible, but line up with how plugins work in 0.4.x. This would let users spin up a MoonScript wrapper, for example, in an hour or two.

dimitriye98 commented 6 years ago

If it can be done, I believe both would be ideal. Have a standardized interface via some RPC protocol (I don't think HTTP is particularly suited to this purpose), but also support the use of command calls, so as to allow simple project-specific plugins to be written as a quick shell script. Admittedly, shell-scripts have some portability implications. Perhaps embed Lua and provide an API for the use of Lua scripts as plugins?

Either way, if any solution can be decided upon, I'd be likely to implement it, I'd love to be able to use MoonScript in my projects.

Kampfkarren commented 6 years ago

What exactly are you thinking of when you're talking about plugins? What will the plugins have access to/be able to hook up to?

LPGhatguy commented 5 years ago

I wrote a prototype plugin interface that communicates with an arbitrary process via stdin/stdout and serializing to bincode and JSON: https://github.com/LPGhatguy/rojo/pull/109

It's not a great interface. It also has the downside that for a project to include its own plugins, it needs to depend on some sort of scripting language runtime.

An easier approach might be to embed Lua after all! Lua can still invoke subprocesses for doing things like compiling MoonScript, but should provide just enough logic to implement a lot of simple plugins.

Kampfkarren commented 5 years ago

Lua was made for this, yeah!

LPGhatguy commented 5 years ago

The easiest approach would be to use Lua 5.3 and the rlua crate. It's not great from a compatibility-with-Roblox perspective, but wrapping Lua safely isn't terribly easy.

LPGhatguy commented 5 years ago

First pass at this is merged into master now, but behind the server-plugins Cargo feature. Subject to change, doesn't really work yet, etc.

autonordev commented 3 years ago

It's been over two years, is there any update on plugins, or any plan for them? Rojo User Plugins would be really helpful for our workflow, as rn we have to use custom tooling to do stuff either before or after it's handled by Rojo, which eats up a lot of time.

cmumme commented 3 years ago

Any update on this at all? It'd be nice to have a user plugin that obfuscates the code automatically.