Rebuild patches

Discussion in 'Spigot Discussion' started by danielfr789, Jul 7, 2015.

  1. Ive been looking over the spigot development for a while now and I never understood what rebuilding patches was for.

    What does it mean to "Rebuild Patches"
  2. Z750

    IRC Staff

    Rebuilding patches is essentially how the patch files used in (and Spigot/CB) are created and maintained.
    The end user, who is just interested in running the server and/or compiling it, should never need to do this.
    Developers working on the server source, however, will need to do this (or should do this).

    To understand what rebuilding patches (which I'll probably just call from here on out) actually does, you have to understand how the Spigot/CB source files are actually produced. The gist of the process goes something along the lines of:

    get vanilla server jar ->
    decompile it ->
    apply mappings to the various fields/functions/etc ->
    apply CB patches (code changes) ->
    apply Spigot patches (code changes).

    Spigot and CraftBukkit's changes to the vanilla source are distributed and maintained as a series of patch files (CB example, Spigot example) this is done for many reasons, some legal, others for legacy and maintainability reasons. Regardless, the process of actually creating these files is simple enough. The developer makes their changes to the Server or API source (which would be the actual Bukkit/Spigot-API or CraftBukkit/Spigot-Server repos under the parent), they then commit the changes, and then run the script. The script goes through the commits and generates and updates patch files based on the commits. Those freshly generated patch files are then (usually) themselves committed to the parent repo. It is those patch files (based on the changes originally made) that will be distributed. Those files will eventually be applied to the source with the script and can be used to re-create the aforementioned CB/B (or Spigot-Server/Spigot-API) source directories, which are then themselves compiled into a usable jar.

    Hopefully that makes a bit of sense, it still looks really convoluted as I read through it, and much more long winded than I had originally hoped.
    It's also late and I'm tired so there's that. Hopefully it helps.
    • Useful Useful x 1