CrackedPolishedBlackstoneBricksMC / minivan

Bare-minimum Gradle plugin for vanilla Minecraft
MIT License
9 stars 0 forks source link

Test sourceset doesn't have minecraft in its classpath #3

Open filloax opened 1 month ago

filloax commented 1 month ago

Hi, for my small library I tried switching to minivan from vanillagradle, but my test module (needed to avoid headache in a codec-related API I made) doesn't seem to have Minecraft in its classpath after switching. Is this normal?

filloax commented 1 month ago

A workaround was using the manual version and adding it to testImplementation, like this:

val minecraft = minivan.minecraftBuilder()
    .version(minecraftVersion)
    .accessWideners("src/main/resources/${modid}.accesswidener")
    .build()
    .minecraft;

// Fix minivan not adding minecraft to test classpath
project.dependencies.add("testImplementation", project.files(minecraft.minecraft))
minecraft.dependencies.forEach { project.dependencies.add("testImplementation", it) }

(kotlin DSL)

quat1024 commented 1 month ago

Yeah I just slap the dependency into compileOnly by default: https://github.com/CrackedPolishedBlackstoneBricksMC/minivan/blob/c5db5684cac44a713afa185874ef0e6e1bf4760b/src/main/java/agency/highlysuspect/minivan/MinivanExt.java#L59-L64

Never noticed since I don't really write a lot of tests 😅 I should add it to testCompileOnly or smtn; this should probably be made configurable as well