shadowfacts / Forgelin

Fork of Emberwalker's Forgelin with some sprinkles on top.
Other
94 stars 30 forks source link

Kotlin classes don't compile until after the Java ones do causing Java compilation to fail #69

Closed 5HT2 closed 4 years ago

5HT2 commented 4 years ago

I have this mod here kami-blue, and when I try building with Forgelin my Kotlin classes aren't found with this error

/home/dominika/projects/kamiblue/build/sources/main/java/me/zeroeightsix/kami/KamiMod.java:22: error: cannot find symbol
import me.zeroeightsix.kami.module.modules.client.CommandConfig;
                                                 ^
  symbol:   class CommandConfig
  location: package me.zeroeightsix.kami.module.modules.client

Edit: check my kotlin branch to see the changes

bziemons commented 4 years ago

Well, you removed kotlin from the compile process altogether: https://github.com/kami-blue/client/commit/8f8d02f063ac7fa9c15bb94fceae5cfc368c989c

You still need to compile Kotlin, Forgelin will only give you the runtime dependencies for Kotlin. That means: Re-add the buildscript changes and the apply plugin: 'kotlin'

5HT2 commented 4 years ago

@bziemons I removed Intellij's Kotlin plugin and replaced it with Forgelin in the next commit.

I wasn't aware I had to keep those, that should probably be mentioned in the readme.

I'll update this issue with the result in a minute.

5HT2 commented 4 years ago

Well it compiles now, but I get the same error I had before I added Forgelin (in a normal env)

Log ``` Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: kotlin/TypeCastException at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:89) at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:599) 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) ```

You can see the branch here. Note, it works fine in a dev env. My kotlin library isn't being included in the full shadowjar. You can view the full build.gradle here

5HT2 commented 4 years ago

I got it to work by adding the Forgemod jar to my mods folder. I'd rather not make users download 2 jars, I'm trying to work out how to include it now.

5HT2 commented 4 years ago

I got it working, though it did double my jar size and now it's too big for discord. Oh well. You can see how I did it here