This commit is contained in:
parent
b500a5dbb1
commit
19259387ed
|
@ -7,7 +7,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "dev.frogmc"
|
group = "dev.frogmc"
|
||||||
version = "0.0.1-alpha.10"
|
version = "0.0.1-alpha.11"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
@ -28,7 +28,7 @@ dependencies {
|
||||||
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:toml:3.7.2")
|
implementation("com.electronwill.night-config:toml:3.7.3")
|
||||||
implementation("com.google.jimfs:jimfs:1.3.0")
|
implementation("com.google.jimfs:jimfs:1.3.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ abstract class PhytotelmaBuildTask : DefaultTask() {
|
||||||
val manifest = fs.getPath(Constants.MOD_METADATA_FILE)
|
val manifest = fs.getPath(Constants.MOD_METADATA_FILE)
|
||||||
val config: CommentedConfig =
|
val config: CommentedConfig =
|
||||||
TomlParser().parse(manifest, FileNotFoundAction.THROW_ERROR)
|
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'!")
|
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)
|
TomlWriter().write(config, manifest, WritingMode.REPLACE)
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.nio.file.FileSystems
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import java.util.regex.Pattern
|
||||||
import kotlin.io.path.*
|
import kotlin.io.path.*
|
||||||
|
|
||||||
object Nester {
|
object Nester {
|
||||||
|
@ -71,6 +72,8 @@ object Nester {
|
||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val pattern = Pattern.compile("(\\d+\\.\\d+\\.\\d+)")
|
||||||
|
|
||||||
private fun addMetadata(
|
private fun addMetadata(
|
||||||
input: Path,
|
input: Path,
|
||||||
group: String,
|
group: String,
|
||||||
|
@ -104,15 +107,20 @@ object Nester {
|
||||||
"\\.".toRegex(), "_"
|
"\\.".toRegex(), "_"
|
||||||
).lowercase(Locale.ROOT)
|
).lowercase(Locale.ROOT)
|
||||||
FileSystems.newFileSystem(tempFile).use {
|
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(
|
it.getPath("frog.mod.toml").writeText(
|
||||||
"""
|
"""
|
||||||
[frog]
|
[frog]
|
||||||
manifest_version = "1.0.0"
|
format_version = "1.0.0"
|
||||||
|
|
||||||
[frog.mod]
|
[frog.mod]
|
||||||
id = "$modId"
|
id = "$modId"
|
||||||
name = "$name"
|
name = "$name"
|
||||||
version = "${version.replace("(\\d+\\.\\d+\\.\\d+)(.*)".toRegex(), "$1+$2")}"
|
version = "$semver"
|
||||||
license = ""
|
license = ""
|
||||||
|
|
||||||
[frog.extensions]
|
[frog.extensions]
|
||||||
|
|
Loading…
Reference in a new issue