Pokechu22 / WorldDownloader

Makes a copy of parts of a multiplayer world for singleplayer use (EG, for backups or renders)
https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/2520465-world-downloader-mod-create-backups-of-your-builds
Other
572 stars 135 forks source link

Mutliple litemod.json files are added into litemod ZIPs #76

Open jascotty2 opened 6 years ago

jascotty2 commented 6 years ago

Not just for 1.12, but this seems to happen to all versions

Two "litemod.json" files will be added to the root of the file For example, the 1.10.litemod's root has one "litemod.json" that is 115 bytes, and another that is 242 bytes

Task :1.12.2-litemod:extractAnnotationsJar Error while building FML annotations cache: duplicate entry: litemod.json java.util.zip.ZipException: duplicate entry: litemod.json at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:232) at net.minecraftforge.gradle.user.TaskExtractAnnotations.processJar(TaskExtractAnnotations.java:106) at net.minecraftforge.gradle.user.TaskExtractAnnotations.doTask(TaskExtractAnnotations.java:79) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:780) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:747) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)

(etc)

Pokechu22 commented 6 years ago

Yep, I've seen this, haven't looked into it fully yet. I don't use any of the forge annotation features, so I haven't worried about this too much (it doesn't affect the build). I'm pretty sure this is an issue in ForgeGradle itself, which I'll investigate when I have time.

The final jar shouldn't have a duplicate litemod.json file (at least on my machine it doesn't). If it does, please let me know.

jascotty2 commented 6 years ago

It does

jascotty2 commented 6 years ago

https://i.imgur.com/UQt0xyP.png

Pokechu22 commented 6 years ago

Can't reproduce :/ (I did a clean build, after deleting all of the produced jars)

However, I know this happens... so I'm going to have to keep testing (maybe it doesn't happen on windows? but it happened on windows before?)

jascotty2 commented 6 years ago

Using Oracle Java 8 (1.8.0_151) for Linux, and Engrampa 1.18.3 to read the archive. What java version are you using to build with? The files in the releases directory are ok - just the ones I built have that error

Pokechu22 commented 6 years ago

I'm using Oracle java 1.8.0_162 on windows, and I've used 7-zip (from past experience I know 7-zip handles multiple files with the same name correctly; it displays both of them).

Pokechu22 commented 6 years ago

Can reproduce the error message now, though the built jar still doesn't contain a duplicate litemod.json on my machine. However, I do see that the input jar in build/tmp/extractAnnotationsJar, and in fact the one in build/unobfJar is like that too.

Pokechu22 commented 6 years ago

See also #70. It looks like the unobfuscated jar having a duplicate litemod.json is a pretty old issue, but normally that's solved after reobf.

Normally, the extractAnnotationsJar task works off of the reobf'd jar, but it targets the regular jar. This happens because the reobf task is designed to change the jar in place. Since that's caused me pain before (that's what #70 was), I've tweaked that task to not do it in place. But, that means extractAnnotationsJar doesn't target the right jar for me, because it works on the non-replaced one instead of the new one.

This does seem to cause other issues, so I'll be submitting it to FG first instead of fixing it in begradle.

Pokechu22 commented 6 years ago

I've created an FG issue for the litemod task generating an extra one, and have pushed a change that will hopefully fix the task too (there's some other work with it that I'd like to do soon though, but I'd like to know if this change helps or not).

EDIT: actually pushed, seems like I forgot to do so yesterday

jascotty2 commented 6 years ago

Refreshed everything to try this out, and getting another error, this time getting the environment set up: $ ./gradlew install

FAILURE: Build failed with an exception.

Pokechu22 commented 6 years ago

Oh, I did something silly. I pushed v0.1.3 for BEGradle, but then I pushed another commit to mark it as 0.1.4-SNAPSHOT. In begradle if you run git checkout v0.1.3 first it'll give you that version.

I really need to set up a maven repo for it at some point; having to manually build it is a bit of a mess.

jascotty2 commented 6 years ago

the file in [version]-litemod/build/unobfJar still gets two copies of the same entry, but the compile works without error now and the version that's copied to libs works correctly :)

uyjulian commented 6 years ago

Are you on a case-sensitive filesystem?

jascotty2 commented 6 years ago

Yes.

Pokechu22 commented 6 years ago

I can reproduce the duplicate one before obf (and I've created this forgegradle issue for that), though it's still something that ideally shouldn't be happening. I'll also note that I'm using a case-insensitive file system.