diff --git a/.gitignore b/.gitignore index c70bdc40..3241d732 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ libs media classes/ .architectury-transformer/ +fabric/fabricloader.log # Changelog CHANGELOG.md diff --git a/build.gradle b/build.gradle index ecff6d38..d9368c1b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" - id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false + id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false id "maven-publish" id 'com.matthewprenger.cursegradle' version '1.4.0' apply false id 'com.palantir.git-version' version '1.0.0' diff --git a/fabric/build.gradle b/fabric/build.gradle index 69002e2e..02c657f9 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -26,6 +26,8 @@ configurations { dependencies { modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" + testImplementation "net.fabricmc:fabric-loader-junit:${rootProject.fabric_loader_version}" + modIncludeImplementation(fabricApi.module("fabric-api-base", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' } modIncludeImplementation(fabricApi.module("fabric-lifecycle-events-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' } modIncludeImplementation(fabricApi.module("fabric-screen-api-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' } @@ -38,8 +40,21 @@ dependencies { // Remove the next line if you don't want to depend on the API // modApi "me.shedaniel:architectury-fabric:${rootProject.architectury_version}" - common(project(path: ":common", configuration: "namedElements")) { transitive false } + testImplementation(common(project(path: ":common", configuration: "namedElements"))) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } + + testImplementation(platform("org.junit:junit-bom:${project.junit_version}")) + testImplementation("org.junit.jupiter:junit-jupiter-api") + testImplementation("org.junit.jupiter:junit-jupiter-params") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") + testImplementation("org.junit.platform:junit-platform-launcher") + testImplementation("org.assertj:assertj-core:3.19.0") + testImplementation("com.google.guava:guava-testlib:21.0") + testImplementation("org.mockito:mockito-junit-jupiter:5.3.1") +} + +test { + useJUnitPlatform() } processResources { @@ -54,18 +69,18 @@ shadowJar { exclude "architectury.common.json" configurations = [project.configurations.shadowCommon] - classifier "dev-shadow" + archiveClassifier.set("dev-shadow") } remapJar { injectAccessWidener = true input.set shadowJar.archiveFile dependsOn shadowJar - classifier null + archiveClassifier.set(null) } jar { - classifier "dev" + archiveClassifier.set("dev") } components.java { diff --git a/fabric/src/test/java/org/embeddedt/modernfix/blocks/BlockStateCacheTest.java b/fabric/src/test/java/org/embeddedt/modernfix/blocks/BlockStateCacheTest.java new file mode 100644 index 00000000..f45fb0c7 --- /dev/null +++ b/fabric/src/test/java/org/embeddedt/modernfix/blocks/BlockStateCacheTest.java @@ -0,0 +1,28 @@ +/* +package org.embeddedt.modernfix.blocks; + +import net.minecraft.DetectedVersion; +import net.minecraft.core.Registry; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.Bootstrap; +import net.minecraft.world.item.Items; +import org.junit.Test; +import org.junit.jupiter.api.BeforeAll; + +import static org.junit.jupiter.api.Assertions.*; + +public class BlockStateCacheTest { + @BeforeAll + public static void setup() { + DetectedVersion.tryDetectVersion(); + Bootstrap.bootStrap(); + } + + @Test + public void testItemRegistry() { + ResourceLocation location = Registry.ITEM.getKey(Items.DIAMOND); + assertEquals(location.toString(), "minecraft:diamond"); + } +} + + */ \ No newline at end of file diff --git a/forge/build.gradle b/forge/build.gradle index 18e81c6e..3868a69d 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -69,17 +69,17 @@ shadowJar { exclude "architectury.common.json" configurations = [project.configurations.shadowCommon] - classifier "dev-shadow" + archiveClassifier.set("dev-shadow") } remapJar { input.set shadowJar.archiveFile dependsOn shadowJar - classifier null + archiveClassifier.set(null) } jar { - classifier "dev" + archiveClassifier.set("dev") manifest { attributes([ "Specification-Title" : "modernfix", diff --git a/gradle.properties b/gradle.properties index 2df38d00..e496e4ef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,8 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx2G +junit_version=5.10.0-M1 + mod_id=modernfix minecraft_version=1.16.5 enabled_platforms=fabric,forge diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fce..fae08049 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists