Binnie icon indicating copy to clipboard operation
Binnie copied to clipboard

Refactoring Modules

Open Nedelosk opened this issue 7 years ago • 14 comments

@mezz, @marcin212, @KorDum What do you think we should do ? Remove the modules and add block / item registries or make the mod modules more separate so that they no longer depend on each other.

Nedelosk avatar Aug 04 '17 19:08 Nedelosk

Ideally, all modules should be divided. But this is quite a lot of work ...

KorDum avatar Aug 04 '17 20:08 KorDum

Can we divide ExtraBees only now? This should be quite simple.

KorDum avatar Aug 09 '17 07:08 KorDum

We should try but I'm not sure how to set up grade to make it all work. I think it should be possible for them to be separated mods in one workspace, and have the dependencies and everything set up with grade.

mezz avatar Aug 09 '17 07:08 mezz

https://github.com/BuildCraft/BuildCraft/blob/8.0.x/build.gradle Can not help us?

KorDum avatar Aug 09 '17 07:08 KorDum

I think that only splits up the output jars, it would not help us keep the modules separate in code.

mezz avatar Aug 09 '17 07:08 mezz

I am getting help from someone with better knowledge of gradle, and they will give it an attempt tomorrow. Please avoid giant refactors for a few days, it will be difficult for you to merge old changes once we split up the project.

mezz avatar Aug 10 '17 04:08 mezz

https://docs.gradle.org/current/userguide/multi_project_builds.html

marcin212 avatar Aug 10 '17 08:08 marcin212

Yes that's exactly it. You can see the wip branch here: https://github.com/ForestryMC/Binnie/tree/wip-modules?files=1

When it's working we should probably do the same with Forestry.

mezz avatar Aug 10 '17 17:08 mezz

Here is my plan so far:

First Half: Get the modules working in a fast dirty way.

  • [x] Split the module using gradle so that the code cannot reference other modules unless specify a dependency.
  • [x] Some things get moved into "core" that do not belong there, there are dependencies that should not exist, and there is one big "api" that has all the apis together, but it compiles.
  • [x] Get gradle set up so that it creates the separate jars per module. The separate jars are not going on curseforge, but they might be useful in maven at least.
  • [x] Create one jar with all of them combined, so it matches what we have now.

When this first half is done we can develop on it. I am trying to do as little as possible here so that it is done more quickly.

Second half: Do it right, and get it clean.

  • [ ] Create new API methods and correct abstractions so we can move things into the modules where they belong
  • [x] Split "api" into one api module for every module, so we have "botany-api", "core-api", etc.
  • [ ] Every module should only depend on "core" and apis.
  • [ ] Do this whole process for Forestry too, and have Binnie modules depend only on the Forestry modules they need.
  • [ ] Split modules further, so we have smaller sub-modules like alcohol and carpentry.

When the second half is done we will be able to have modules disabled without fear of breaking things. Advanced players can pick only the modules they want, and our code is cleaner.

mezz avatar Aug 11 '17 04:08 mezz

The first half is complete and was merged here: https://github.com/ForestryMC/Binnie/pull/260

Now we all can clean it up for the second half.

mezz avatar Aug 12 '17 05:08 mezz

Is this being worked on?

ferk6a avatar Feb 25 '18 01:02 ferk6a

This is mostly working right now, the modules are separate mods. The work involved with gradle to make separate jars was really inelegant and frustrating so I took a break from it. I haven't had time to work on Binnie's lately so there is no further progress.

mezz avatar Feb 25 '18 08:02 mezz

Ah ok, I ran into https://github.com/ForestryMC/Binnie/issues/305 (disabling genetics makes every block and recipe still show up, albeit broken) and ended up in this bug. Thanks for the update, though, I can see how separate jars can be frustrating, so far I've only seen Charset do it right.

ferk6a avatar Feb 26 '18 14:02 ferk6a

Yeah, asie learned from Buildcraft which is also split into jars. It's a bit easier to do when you plan the project that way from the beginning, like Charset :)

mezz avatar Feb 27 '18 05:02 mezz