Update Hypo and minor improvements
This commit is contained in:
parent
c38cb87411
commit
bb8978d0ca
8 changed files with 89 additions and 46 deletions
|
@ -59,9 +59,7 @@ dependencies {
|
|||
// ASM for inspection
|
||||
shade(libs.bundles.asm)
|
||||
|
||||
shade(platform(libs.hypo.platform))
|
||||
shade(libs.bundles.hypo)
|
||||
|
||||
shade(libs.bundles.cadix)
|
||||
|
||||
shade(libs.lorenzTiny)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[versions]
|
||||
asm = "9.1"
|
||||
lorenz = "0.5.6"
|
||||
hypo = "1.0.0"
|
||||
|
||||
[libraries]
|
||||
asm-core = { module = "org.ow2.asm:asm", version.ref = "asm" }
|
||||
|
@ -16,13 +17,12 @@ cadix-atlas = "org.cadixdev:atlas:0.2.0"
|
|||
cadix-at = "org.cadixdev:at:0.1.0-rc1"
|
||||
cadix-mercury = "org.cadixdev:mercury:0.1.0-rc2-SNAPSHOT"
|
||||
|
||||
hypo-platform = "com.demonwav.hypo:hypo-platform:1.0.0"
|
||||
hypo-model = { module = "com.demonwav.hypo:hypo-model" }
|
||||
hypo-core = { module = "com.demonwav.hypo:hypo-core" }
|
||||
hypo-hydrate = { module = "com.demonwav.hypo:hypo-hydrate" }
|
||||
hypo-asm-core = { module = "com.demonwav.hypo:hypo-asm" }
|
||||
hypo-asm-hydrate = { module = "com.demonwav.hypo:hypo-asm-hydrate" }
|
||||
hypo-mappings = { module = "com.demonwav.hypo:hypo-mappings" }
|
||||
hypo-model = { module = "dev.denwav.hypo:hypo-model", version.ref = "hypo" }
|
||||
hypo-core = { module = "dev.denwav.hypo:hypo-core", version.ref = "hypo" }
|
||||
hypo-hydrate = { module = "dev.denwav.hypo:hypo-hydrate", version.ref = "hypo" }
|
||||
hypo-asm-core = { module = "dev.denwav.hypo:hypo-asm", version.ref = "hypo" }
|
||||
hypo-asm-hydrate = { module = "dev.denwav.hypo:hypo-asm-hydrate", version.ref = "hypo" }
|
||||
hypo-mappings = { module = "dev.denwav.hypo:hypo-mappings", version.ref = "hypo" }
|
||||
|
||||
lorenzTiny = "org.quiltmc:lorenz-tiny:3.0.0"
|
||||
jbsdiff = "io.sigpipe:jbsdiff:1.0"
|
||||
|
|
|
@ -59,7 +59,12 @@ abstract class DownloadService : BuildService<BuildServiceParameters.None>, Auto
|
|||
private fun download(source: URL, target: File) {
|
||||
target.parentFile.mkdirs()
|
||||
|
||||
val etagFile = target.resolveSibling(target.name + ".etag")
|
||||
val etagDir = target.resolveSibling("etags")
|
||||
if (!etagDir.exists() || !etagDir.isDirectory) {
|
||||
etagDir.delete()
|
||||
etagDir.mkdirs()
|
||||
}
|
||||
val etagFile = etagDir.resolve(target.name + ".etag")
|
||||
val etag = if (etagFile.exists()) etagFile.readText() else null
|
||||
|
||||
val host = HttpHost(source.host, source.port, source.protocol)
|
||||
|
@ -86,7 +91,7 @@ abstract class DownloadService : BuildService<BuildServiceParameters.None>, Auto
|
|||
|
||||
httpClient.execute(host, httpGet).use { response ->
|
||||
val code = response.statusLine.statusCode
|
||||
if ((code < 200 || code > 299) && code != HttpStatus.SC_NOT_MODIFIED) {
|
||||
if (code !in 200..299 && code != HttpStatus.SC_NOT_MODIFIED) {
|
||||
val reason = response.statusLine.reasonPhrase
|
||||
throw PaperweightException("Download failed, HTTP code: $code; URL: $source; Reason: $reason")
|
||||
}
|
||||
|
|
|
@ -22,27 +22,27 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import com.demonwav.hypo.asm.AsmClassDataProvider
|
||||
import com.demonwav.hypo.asm.hydrate.BridgeMethodHydrator
|
||||
import com.demonwav.hypo.asm.hydrate.SuperConstructorHydrator
|
||||
import com.demonwav.hypo.core.HypoContext
|
||||
import com.demonwav.hypo.hydrate.HydrationManager
|
||||
import com.demonwav.hypo.mappings.ChangeChain
|
||||
import com.demonwav.hypo.mappings.ChangeRegistry
|
||||
import com.demonwav.hypo.mappings.LorenzUtil
|
||||
import com.demonwav.hypo.mappings.MappingsCompletionManager
|
||||
import com.demonwav.hypo.mappings.MergeResult
|
||||
import com.demonwav.hypo.mappings.MergeableMappingsChange
|
||||
import com.demonwav.hypo.mappings.changes.AbstractMappingsChange
|
||||
import com.demonwav.hypo.mappings.changes.MemberReference
|
||||
import com.demonwav.hypo.mappings.changes.RemoveMappingChange
|
||||
import com.demonwav.hypo.mappings.contributors.ChangeContributor
|
||||
import com.demonwav.hypo.mappings.contributors.CopyMappingsDown
|
||||
import com.demonwav.hypo.mappings.contributors.PropagateMappingsUp
|
||||
import com.demonwav.hypo.mappings.contributors.RemoveUnusedMappings
|
||||
import com.demonwav.hypo.model.ClassProviderRoot
|
||||
import com.demonwav.hypo.model.data.ClassData
|
||||
import com.demonwav.hypo.model.data.types.PrimitiveType
|
||||
import dev.denwav.hypo.asm.AsmClassDataProvider
|
||||
import dev.denwav.hypo.asm.hydrate.BridgeMethodHydrator
|
||||
import dev.denwav.hypo.asm.hydrate.SuperConstructorHydrator
|
||||
import dev.denwav.hypo.core.HypoContext
|
||||
import dev.denwav.hypo.hydrate.HydrationManager
|
||||
import dev.denwav.hypo.mappings.ChangeChain
|
||||
import dev.denwav.hypo.mappings.ChangeRegistry
|
||||
import dev.denwav.hypo.mappings.LorenzUtil
|
||||
import dev.denwav.hypo.mappings.MappingsCompletionManager
|
||||
import dev.denwav.hypo.mappings.MergeResult
|
||||
import dev.denwav.hypo.mappings.MergeableMappingsChange
|
||||
import dev.denwav.hypo.mappings.changes.AbstractMappingsChange
|
||||
import dev.denwav.hypo.mappings.changes.MemberReference
|
||||
import dev.denwav.hypo.mappings.changes.RemoveMappingChange
|
||||
import dev.denwav.hypo.mappings.contributors.ChangeContributor
|
||||
import dev.denwav.hypo.mappings.contributors.CopyMappingsDown
|
||||
import dev.denwav.hypo.mappings.contributors.PropagateMappingsUp
|
||||
import dev.denwav.hypo.mappings.contributors.RemoveUnusedMappings
|
||||
import dev.denwav.hypo.model.ClassProviderRoot
|
||||
import dev.denwav.hypo.model.data.ClassData
|
||||
import dev.denwav.hypo.model.data.types.PrimitiveType
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.file
|
||||
|
|
|
@ -22,17 +22,17 @@
|
|||
|
||||
package io.papermc.paperweight.tasks
|
||||
|
||||
import com.demonwav.hypo.asm.AsmClassDataProvider
|
||||
import com.demonwav.hypo.asm.hydrate.BridgeMethodHydrator
|
||||
import com.demonwav.hypo.asm.hydrate.SuperConstructorHydrator
|
||||
import com.demonwav.hypo.core.HypoContext
|
||||
import com.demonwav.hypo.hydrate.HydrationManager
|
||||
import com.demonwav.hypo.mappings.ChangeChain
|
||||
import com.demonwav.hypo.mappings.MappingsCompletionManager
|
||||
import com.demonwav.hypo.mappings.contributors.CopyMappingsDown
|
||||
import com.demonwav.hypo.mappings.contributors.PropagateMappingsUp
|
||||
import com.demonwav.hypo.mappings.contributors.RemoveUnusedMappings
|
||||
import com.demonwav.hypo.model.ClassProviderRoot
|
||||
import dev.denwav.hypo.asm.AsmClassDataProvider
|
||||
import dev.denwav.hypo.asm.hydrate.BridgeMethodHydrator
|
||||
import dev.denwav.hypo.asm.hydrate.SuperConstructorHydrator
|
||||
import dev.denwav.hypo.core.HypoContext
|
||||
import dev.denwav.hypo.hydrate.HydrationManager
|
||||
import dev.denwav.hypo.mappings.ChangeChain
|
||||
import dev.denwav.hypo.mappings.MappingsCompletionManager
|
||||
import dev.denwav.hypo.mappings.contributors.CopyMappingsDown
|
||||
import dev.denwav.hypo.mappings.contributors.PropagateMappingsUp
|
||||
import dev.denwav.hypo.mappings.contributors.RemoveUnusedMappings
|
||||
import dev.denwav.hypo.model.ClassProviderRoot
|
||||
import io.papermc.paperweight.util.Constants
|
||||
import io.papermc.paperweight.util.MappingFormats
|
||||
import io.papermc.paperweight.util.emptyMergeResult
|
||||
|
|
40
src/main/kotlin/transform/TransformBuilder.kt
Normal file
40
src/main/kotlin/transform/TransformBuilder.kt
Normal file
|
@ -0,0 +1,40 @@
|
|||
package io.papermc.paperweight.transform
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.attributes.Attribute
|
||||
import org.gradle.kotlin.dsl.*
|
||||
|
||||
class TransformBuilder(private val project: Project, type: String, state: String) {
|
||||
|
||||
init {
|
||||
project.dependencies {
|
||||
attributesSchema {
|
||||
attribute(transformState)
|
||||
}
|
||||
if (artifactTypes.names.contains(type)) {
|
||||
artifactTypes.named(type) {
|
||||
attributes.attribute(transformState, TRANSFORM_STATE_BASE)
|
||||
}
|
||||
} else {
|
||||
artifactTypes.register(type) {
|
||||
attributes.attribute(transformState, TRANSFORM_STATE_BASE)
|
||||
}
|
||||
}
|
||||
}
|
||||
project.configurations.named("test") {
|
||||
attributes.attribute(transformState, state)
|
||||
}
|
||||
}
|
||||
|
||||
fun initialize() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val artifactType: Attribute<String> = attributeOf("artifactType")
|
||||
private val transformState: Attribute<String> = attributeOf("io.papermc.paperweight.transformState")
|
||||
|
||||
private const val TRANSFORM_STATE_BASE: String = "base"
|
||||
|
||||
private inline fun <reified T> attributeOf(name: String) = Attribute.of(name, T::class.java)
|
||||
}
|
||||
}
|
|
@ -71,7 +71,7 @@ data class MavenArtifact(
|
|||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return buildString {
|
||||
return buildString(50) {
|
||||
append(group).append(':').append(artifact).append(':').append(version)
|
||||
if (classifier != null) {
|
||||
append(':').append(classifier)
|
||||
|
|
|
@ -44,8 +44,8 @@ import org.cadixdev.lorenz.model.MemberMapping
|
|||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.file.DirectoryProperty
|
||||
import org.gradle.api.file.FileSystemLocation
|
||||
import org.gradle.api.file.ProjectLayout
|
||||
import org.gradle.api.file.RegularFile
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.tasks.TaskContainer
|
||||
|
@ -87,7 +87,7 @@ fun Any.convertToFile(): File {
|
|||
return when (this) {
|
||||
is File -> this
|
||||
is Path -> this.toFile()
|
||||
is RegularFile -> this.asFile
|
||||
is FileSystemLocation -> this.asFile
|
||||
is Provider<*> -> this.get().convertToFile()
|
||||
else -> throw PaperweightException("Unknown type representing a file: ${this.javaClass.name}")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue