PaperMC / paperweight

Gradle build system plugin for Paper and Paper forks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mcdev imports not processed when using submodules

TheKinrar opened this issue · comments

When adding an import to dev-imports.txt using the default paperweight config (with usePaperUpstream and a paperRef property), everything works fine, and just before my fork's server patches are applied, I can see this:

Importing 1 classes from vanilla...
Importing 0 classes from library sources...

But when using the submodule configuration (with upstreams tag in paperweight config, I used the examples from this repo) the imports are not processed. The two lines above are never printed.

Here is my full working upstream config:

    usePaperUpstream(providers.gradleProperty("paperRef")) {
        withPaperPatcher {
            apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
            apiOutputDir.set(layout.projectDirectory.dir("Papyrus-API"))

            serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
            serverOutputDir.set(layout.projectDirectory.dir("Papyrus-Server"))
        }
    }

And here is the submodule one that does not process imports:

    upstreams {
        register("paper") {
            upstreamDataTask {
                dependsOn(initSubmodules)
                projectDir.set(paperDir)
            }

            patchTasks {
                register("api") {
                    upstreamDir.set(paperDir.dir("Paper-API"))
                    patchDir.set(layout.projectDirectory.dir("patches/api"))
                    outputDir.set(layout.projectDirectory.dir("Papyrus-API"))
                }
                register("server") {
                    upstreamDir.set(paperDir.dir("Paper-Server"))
                    patchDir.set(layout.projectDirectory.dir("patches/server"))
                    outputDir.set(layout.projectDirectory.dir("Papyrus-Server"))
                }
            }
        }
    }

I'm using paperweight 1.1.6.

Found a solution:

Add importMcDev.set(true) to the register("server") task.

    upstreams {
        register("paper") {
            upstreamDataTask {
                dependsOn(initSubmodules)
                projectDir.set(paperDir)
            }

            patchTasks {
                register("api") {
                    upstreamDir.set(paperDir.dir("Paper-API"))
                    patchDir.set(layout.projectDirectory.dir("patches/api"))
                    outputDir.set(layout.projectDirectory.dir("Papyrus-API"))
                }
                register("server") {
                    upstreamDir.set(paperDir.dir("Paper-Server"))
                    importMcDev.set(true) // <-----------------------------  The key to success, 
                    // if not present update to id("io.papermc.paperweight.patcher") version "1.1.7-SNAPSHOT"
                    patchDir.set(layout.projectDirectory.dir("patches/server"))
                    outputDir.set(layout.projectDirectory.dir("Papyrus-Server"))
                }
            }
        }
    }

Thank you so much!

Yeah this is intended behavior, though since i have so many things still to fix and implement in paperweight I haven't documented anything yet, so this isn't documented either.

The reason for this is simple: there's no way of knowing if you're patching the server or not when using submodules. With the standard method the server defaults that value to true, but with submodules you have to manually define patch tasks, so that value has to be set as well.

I do see that I forgot to include that in the submodule branches of paperweight-examples. I'll try to remember to add that.