fix task creation
All checks were successful
Publish to snapshot maven / build (push) Successful in 22s

This commit is contained in:
moehreag 2024-06-15 17:16:21 +02:00
parent 37282135d5
commit fadcb64b34
3 changed files with 9 additions and 8 deletions

View file

@ -7,7 +7,7 @@ plugins {
} }
group = "dev.frogmc" group = "dev.frogmc"
version = "0.0.1-alpha.1" version = "0.0.1-alpha.2"
repositories { repositories {
mavenCentral() mavenCentral()

View file

@ -2,9 +2,13 @@ package dev.frogmc.meta_update
import org.gradle.api.Plugin import org.gradle.api.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.JavaBasePlugin
@Suppress("unused")
class MetaUpdatePlugin: Plugin<Project> { class MetaUpdatePlugin: Plugin<Project> {
override fun apply(target: Project) { override fun apply(target: Project) {
val task = target.tasks.register("updateMeta", MetaV1UpdateTask::class.java) target.tasks.register("updateMeta", MetaV1UpdateTask::class.java) {
it.dependsOn(target.tasks.getByName(JavaBasePlugin.BUILD_TASK_NAME))
}
} }
} }

View file

@ -1,3 +1,5 @@
@file:Suppress("unused")
package dev.frogmc.meta_update package dev.frogmc.meta_update
import com.google.common.hash.Hashing import com.google.common.hash.Hashing
@ -21,11 +23,7 @@ import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
@DisableCachingByDefault(because = "Not worth caching") @DisableCachingByDefault(because = "Not worth caching")
class MetaV1UpdateTask : DefaultTask() { open class MetaV1UpdateTask : DefaultTask() {
init {
dependsOn(project.tasks.getByName(JavaBasePlugin.BUILD_TASK_NAME))
}
private val timeFormat = DateTimeFormatter.ISO_LOCAL_DATE_TIME private val timeFormat = DateTimeFormatter.ISO_LOCAL_DATE_TIME
private val client = HttpClient.newHttpClient() private val client = HttpClient.newHttpClient()
@ -135,7 +133,6 @@ class MetaV1UpdateTask : DefaultTask() {
companion object { companion object {
private const val META_URL = "https://meta.frogmc.dev/v1/" private const val META_URL = "https://meta.frogmc.dev/v1/"
private const val UPLOAD_LOADER_URL = META_URL + "loader/versions/upload" private const val UPLOAD_LOADER_URL = META_URL + "loader/versions/upload"
private const val MAVEN_URL = "https://maven.frogmc.dev/"
private const val MAVEN_URL_RELEASES = "https://maven.frogmc.dev/releases" private const val MAVEN_URL_RELEASES = "https://maven.frogmc.dev/releases"
private const val MAVEN_URL_SNAPSHOTS = "https://maven.frogmc.dev/snapshots" private const val MAVEN_URL_SNAPSHOTS = "https://maven.frogmc.dev/snapshots"
} }