File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
test/groovy/ru/endlesscode/bukkitgradle/server/task Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -122,13 +122,12 @@ public class DevServerPlugin : Plugin<Project> {
122122 copyServerCore : TaskProvider <Copy >,
123123 serverDir : Provider <Directory >
124124 ): TaskProvider <PrepareServer > {
125- val jarTaskName = if (project.plugins.hasPlugin(" com.github.johnrengelman.shadow" )) " shadowJar" else " jar"
126- val jarTask = tasks.named<Jar >(jarTaskName)
127125 val copyPlugins = tasks.register<Copy >(" copyPlugins" ) {
128126 group = TASKS_GROUP_BUKKIT
129127 description = " Copy plugins to dev server."
130128
131- from(jarTask)
129+ val jarTaskName = if (project.plugins.hasPlugin(" com.github.johnrengelman.shadow" )) " shadowJar" else " jar"
130+ from(tasks.named<Jar >(jarTaskName))
132131 into(serverDir.map { project.mkdir(it.dir(" plugins" )) })
133132 rename { " ${pluginMeta.name.get()} .jar" }
134133 }
Original file line number Diff line number Diff line change @@ -55,4 +55,23 @@ class PrepareServerSpec extends PluginSpecification {
5555 and : " online-mode should be false"
5656 file(" $serverDir /server.properties" ). readLines(). contains(" online-mode=false" )
5757 }
58+
59+ def " when run prepareServer - and there is shadow plugin - should use shadowJar task" () {
60+ given : " configured eula and online-mode"
61+ buildFile. text = """
62+ plugins {
63+ id "ru.endlesscode.bukkitgradle"
64+ id "com.github.johnrengelman.shadow" version "6.1.0"
65+ }
66+
67+ version = '1.0'
68+ group = 'com.example.testplugin'
69+ """ . stripIndent()
70+
71+ when : " run prepareServer"
72+ run(TASK_NAME , ' -x' , ' copyServer' )
73+
74+ then : " should run shadowJar"
75+ taskOutcome(" :shadowJar" ) == TaskOutcome . SUCCESS
76+ }
5877}
You can’t perform that action at this time.
0 commit comments