SpongePowered / SpongeGradle

Handy gradle utilities for the various gradle projects of SpongePowered
MIT License
21 stars 16 forks source link

setupDebugWorkspace? #10

Closed ryantheleach closed 2 years ago

ryantheleach commented 7 years ago

Too many plugin developers are debugging by creating JAR's manually and copying them to a server.

ForgeGradle offers setupDecompWorkspace in order to get everything ready for modding + debugging the minecraft client.

Could we consider having an equivalent for Sponge, that sets up a runtime (obfuscated) environment for plugin creation? If we make it easy, we will get more plugins created for Sponge.

mattmess1221 commented 7 years ago

This is simple to do in your buildscript. Just add a line or 2 to your dependencies block and create a run configuration.

repositories {
    // for console appender
    maven { url 'https://oss.sonatype.org/content/groups/public' }
}
dependencies {
    // I can target a different api version than what I'm testing on
    compileOnly 'org.spongepowered:spongeapi:6.0.0-SNAPSHOT'
    runtime 'org.spongepowered:spongevanilla:1.12-7.0.0-BETA-303:dev'
}

Now just set your main class to org.spongepowered.server.launch.VanillaServerMain.

In order to get spongevanilla to load your plugin, you also need to add the program argument --scan-classpath. If you have plugin dependencies in a jar format, you may need to use --scan-full-classpath.

me4502 commented 7 years ago

So in doing this, it fails due to the lack of mappings. You know a workaround @killjoy1221 ?

[22:50:02] [main/ERROR] [LaunchWrapper]: Unable to launch
java.lang.IllegalArgumentException: resource mappings.srg not found.
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:191) ~[guava-21.0.jar:?]
    at com.google.common.io.Resources.getResource(Resources.java:197) ~[guava-21.0.jar:?]
    at org.spongepowered.server.launch.VanillaServerTweaker.configureDeobfuscation(VanillaServerTweaker.java:108) ~[spongevanilla-1.12-7.0.0-BETA-306-dev.jar:1.12-7.0.0-BETA-306]
    at org.spongepowered.server.launch.VanillaServerTweaker.injectIntoClassLoader(VanillaServerTweaker.java:90) ~[spongevanilla-1.12-7.0.0-BETA-306-dev.jar:1.12-7.0.0-BETA-306]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:115) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at org.spongepowered.server.launch.VanillaServerMain.main(VanillaServerMain.java:117) [spongevanilla-1.12-7.0.0-BETA-306-dev.jar:1.12-7.0.0-BETA-306]
zml2008 commented 2 years ago

This issue has been resolved in SpongeGradle 1.0.0+