fix some bugs
All checks were successful
Publish to snapshot maven / build (push) Successful in 35s

This commit is contained in:
moehreag 2024-06-17 20:12:12 +02:00
parent b500a5dbb1
commit 19259387ed
3 changed files with 13 additions and 5 deletions

View file

@ -7,7 +7,7 @@ plugins {
}
group = "dev.frogmc"
version = "0.0.1-alpha.10"
version = "0.0.1-alpha.11"
repositories {
maven {
@ -28,7 +28,7 @@ dependencies {
implementation("com.google.code.gson:gson:2.10.1")
implementation("org.vineflower:vineflower:1.10.1")
testImplementation(kotlin("test"))
implementation("com.electronwill.night-config:toml:3.7.2")
implementation("com.electronwill.night-config:toml:3.7.3")
implementation("com.google.jimfs:jimfs:1.3.0")
}

View file

@ -54,7 +54,7 @@ abstract class PhytotelmaBuildTask : DefaultTask() {
val manifest = fs.getPath(Constants.MOD_METADATA_FILE)
val config: CommentedConfig =
TomlParser().parse(manifest, FileNotFoundAction.THROW_ERROR)
if (!config.add("frog.extensions.included_jars", listOf(files))) {
if (!config.add("frog.extensions.included_jars", files)) {
println("Failed to add included jars to mod manifest, make sure it doesn't include a key at 'frog.extensions.included_jars'!")
}
TomlWriter().write(config, manifest, WritingMode.REPLACE)

View file

@ -14,6 +14,7 @@ import java.nio.file.FileSystems
import java.nio.file.Files
import java.nio.file.Path
import java.util.*
import java.util.regex.Pattern
import kotlin.io.path.*
object Nester {
@ -71,6 +72,8 @@ object Nester {
return files
}
private val pattern = Pattern.compile("(\\d+\\.\\d+\\.\\d+)")
private fun addMetadata(
input: Path,
group: String,
@ -104,15 +107,20 @@ object Nester {
"\\.".toRegex(), "_"
).lowercase(Locale.ROOT)
FileSystems.newFileSystem(tempFile).use {
val matcher = pattern.matcher(version)
matcher.find()
val semver = matcher.group(1) +
(if (matcher.group(2) != null) "-"+matcher.group(2) else "") +
(if (matcher.group(3) != null) "+"+matcher.group(3) else "")
it.getPath("frog.mod.toml").writeText(
"""
[frog]
manifest_version = "1.0.0"
format_version = "1.0.0"
[frog.mod]
id = "$modId"
name = "$name"
version = "${version.replace("(\\d+\\.\\d+\\.\\d+)(.*)".toRegex(), "$1+$2")}"
version = "$semver"
license = ""
[frog.extensions]