Jycraft / jycraft

Extend Minecraft servers with Python using Jython.
BSD 3-Clause "New" or "Revised" License
13 stars 2 forks source link

Gradle build #6

Closed BenLewis-Seequent closed 8 years ago

BenLewis-Seequent commented 8 years ago

Adds the ability to build both the canary and spigot plugins by gradle. The build produces two jars jycraft-anary.jar and jycraft-spigot.jar which contains compiler output for both src-common and their respective source directory as well as the jython and websockets dependencies.

To build the jars:

Unix:

./gradlew

Windows:

gradlew.bat
pauleveritt commented 8 years ago

Very good! It's great to see all the deletes in the PR.

This puts the compiled jars in build/lib. The jycraft-canary/jycraft-spigot jars are 37 MB. Are the canary/spigot upstream jars bundled in these?

Nope, I unzip'd the jar and the space is almost all Jython. No big deal, we can address that later. Just wanted to make sure the instructions explain about getting Canary/Spigot for download (or, I make a .zip that bundles everything.)

I'm evaluating now.

pauleveritt commented 8 years ago

I am giving my first try with Spigot. I copied jycraft-spigot.jar and jycraft-server-plugin.jar from the build directory, into ./plugins in my Spigot working area. I got the following on startup:

[14:19:51 ERROR]: Could not load 'plugins/jycraft-server-plugin.jar' in folder 'plugins' org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:154) ~[spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25] Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml ... 6 more [14:19:51 WARN]: Plugin Bukkit_Jython_Console v0.1' uses the space-character (0x20) in its nameBukkit Jython Console' - this is discouraged [14:19:51 INFO]: Set PluginClassLoader as parallel capable [14:19:51 ERROR]: Could not load 'plugins/jycraft-spigot.jar' in folder 'plugins' org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.macuyiko.bukkitconsole.MainPlugin' at org.bukkit.plugin.java.PluginClassLoader.(PluginClassLoader.java:66) ~[spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25] Caused by: java.lang.ClassNotFoundException: com.macuyiko.bukkitconsole.MainPlugin at java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[?:1.8.0_25] at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[?:1.8.0_25] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_25] at java.net.URLClassLoader.findClass(URLClassLoader.java:360) ~[?:1.8.0_25] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_25] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_25] at java.lang.Class.forName0(Native Method) ~[?:1.8.0_25] at java.lang.Class.forName(Class.java:344) ~[?:1.8.0_25] at org.bukkit.plugin.java.PluginClassLoader.(PluginClassLoader.java:64) ~[spigot-1.8.8.jar:git-Spigot-5f38d38-18fbb24] ... 7 more

pauleveritt commented 8 years ago

On my last comment, my guess is that jycraft-server-common.jar isn't needed?

I gave jycraft-canary.jar a try. Everything works as expected with the telnet and WebSocket clients.

BenLewis-Seequent commented 8 years ago

Yes the jycraft-server-common.jar isn't needed as the classes for common are already packaged inside the other two jars. jycraft-common.jar is built because build task by default calls the standard Jar task. I'm making the build task mean do everything but I could change it so that the default tasks are spigotJar and canaryJar so that it doesn't depend on the build task and therefore doesn't build jycraft-common.jar.

The problem with packaging spigot is that the spigot jar produced by the spigot build tool also includes mixture of the spigot/craftbukkit code and the minecraft server code which isn't allowed to be distributed, that is why there is no download link for spigot jar. A solution could be to wrap the spigot build tool in a wrapper so if the spigot exist run spigot else if it doesn't exist invoke the build tool and then invoke spigot. This would mean the user only has to run one jar.

pauleveritt commented 8 years ago

Would you prefer if I merge this PR, then add individual tickets for these two points? (Don’t build the common jar and packaging spigot.) For the Spigot side, I don’t mind if this Gradle build doesn’t include Spigot itself. As long as you give me the instructions on where to drop everything in a Spigot installation.

I sent you an invite to be an admin on that repo.

—Paul

On Oct 25, 2015, at 4:46 PM, Ben Lewis notifications@github.com wrote:

Yes the jycraft-server-common.jar isn't needed as the classes for common are already packaged inside the other two jars. jycraft-common.jar is built because build task by default calls the standard Jar task. I'm making the build task mean do everything but I could change it so that the default tasks are spigotJar and canaryJar so that it doesn't depend on the build task and therefore doesn't build jycraft-common.jar.

The problem with packaging spigot is that the spigot jar produced by the spigot build tool also includes mixture of the spigot/craftbukkit code and the minecraft server code which isn't allowed to be distributed, that is why there is no download link for spigot jar. A solution could be to wrap the spigot build tool in a wrapper so if the spigot exist run spigot else if it doesn't exist invoke the build tool and then invoke spigot. This would mean the user only has to run one jar.

— Reply to this email directly or view it on GitHub https://github.com/Jycraft/jycraft-server-plugin/pull/6#issuecomment-150967523.

BenLewis-Seequent commented 8 years ago

You can merge this now, I have set the default tasks to build both jars just. Now just ./gradlew or ./gradlew.bat (for windows) builds both jars without building the common jar. The spigot plugin should also work now, it just needs to be put in the ./plugins folder in the spigot installation.

pauleveritt commented 8 years ago

Sweet, works in Spigot. Also, only generates two jar files. Thanks!