re-add option to specify a separate parchment game version
All checks were successful
Publish to snapshot maven / build (push) Successful in 23s
All checks were successful
Publish to snapshot maven / build (push) Successful in 23s
This commit is contained in:
parent
c2d6800981
commit
d62987cda2
|
@ -7,7 +7,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "dev.frogmc"
|
group = "dev.frogmc"
|
||||||
version = "0.0.1-alpha.28" + ("+local".takeUnless { project.hasProperty("FrogMCSnapshotsMavenPassword") } ?: "")
|
version = "0.0.1-alpha.29" + ("+local".takeUnless { project.hasProperty("FrogMCSnapshotsMavenPassword") } ?: "")
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
|
|
@ -72,12 +72,13 @@ class ProjectData(
|
||||||
var localCacheDir: Path?,
|
var localCacheDir: Path?,
|
||||||
var minecraftVersion: String?,
|
var minecraftVersion: String?,
|
||||||
var parchmentVersion: String?,
|
var parchmentVersion: String?,
|
||||||
|
var parchmentGameVersion: String?,
|
||||||
var remappedGameJarPath: Path?,
|
var remappedGameJarPath: Path?,
|
||||||
var mappings: MappingBundle?,
|
var mappings: MappingBundle?,
|
||||||
var manifestUrl: String?,
|
var manifestUrl: String?,
|
||||||
var jarManifestProperties: MutableMap<String, String>
|
var jarManifestProperties: MutableMap<String, String>
|
||||||
) {
|
) {
|
||||||
internal constructor() : this(null,null, null, null, null, null, mutableMapOf())
|
internal constructor() : this(null,null, null, null, null, null, null, mutableMapOf())
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProjectDataTypeAdapter : TypeAdapter<ProjectData>() {
|
class ProjectDataTypeAdapter : TypeAdapter<ProjectData>() {
|
||||||
|
@ -86,6 +87,8 @@ class ProjectDataTypeAdapter : TypeAdapter<ProjectData>() {
|
||||||
out.serializeNulls = true
|
out.serializeNulls = true
|
||||||
out.name("local_cache_dir").value(value.localCacheDir?.absolutePathString())
|
out.name("local_cache_dir").value(value.localCacheDir?.absolutePathString())
|
||||||
out.name("minecraft_version").value(value.minecraftVersion)
|
out.name("minecraft_version").value(value.minecraftVersion)
|
||||||
|
out.name("parchment_version").value(value.parchmentVersion)
|
||||||
|
out.name("parchment_game_version").value(value.parchmentGameVersion)
|
||||||
out.name("remapped_game_jar_path").value(value.remappedGameJarPath?.absolutePathString())
|
out.name("remapped_game_jar_path").value(value.remappedGameJarPath?.absolutePathString())
|
||||||
out.name("mappings")
|
out.name("mappings")
|
||||||
value.mappings?.let { MappingBundleTypeAdapter.write(out, it) } ?: out.nullValue()
|
value.mappings?.let { MappingBundleTypeAdapter.write(out, it) } ?: out.nullValue()
|
||||||
|
@ -118,6 +121,10 @@ class ProjectDataTypeAdapter : TypeAdapter<ProjectData>() {
|
||||||
data.parchmentVersion = value
|
data.parchmentVersion = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"parchment_game_version" -> {
|
||||||
|
data.parchmentGameVersion = value
|
||||||
|
}
|
||||||
|
|
||||||
"remapped_game_jar_path" -> {
|
"remapped_game_jar_path" -> {
|
||||||
data.remappedGameJarPath = Path.of(value)
|
data.remappedGameJarPath = Path.of(value)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package dev.frogmc.phytotelma.ext
|
package dev.frogmc.phytotelma.ext
|
||||||
|
|
||||||
import dev.frogmc.phytotelma.Constants
|
import dev.frogmc.phytotelma.Constants
|
||||||
|
import org.gradle.api.Action
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.model.ObjectFactory
|
import org.gradle.api.model.ObjectFactory
|
||||||
import org.gradle.api.provider.Property
|
import org.gradle.api.provider.Property
|
||||||
|
@ -13,9 +14,17 @@ abstract class MinecraftConfiguration @Inject constructor(
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val version: Property<String> = objects.property(String::class.java).unset()
|
val version: Property<String> = objects.property(String::class.java).unset()
|
||||||
val parchmentVersion: Property<String> = objects.property(String::class.java).unset()
|
val parchment: Property<ParchmentConfiguration> = objects.property(ParchmentConfiguration::class.java).convention(objects.newInstance(ParchmentConfiguration::class.java))
|
||||||
val manifestUrl: Property<String> = objects.property(String::class.java).convention(Constants.MOJANG_MANIFEST_URL)
|
val manifestUrl: Property<String> = objects.property(String::class.java).convention(Constants.MOJANG_MANIFEST_URL)
|
||||||
|
|
||||||
|
fun parchment(action: Action<ParchmentConfiguration>) {
|
||||||
|
action.execute(parchment.get())
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class ParchmentConfiguration @Inject constructor(objects: ObjectFactory) {
|
||||||
|
val gameVersion: Property<String> = objects.property(String::class.java).unset()
|
||||||
|
val version: Property<String> = objects.property(String::class.java).unset()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class VersionConfiguration @Inject constructor(objects: ObjectFactory) {
|
abstract class VersionConfiguration @Inject constructor(objects: ObjectFactory) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
||||||
error("No Minecraft version provided!")
|
error("No Minecraft version provided!")
|
||||||
}
|
}
|
||||||
val version = mcConf.version.get()
|
val version = mcConf.version.get()
|
||||||
val parchmentVersion = mcConf.parchmentVersion.get()
|
val parchment = mcConf.parchment.get()
|
||||||
val projectData = ProjectStorage.get(project)
|
val projectData = ProjectStorage.get(project)
|
||||||
projectData.manifestUrl = mcConf.manifestUrl.get()
|
projectData.manifestUrl = mcConf.manifestUrl.get()
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
||||||
).reverse(),
|
).reverse(),
|
||||||
ParchmentProvider.getParchment(
|
ParchmentProvider.getParchment(
|
||||||
version,
|
version,
|
||||||
projectData.localCacheDir!!.resolve("org/parchmentmc/parchment/${version}/${parchmentVersion}")
|
projectData.localCacheDir!!.resolve("org/parchmentmc/parchment/${parchment.gameVersion.get()}/${parchment.version.get()}")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -69,7 +69,7 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
||||||
remappedClientJar.createParentDirectories()
|
remappedClientJar.createParentDirectories()
|
||||||
remappedServerJar.createParentDirectories()
|
remappedServerJar.createParentDirectories()
|
||||||
val flattened = mappings.flattenData()
|
val flattened = mappings.flattenData()
|
||||||
if (remappedClientJar.notExists() || parchmentVersion != projectData.parchmentVersion) {
|
if (remappedClientJar.notExists() || parchment.version.get() != projectData.parchmentVersion || parchment.gameVersion.get() != projectData.parchmentGameVersion) {
|
||||||
println("Remapping client...")
|
println("Remapping client...")
|
||||||
Thyroxine.remap(
|
Thyroxine.remap(
|
||||||
flattened,
|
flattened,
|
||||||
|
@ -77,7 +77,7 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
||||||
)
|
)
|
||||||
VersionChecker.saveClientPomFile(version, remappedClientJar.parent)
|
VersionChecker.saveClientPomFile(version, remappedClientJar.parent)
|
||||||
}
|
}
|
||||||
if (remappedServerJar.notExists() || parchmentVersion != projectData.parchmentVersion) {
|
if (remappedServerJar.notExists() || parchment.version.get() != projectData.parchmentVersion || parchment.gameVersion.get() != projectData.parchmentGameVersion) {
|
||||||
println("Remapping server...")
|
println("Remapping server...")
|
||||||
Thyroxine.remap(
|
Thyroxine.remap(
|
||||||
flattened,
|
flattened,
|
||||||
|
@ -89,8 +89,9 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
||||||
projectData.localCacheDir!!.resolve("net/minecraft/minecraft-merged/$version/minecraft-merged-$version.jar")
|
projectData.localCacheDir!!.resolve("net/minecraft/minecraft-merged/$version/minecraft-merged-$version.jar")
|
||||||
projectData.remappedGameJarPath = mergedJar
|
projectData.remappedGameJarPath = mergedJar
|
||||||
var applyAW = AccessWidener.needsUpdate(project)
|
var applyAW = AccessWidener.needsUpdate(project)
|
||||||
if (mergedJar.notExists() || applyAW || parchmentVersion != projectData.parchmentVersion) {
|
if (mergedJar.notExists() || applyAW || parchment.version.get() != projectData.parchmentVersion || parchment.gameVersion.get() != projectData.parchmentGameVersion) {
|
||||||
projectData.parchmentVersion = parchmentVersion
|
projectData.parchmentVersion = parchment.version.get()
|
||||||
|
projectData.parchmentGameVersion = parchment.gameVersion.get()
|
||||||
println("Merging game...")
|
println("Merging game...")
|
||||||
mergedJar.createParentDirectories()
|
mergedJar.createParentDirectories()
|
||||||
FileSystems.newFileSystem(mergedJar, mapOf("create" to "true")).use { mergedFs ->
|
FileSystems.newFileSystem(mergedJar, mapOf("create" to "true")).use { mergedFs ->
|
||||||
|
|
Loading…
Reference in a new issue