AppleDash / SaneEconomy

Finally, a sane economy plugin for Bukkit.
https://www.spigotmc.org/resources/saneeconomy-simple-but-featureful-economy.26223/
GNU General Public License v3.0
19 stars 24 forks source link

Bootstrap & inject dependencies at runtime #86

Open egg82 opened 5 years ago

egg82 commented 5 years ago

Introducing dep injection! Enjoy small jar file sizes with all the benefits of an uber-jar! Updated some plugins and moved pom.xml stuff around a bit Now including Paper API (will be useful later) There's some messy parts for now, but not really any more messy than the original codebase. Will be cleaned up in a future PR

sgdc3 commented 5 years ago

What about using some small maven repo client libraries such as https://github.com/mikroskeem/PicoMaven ?

egg82 commented 5 years ago

That'll work for downloading, but Luck's jar-relocator actually relocates the dep after it's downloaded, which allows to inject into a custom namespace instead of injecting into the main namespace (which we want to avoid as much as possible)

You could add in a new lib for just downloading the jar, but I don't see a reason to. Would just add bloat, really.

AppleDash commented 5 years ago

What's wrong with the current solution? It's 2018, people can handle a couple MB in a JAR IMO :stuck_out_tongue:

hafarooki commented 5 years ago

That's a significantly longer download time for users with slow internet on their computer, wasteful when downloading updates to the plugin but not its dependencies, generally less efficient

hafarooki commented 5 years ago

but at the same time it's probably the more correct way to do it

egg82 commented 5 years ago

There's nothing in particular that's "wrong" with the current setup, but that doesn't man it can't be improved ;)

The idea is to provide a slimmed-down jar and download the deps on-the-fly IF they are actually needed. It also helps uploading because some places (cough Spigot) limit upload file sizes.

hafarooki commented 5 years ago

It also makes the plugin seem much lighter weight superficially

egg82 commented 5 years ago

This PR is the start of a series of PRs designed to ultimately improve the plugin. A lot of future PRs will build off of this one. If this gets merged, I can start on the rest.

codingJWilliams commented 5 years ago

Especially good for people with awful internet using Shared hosting - the download happens on the host's side so there's no need to upload 4mb at 100kbps, instead they upload a couple hundred kilobytes and the host downloads the rest

hafarooki commented 5 years ago

DEFINITELY this ^^ I remember the pain of uploading plugins back when I used shared hosts.

AppleDash commented 5 years ago

I need to think about this a little bit more, because while I do like the idea, I am not sure I 100% like the implementation. At the same time, however, I'm not sure I can think of a better way to do it. Agree that it's messy in places, but I went to at least a little effort to make my code clean!

I really appreciate the effort, and once I get past my own stubbornness and approve this, I look forward to your future improvements :smile:

egg82 commented 5 years ago

Of course, yeah. Even my own implementation could use a little work to make it more concise, but I didn't want to over-engineer anything just yet.

And yeah, there's a bit of mess to clean up which I would have done beforehand, but it requires a separate PR. I didn't want to shove everything into one giant PR.