diff --git a/paper-generator/build.gradle.kts b/paper-generator/build.gradle.kts index 8c6fa03f6a..85c29dd494 100644 --- a/paper-generator/build.gradle.kts +++ b/paper-generator/build.gradle.kts @@ -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 = register(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("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" diff --git a/paper-generator/src/test/java/io/papermc/generator/BlockStatePropertyTest.java b/paper-generator/src/test/java/io/papermc/generator/BlockStatePropertyTest.java index a139306fd7..d0c6c2cfa2 100644 --- a/paper-generator/src/test/java/io/papermc/generator/BlockStatePropertyTest.java +++ b/paper-generator/src/test/java/io/papermc/generator/BlockStatePropertyTest.java @@ -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>> ENUM_PROPERTY_VALUES; diff --git a/paper-generator/src/test/java/io/papermc/generator/MobGoalConverterTest.java b/paper-generator/src/test/java/io/papermc/generator/MobGoalConverterTest.java index 981f958d28..56052d6b58 100644 --- a/paper-generator/src/test/java/io/papermc/generator/MobGoalConverterTest.java +++ b/paper-generator/src/test/java/io/papermc/generator/MobGoalConverterTest.java @@ -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 diff --git a/paper-generator/src/test/java/io/papermc/generator/RegistryMigrationTest.java b/paper-generator/src/test/java/io/papermc/generator/RegistryMigrationTest.java index c9537b1e16..61a2648438 100644 --- a/paper-generator/src/test/java/io/papermc/generator/RegistryMigrationTest.java +++ b/paper-generator/src/test/java/io/papermc/generator/RegistryMigrationTest.java @@ -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 diff --git a/paper-server/build.gradle.kts b/paper-server/build.gradle.kts index 5f632d41d9..201ae09fef 100644 --- a/paper-server/build.gradle.kts +++ b/paper-server/build.gradle.kts @@ -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 = 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 diff --git a/paper-server/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta b/paper-server/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta index 288fbe68c6..0e2d383b51 100644 --- a/paper-server/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta +++ b/paper-server/src/main/resources/data/minecraft/datapacks/paper/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "Built-in Paper Datapack", - "pack_format": 41 + "pack_format": ${version} } }