bump version, update thyroxine
All checks were successful
Publish to snapshot maven / build (push) Successful in 31s
All checks were successful
Publish to snapshot maven / build (push) Successful in 31s
This commit is contained in:
parent
2d4cf1f035
commit
c4c62632c2
|
@ -1,3 +1,5 @@
|
|||
import java.util.Date
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "2.0.0"
|
||||
`java-gradle-plugin`
|
||||
|
@ -5,7 +7,7 @@ plugins {
|
|||
}
|
||||
|
||||
group = "dev.frogmc"
|
||||
version = "0.0.1-SNAPSHOT"
|
||||
version = "0.0.1-alpha.1"
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
|
@ -21,11 +23,12 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation("dev.frogmc:thyroxine:1.0.0-SNAPSHOT")
|
||||
implementation("dev.frogmc:thyroxine:0.0.1-alpha.1")
|
||||
implementation("org.ow2.asm:asm:9.7")
|
||||
implementation("com.google.code.gson:gson:2.10.1")
|
||||
implementation("org.vineflower:vineflower:1.10.1")
|
||||
testImplementation(kotlin("test"))
|
||||
implementation("com.electronwill.night-config:json:3.7.2")
|
||||
implementation("com.electronwill.night-config:toml:3.7.2")
|
||||
implementation("com.google.jimfs:jimfs:1.3.0")
|
||||
}
|
||||
|
@ -41,7 +44,10 @@ gradlePlugin {
|
|||
|
||||
tasks.jar {
|
||||
manifest {
|
||||
attributes["Implementation-Version"] = version
|
||||
attributes("Implementation-Version" to version,
|
||||
"Implementation-Date" to Date(),
|
||||
"Implementation-Name" to project.name
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package dev.frogmc.phytotelma
|
|||
import com.google.gson.Gson
|
||||
import com.google.gson.GsonBuilder
|
||||
import dev.frogmc.phytotelma.common.CachingHttpClient
|
||||
import org.gradle.api.Project
|
||||
import java.net.URI
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
|
@ -12,14 +13,14 @@ object VersionChecker {
|
|||
private var validVersions = mutableListOf<VersionUrl>()
|
||||
private var versionData: VersionData? = null
|
||||
|
||||
fun downloadClient(version: String): Path {
|
||||
fun downloadClient(project: Project, version: String): Path {
|
||||
|
||||
fetchVersionData(version)
|
||||
val clientData = fetchClientDownload(version)
|
||||
// download client data
|
||||
val downloadDirectory = PhytotelmaPlugin.globalCacheDir.resolve("net/minecraft/client/$version/")
|
||||
val downloadFile = downloadDirectory.resolve("client-$version.jar")
|
||||
if (downloadFile.exists()) {
|
||||
if (!project.gradle.startParameter.isRefreshDependencies && downloadFile.exists()) {
|
||||
println("Client already downloaded! Assuming it's valid. FIXME: Add checksum validation.")
|
||||
return downloadFile
|
||||
}
|
||||
|
@ -89,7 +90,7 @@ object VersionChecker {
|
|||
return CachingHttpClient.getString(URI.create(url))
|
||||
}
|
||||
|
||||
internal fun getValidVersions() {
|
||||
private fun getValidVersions() {
|
||||
if (validVersions.isNotEmpty()) return
|
||||
// get json from https://piston-meta.mojang.com/mc/game/version_manifest_v2.json
|
||||
// make http request
|
||||
|
|
|
@ -5,10 +5,10 @@ import org.gradle.api.provider.Provider
|
|||
@Suppress("unused")
|
||||
interface PhytotelmaGradleExtension {
|
||||
|
||||
fun minecraft(version: String, parchmentVersion: String? = null)
|
||||
fun minecraft(version: String, parchmentGameVersion: String = version, parchmentVersion: String? = null)
|
||||
|
||||
fun minecraft(version: Provider<String>, parchmentVersion: Provider<String>? = null) {
|
||||
minecraft(version.get(), parchmentVersion?.get())
|
||||
fun minecraft(version: Provider<String>, parchmentGameVersion: Provider<String> = version, parchmentVersion: Provider<String>? = null) {
|
||||
minecraft(version.get(), parchmentGameVersion.get(), parchmentVersion?.get())
|
||||
}
|
||||
|
||||
fun loader(version: String)
|
||||
|
|
|
@ -20,7 +20,7 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
|
|||
@Inject
|
||||
abstract fun getProject(): Project
|
||||
|
||||
override fun minecraft(version: String, parchmentVersion: String?) {
|
||||
override fun minecraft(version: String, parchmentGameVersion: String, parchmentVersion: String?) {
|
||||
if (VersionChecker.validateVersion(version)) {
|
||||
println("Setting up Minecraft...")
|
||||
val parchment =
|
||||
|
@ -30,7 +30,7 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
|
|||
projectData.minecraftVersion = version
|
||||
projectData.parchmentVersion = parchment
|
||||
println("Valid version! $version")
|
||||
val clientJar = VersionChecker.downloadClient(version)
|
||||
val clientJar = VersionChecker.downloadClient(getProject(), version)
|
||||
val remappedJar =
|
||||
projectData.localCacheDir!!.resolve("net/minecraft/client/$version/client-$version-remapped.jar")
|
||||
remappedJar.createParentDirectories()
|
||||
|
@ -49,15 +49,16 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
|
|||
}.getOrNull()
|
||||
val paramMappings = if (parchment.isNotEmpty()) kotlin.runCatching {
|
||||
ParchmentProvider.getParchment(
|
||||
version, parchment,
|
||||
PhytotelmaPlugin.globalCacheDir.resolve("org/parchmentmc/parchment/$version/$parchment")
|
||||
parchmentGameVersion, parchment,
|
||||
PhytotelmaPlugin.globalCacheDir.resolve("org/parchmentmc/parchment/$parchmentGameVersion/$parchment"),
|
||||
getProject().gradle.startParameter.isRefreshDependencies
|
||||
)
|
||||
}.getOrNull() else {
|
||||
println("Parameter mappings will not be present as no parchment version was found. It may be possible to declare it manually.")
|
||||
null
|
||||
}
|
||||
if (paramMappings == null && parchment.isNotEmpty()) {
|
||||
println("Parameter mappings will not be present as the version $parchmentVersion for minecraft version $version could not be found")
|
||||
println("Parameter mappings will not be present as the version $parchmentVersion for minecraft version $parchmentGameVersion could not be found")
|
||||
}
|
||||
if (data != null) {
|
||||
Thyroxine.remap(data, clientJar, remappedJar, true, paramMappings)
|
||||
|
|
Loading…
Reference in a new issue