@@ -16,7 +16,7 @@ abstract class BuildToolsValueSource : ValueSource<File, BuildToolsValueSource.P
1616 abstract val exec: ExecOperations
1717
1818 interface Parameters : ValueSourceParameters {
19- val mavenLocal : Property < File >
19+ val installDir : DirectoryProperty
2020 val workingDir: DirectoryProperty
2121
2222 val spigotVersion: Property <String >
@@ -31,11 +31,11 @@ abstract class BuildToolsValueSource : ValueSource<File, BuildToolsValueSource.P
3131 override fun obtain (): File {
3232 val version = parameters.spigotVersion.get()
3333 val revision = parameters.spigotRevision.get()
34- val installLocation = getInstallLocation( version)
34+ val spigotLocation = parameters.installDir.get().asFile.resolve( " spigot- $ version.jar " )
3535 // If Spigot is already installed, don't reinstall.
36- if (! parameters.ignoreCached.get() && installLocation .exists()) {
36+ if (! parameters.ignoreCached.get() && spigotLocation .exists()) {
3737 println (" Skipping Spigot installation, $version is present" )
38- return installLocation
38+ return spigotLocation
3939 }
4040
4141 val buildTools = installBuildTools(parameters.workingDir.get().asFile)
@@ -47,22 +47,29 @@ abstract class BuildToolsValueSource : ValueSource<File, BuildToolsValueSource.P
4747 executable = parameters.javaExecutable.get()
4848 workingDir = buildTools.parentFile
4949 classpath(buildTools)
50- args = listOf (" --nogui" , " --rev" , revision, " --remapped " )
50+ args = listOf (" --nogui" , " --rev" , revision)
5151 }.rethrowFailure()
5252
53+ val spigotBuild = buildTools.parentFile.resolve(" Spigot/Spigot-Server/target/spigot-$version .jar" )
54+
55+ if (! spigotBuild.exists()) {
56+ throw IllegalStateException (
57+ " Spigot build completed, but $spigotBuild does not exist! Did BuildTools change output location?"
58+ )
59+ }
60+
61+ spigotBuild.copyTo(spigotLocation, overwrite = true )
62+
5363 // Mark work for delete.
5464 cleanUp(buildTools.parentFile)
5565
56- if (! installLocation .exists()) {
66+ if (! spigotLocation .exists()) {
5767 throw IllegalStateException (
5868 " Failed to install Spigot $version from $revision . Does the revision point to a different version?"
5969 )
6070 }
61- return installLocation
62- }
6371
64- private fun getInstallLocation (version : String ): File {
65- return parameters.mavenLocal.get().resolve(" org/spigotmc/spigot/$version /spigot-$version -remapped-mojang.jar" )
72+ return spigotLocation
6673 }
6774
6875 private fun installBuildTools (workingDir : File ): File {
0 commit comments