bump version, update thyroxine
All checks were successful
Publish to snapshot maven / build (push) Successful in 31s

This commit is contained in:
moehreag 2024-06-12 22:51:55 +02:00
parent 2d4cf1f035
commit c4c62632c2
4 changed files with 22 additions and 14 deletions

View file

@ -1,3 +1,5 @@
import java.util.Date
plugins { plugins {
kotlin("jvm") version "2.0.0" kotlin("jvm") version "2.0.0"
`java-gradle-plugin` `java-gradle-plugin`
@ -5,7 +7,7 @@ plugins {
} }
group = "dev.frogmc" group = "dev.frogmc"
version = "0.0.1-SNAPSHOT" version = "0.0.1-alpha.1"
repositories { repositories {
maven { maven {
@ -21,11 +23,12 @@ repositories {
} }
dependencies { 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("org.ow2.asm:asm:9.7")
implementation("com.google.code.gson:gson:2.10.1") implementation("com.google.code.gson:gson:2.10.1")
implementation("org.vineflower:vineflower:1.10.1") implementation("org.vineflower:vineflower:1.10.1")
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
implementation("com.electronwill.night-config:json:3.7.2")
implementation("com.electronwill.night-config:toml:3.7.2") implementation("com.electronwill.night-config:toml:3.7.2")
implementation("com.google.jimfs:jimfs:1.3.0") implementation("com.google.jimfs:jimfs:1.3.0")
} }
@ -41,7 +44,10 @@ gradlePlugin {
tasks.jar { tasks.jar {
manifest { manifest {
attributes["Implementation-Version"] = version attributes("Implementation-Version" to version,
"Implementation-Date" to Date(),
"Implementation-Name" to project.name
)
} }
} }

View file

@ -3,6 +3,7 @@ package dev.frogmc.phytotelma
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.GsonBuilder import com.google.gson.GsonBuilder
import dev.frogmc.phytotelma.common.CachingHttpClient import dev.frogmc.phytotelma.common.CachingHttpClient
import org.gradle.api.Project
import java.net.URI import java.net.URI
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Path import java.nio.file.Path
@ -12,14 +13,14 @@ object VersionChecker {
private var validVersions = mutableListOf<VersionUrl>() private var validVersions = mutableListOf<VersionUrl>()
private var versionData: VersionData? = null private var versionData: VersionData? = null
fun downloadClient(version: String): Path { fun downloadClient(project: Project, version: String): Path {
fetchVersionData(version) fetchVersionData(version)
val clientData = fetchClientDownload(version) val clientData = fetchClientDownload(version)
// download client data // download client data
val downloadDirectory = PhytotelmaPlugin.globalCacheDir.resolve("net/minecraft/client/$version/") val downloadDirectory = PhytotelmaPlugin.globalCacheDir.resolve("net/minecraft/client/$version/")
val downloadFile = downloadDirectory.resolve("client-$version.jar") 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.") println("Client already downloaded! Assuming it's valid. FIXME: Add checksum validation.")
return downloadFile return downloadFile
} }
@ -89,7 +90,7 @@ object VersionChecker {
return CachingHttpClient.getString(URI.create(url)) return CachingHttpClient.getString(URI.create(url))
} }
internal fun getValidVersions() { private fun getValidVersions() {
if (validVersions.isNotEmpty()) return if (validVersions.isNotEmpty()) return
// get json from https://piston-meta.mojang.com/mc/game/version_manifest_v2.json // get json from https://piston-meta.mojang.com/mc/game/version_manifest_v2.json
// make http request // make http request

View file

@ -5,10 +5,10 @@ import org.gradle.api.provider.Provider
@Suppress("unused") @Suppress("unused")
interface PhytotelmaGradleExtension { 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) { fun minecraft(version: Provider<String>, parchmentGameVersion: Provider<String> = version, parchmentVersion: Provider<String>? = null) {
minecraft(version.get(), parchmentVersion?.get()) minecraft(version.get(), parchmentGameVersion.get(), parchmentVersion?.get())
} }
fun loader(version: String) fun loader(version: String)

View file

@ -20,7 +20,7 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
@Inject @Inject
abstract fun getProject(): Project abstract fun getProject(): Project
override fun minecraft(version: String, parchmentVersion: String?) { override fun minecraft(version: String, parchmentGameVersion: String, parchmentVersion: String?) {
if (VersionChecker.validateVersion(version)) { if (VersionChecker.validateVersion(version)) {
println("Setting up Minecraft...") println("Setting up Minecraft...")
val parchment = val parchment =
@ -30,7 +30,7 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
projectData.minecraftVersion = version projectData.minecraftVersion = version
projectData.parchmentVersion = parchment projectData.parchmentVersion = parchment
println("Valid version! $version") println("Valid version! $version")
val clientJar = VersionChecker.downloadClient(version) val clientJar = VersionChecker.downloadClient(getProject(), version)
val remappedJar = val remappedJar =
projectData.localCacheDir!!.resolve("net/minecraft/client/$version/client-$version-remapped.jar") projectData.localCacheDir!!.resolve("net/minecraft/client/$version/client-$version-remapped.jar")
remappedJar.createParentDirectories() remappedJar.createParentDirectories()
@ -49,15 +49,16 @@ abstract class PhytotelmaGradleExtensionImpl : PhytotelmaGradleExtension {
}.getOrNull() }.getOrNull()
val paramMappings = if (parchment.isNotEmpty()) kotlin.runCatching { val paramMappings = if (parchment.isNotEmpty()) kotlin.runCatching {
ParchmentProvider.getParchment( ParchmentProvider.getParchment(
version, parchment, parchmentGameVersion, parchment,
PhytotelmaPlugin.globalCacheDir.resolve("org/parchmentmc/parchment/$version/$parchment") PhytotelmaPlugin.globalCacheDir.resolve("org/parchmentmc/parchment/$parchmentGameVersion/$parchment"),
getProject().gradle.startParameter.isRefreshDependencies
) )
}.getOrNull() else { }.getOrNull() else {
println("Parameter mappings will not be present as no parchment version was found. It may be possible to declare it manually.") println("Parameter mappings will not be present as no parchment version was found. It may be possible to declare it manually.")
null null
} }
if (paramMappings == null && parchment.isNotEmpty()) { 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) { if (data != null) {
Thyroxine.remap(data, clientJar, remappedJar, true, paramMappings) Thyroxine.remap(data, clientJar, remappedJar, true, paramMappings)