bump built-in datapack version

This commit is contained in:
Lulu13022002 2025-01-09 19:21:36 +01:00
parent 7d4e855366
commit c6bda73caf
No known key found for this signature in database
GPG Key ID: 491C8F0B8ACDEB01
6 changed files with 29 additions and 27 deletions

View File

@ -1,4 +1,3 @@
import io.papermc.paperweight.util.capitalized
import io.papermc.paperweight.util.defaultJavaLauncher
plugins {
@ -96,7 +95,7 @@ fun TaskContainer.registerGenerationTask(
block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
group = "generation"
dependsOn("checkModuleFor${name.capitalized()}")
dependsOn(project.tasks.check)
javaLauncher = project.javaToolchains.defaultJavaLauncher(project)
inputs.property("gameVersion", gameVersion)
inputs.dir(layout.projectDirectory.dir("src/main/java")).withPathSensitivity(PathSensitivity.RELATIVE)
@ -122,23 +121,5 @@ tasks.test {
useJUnitPlatform()
}
val test by testing.suites.existing(JvmTestSuite::class)
sequenceOf("api", "impl").forEach { side ->
sequenceOf("generate", "rewrite").forEach { type ->
val task = tasks.register<Test>("checkModuleFor${type.capitalized()}${side.capitalized()}") {
group = "verification"
javaLauncher = project.javaToolchains.defaultJavaLauncher(project)
useJUnitPlatform {
includeTags("$type-$side") // todo skip when no test found
}
testClassesDirs = files(test.map { it.sources.output.classesDirs })
classpath = files(test.map { it.sources.runtimeClasspath })
}
tasks.check {
dependsOn(task)
}
}
}
group = "io.papermc.paper"
version = "1.0-SNAPSHOT"

View File

@ -20,10 +20,8 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@Tag("generate-impl")
public class BlockStatePropertyTest {
private static Set<Class<? extends Comparable<?>>> ENUM_PROPERTY_VALUES;

View File

@ -7,13 +7,11 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Mob;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@Tag("generate-api")
public class MobGoalConverterTest {
@Test

View File

@ -11,10 +11,8 @@ import net.minecraft.resources.ResourceKey;
import net.minecraft.server.Bootstrap;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@Tag("rewrite-impl")
public class RegistryMigrationTest {
@BeforeAll

View File

@ -1,6 +1,9 @@
import io.papermc.paperweight.attribute.DevBundleOutput
import io.papermc.paperweight.util.*
import io.papermc.paperweight.util.data.FileEntry
import paper.libs.com.google.gson.annotations.SerializedName
import java.time.Instant
import kotlin.io.path.readText
plugins {
`java-library`
@ -51,6 +54,30 @@ tasks.generateDevelopmentBundle {
)
}
data class PackVersion(
val data: Double,
val resource: Double
)
data class Version(
@SerializedName("pack_version")
val packVersion: PackVersion
)
tasks.processResources {
val packVersion: Provider<Int> = tasks.extractFromBundler.flatMap { it.serverJar }.map taskScope@{
it.path.openZip().use { fs ->
return@taskScope gson.fromJson(fs.getPath(FileEntry.VERSION_JSON).readText(), Version::class.java).packVersion.data.toInt()
}
}
inputs.property("version", packVersion)
filesMatching("data/minecraft/datapacks/paper/pack.mcmeta") {
expand(mapOf(
"version" to packVersion.get()
))
}
}
abstract class Services {
@get:Inject
abstract val softwareComponentFactory: SoftwareComponentFactory

View File

@ -1,6 +1,6 @@
{
"pack": {
"description": "Built-in Paper Datapack",
"pack_format": 41
"pack_format": ${version}
}
}