22
22
23
23
package io.papermc.paperweight.core.taskcontainers
24
24
25
- import io.papermc.paperweight.DownloadService
26
25
import io.papermc.paperweight.core.ext
27
26
import io.papermc.paperweight.core.extension.PaperweightCoreExtension
27
+ import io.papermc.paperweight.core.tasks.DetermineSpigotDependencies
28
28
import io.papermc.paperweight.tasks.*
29
29
import io.papermc.paperweight.util.*
30
30
import io.papermc.paperweight.util.constants.*
31
31
import java.nio.file.Path
32
+ import kotlin.io.path.*
32
33
import org.gradle.api.Project
33
34
import org.gradle.api.Task
34
- import org.gradle.api.provider.Provider
35
35
import org.gradle.api.tasks.TaskContainer
36
36
import org.gradle.kotlin.dsl.*
37
37
@@ -41,7 +41,6 @@ open class SpigotTasks(
41
41
tasks : TaskContainer = project.tasks,
42
42
cache : Path = project.layout.cache,
43
43
extension : PaperweightCoreExtension = project.ext,
44
- downloadService : Provider <DownloadService > = project.download,
45
44
) : VanillaTasks(project) {
46
45
47
46
val addAdditionalSpigotMappings by tasks.registering<AddAdditionalSpigotMappings > {
@@ -52,14 +51,6 @@ open class SpigotTasks(
52
51
additionalMemberEntriesSrg.set(extension.paper.additionalSpigotMemberMappings.fileExists(project))
53
52
}
54
53
55
- val inspectVanillaJar by tasks.registering<InspectVanillaJar > {
56
- inputJar.set(downloadServerJar.flatMap { it.outputJar })
57
- libraries.from(downloadMcLibraries.map { it.outputDir.asFileTree })
58
- mcLibraries.set(setupMcLibraries.flatMap { it.outputFile })
59
-
60
- serverLibraries.set(cache.resolve(SERVER_LIBRARIES ))
61
- }
62
-
63
54
val generateSpigotMappings by tasks.registering<GenerateSpigotMappings > {
64
55
classMappings.set(addAdditionalSpigotMappings.flatMap { it.outputClassSrg })
65
56
memberMappings.set(addAdditionalSpigotMappings.flatMap { it.outputMemberSrg })
@@ -97,7 +88,7 @@ open class SpigotTasks(
97
88
98
89
val cleanupMappings by tasks.registering<CleanupMappings > {
99
90
sourceJar.set(spigotRemapJar.flatMap { it.outputJar })
100
- libraries.from(downloadMcLibraries.map { it.outputDir.asFileTree } )
91
+ libraries.from(minecraftLibraries )
101
92
inputMappings.set(generateSpigotMappings.flatMap { it.outputMappings })
102
93
103
94
outputMappings.set(cache.resolve(CLEANED_SPIGOT_MOJANG_YARN_MAPPINGS ))
@@ -172,13 +163,18 @@ open class SpigotTasks(
172
163
dependsOn(patchSpigotApi, patchSpigotServer)
173
164
}
174
165
175
- val downloadSpigotDependencies by tasks.registering<DownloadSpigotDependencies > {
166
+ val determineSpigotDependencies by tasks.registering<DetermineSpigotDependencies > {
176
167
dependsOn(patchSpigot)
177
168
apiPom.set(patchSpigotApi.flatMap { it.outputDir.file(" pom.xml" ) })
178
169
serverPom.set(patchSpigotServer.flatMap { it.outputDir.file(" pom.xml" ) })
179
- outputDir.set(cache.resolve( SPIGOT_JARS_PATH ))
170
+ }
180
171
181
- downloader.set(downloadService)
172
+ val spigotDependencies = determineSpigotDependencies.flatMap { determine ->
173
+ project.resolveWithRepos(
174
+ determine.dependencies.map { deps -> deps.path.readLines() },
175
+ determine.repositories.map { repos -> repos.path.readLines() },
176
+ SPIGOT_DEPENDENCIES
177
+ )
182
178
}
183
179
184
180
val remapSpigotAt by tasks.registering<RemapSpigotAt > {
@@ -187,15 +183,14 @@ open class SpigotTasks(
187
183
spigotAt.set(extension.craftBukkit.atFile)
188
184
}
189
185
190
- @Suppress(" DuplicatedCode" )
191
186
val remapSpigotSources by tasks.registering<RemapSources > {
192
187
spigotServerDir.set(patchSpigotServer.flatMap { it.outputDir })
193
188
spigotApiDir.set(patchSpigotApi.flatMap { it.outputDir })
194
189
mappings.set(patchMappings.flatMap { it.outputMappings })
195
- vanillaJar.set(downloadServerJar.flatMap { it.outputJar } )
190
+ vanillaJar.set(serverJar )
196
191
mojangMappedVanillaJar.set(fixJar.flatMap { it.outputJar })
197
192
vanillaRemappedSpigotJar.set(filterSpigotExcludes.flatMap { it.outputZip })
198
- spigotDeps.from(downloadSpigotDependencies.map { it.outputDir.asFileTree } )
193
+ spigotDeps.from(spigotDependencies )
199
194
additionalAts.set(extension.paper.additionalAts.fileExists(project))
200
195
}
201
196
0 commit comments