Move DownloadService name to a constant

This commit is contained in:
Jason Penilla 2023-11-17 00:45:38 -07:00
parent daab4fa35e
commit 1d88d33cc5
No known key found for this signature in database
GPG key ID: 0E75A301420E48F8
5 changed files with 6 additions and 4 deletions

View file

@ -48,7 +48,7 @@ class PaperweightCore : Plugin<Project> {
val ext = target.extensions.create(PAPERWEIGHT_EXTENSION, PaperweightCoreExtension::class, target)
target.gradle.sharedServices.registerIfAbsent("download", DownloadService::class) {}
target.gradle.sharedServices.registerIfAbsent(DOWNLOAD_SERVICE_NAME, DownloadService::class) {}
target.tasks.register<Delete>("cleanCache") {
group = "paper"

View file

@ -115,6 +115,8 @@ const val IVY_REPOSITORY = "$PAPER_PATH/ivyRepository"
const val RELOCATION_EXTENSION = "relocation"
const val DOWNLOAD_SERVICE_NAME = "paperweightDownloadService"
fun paperSetupOutput(name: String, ext: String) = "$SETUP_CACHE/$name.$ext"
fun Task.paperTaskOutput(ext: String) = paperTaskOutput(name, ext)
fun paperTaskOutput(name: String, ext: String) = "$TASK_CACHE/$name.$ext"

View file

@ -118,7 +118,7 @@ inline fun <reified T : Task> TaskContainer.configureTask(name: String, noinline
@Suppress("UNCHECKED_CAST")
val Project.download: Provider<DownloadService>
get() = gradle.sharedServices.registrations.getByName("download").service as Provider<DownloadService>
get() = gradle.sharedServices.registrations.getByName(DOWNLOAD_SERVICE_NAME).service as Provider<DownloadService>
fun commentRegex(): Regex {
return Regex("\\s*#.*")

View file

@ -54,7 +54,7 @@ class PaperweightPatcher : Plugin<Project> {
val patcher = target.extensions.create(PAPERWEIGHT_EXTENSION, PaperweightPatcherExtension::class, target)
target.gradle.sharedServices.registerIfAbsent("download", DownloadService::class) {}
target.gradle.sharedServices.registerIfAbsent(DOWNLOAD_SERVICE_NAME, DownloadService::class) {}
target.tasks.register<Delete>("cleanCache") {
group = "paperweight"

View file

@ -75,7 +75,7 @@ abstract class PaperweightUser : Plugin<Project> {
null
}
target.gradle.sharedServices.registerIfAbsent("download", DownloadService::class) {}
target.gradle.sharedServices.registerIfAbsent(DOWNLOAD_SERVICE_NAME, DownloadService::class) {}
val cleanAll = target.tasks.register<Delete>("cleanAllPaperweightUserdevCaches") {
group = "paperweight"