MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
507 stars 436 forks source link

Incorrect work of the decompiler #941

Closed Icosider closed 5 months ago

Icosider commented 5 months ago

Steps to reproducing:

  1. Download official Forge 1.19.2 or 1.20.x
  2. Unzip file and open in Intellij Idea image
  3. Change Java to 17 version
  4. Run sync gradle project
  5. Run genIntellijRuns task
  6. Wait to finishing all tasks

Necessary conditions: Your .gradle folder in user(example C:\Users\ur_user_name.gradle) must be removed or completely cleaned!

Then you will get the following list of files at the output: image

In path: C:\Users\ur_user_name.gradle\caches\forge_gradle\minecraft_user_repo\net\minecraftforge\forge\1.19.2-43.3.7_mapped_official_1.19.2

Must be: image

It was also sometimes noticed that the ForgeGradle added the fg_cache folder to the build folder of your project.

I rechecked this error on 3 different computers and everywhere there was a similar result.

LexManos commented 5 months ago

There is no issues here. You have to import the project twice for decompiled sources to show up. And it will use the project directory when you're using access transformers. These are intended behaviors.

Icosider commented 5 months ago

What is the point of this logic? Why does it work this way and not all at once? Why is there no information about this in Forge_Docs?

LexManos commented 5 months ago

It works this way because intellij/gradle requests the sources after requesting the binaries. It works this way because it is faster for CI builds, or any build that doesn't need the source as decompiling takes a long time. It'll be opt-in in FG7, but I havent cared to make it opt-in in FG3-6 if you wanna change that feel free to submit a PR.

Icosider commented 5 months ago

And so, I imported the project into Intellij idea. The first time sync worked, everything is as it should be. Then close daemon forcibly and closed Intellij Idea. I reopened and imported the project and did the synchronization, but it still doesn't work, as you said.

LexManos commented 5 months ago

There is no need to force kill anything. And if its not working as expected then you need to provide more information on what you're doing, given your project, and what you expect to happen. As it works fine for hundreds of thousands of others.

Icosider commented 5 months ago

Good. From what I did, I took the usual forge 1.19.2 (I know that it is not supported, but the FG version is the latest for many MC versions). Then im "open" in intellij idea, click on "Sync" button and wait for loading. When loading was finished, I closed the project and, just in case, completely Intellij Idea. I started Intellij Idea again, started "Sync", waited for the download and... Nothing happened. the sources jar did not appear. Not in user/.gradle and not in projectFolder/build. If you do not close the project and immediately re-Sync, then this will not work. I didn't do genIntellijRuns.

Icosider commented 5 months ago

After click on "Sync" button: image

Upd: Found here in the console: "Cannot resolve resource filtering of MatchingCopyAction. IDEA may fail to build project. Consider using delegated build (enabled by default)."

LexManos commented 5 months ago

Thats my workspace after 'Open' -> Select Directory -> As gradle project -> wait -> Resync

Icosider commented 5 months ago

When i click "Sync", then i get this log: image

LexManos commented 5 months ago

Yes that means nothing. Try using it without intellij. Use the normal command line.

Icosider commented 5 months ago

Hrm, it's work for console, but not for intellij idea

Icosider commented 5 months ago

So, i have new progress in my problem. I remove a build and .gradle from test project. And i click to: image On "unlink gradle project", then click to "Sync" and it's work for Idea.

I assume that in the new versions of Intellij Idea there is a certain cache of Gradle projects that saves the state and does not call the task for decompilation when resync occurs.

Perhaps I should identify the reason for this behavior directly in the ForgeGradle code and try to fix it.

@LexManos, any suggestions?

PaintNinja commented 5 months ago

Please use the Discord for support. Issue reports are for final, confirmed problems.

LexManos commented 5 months ago

Ya use discord and maybe someone who actually uses intellij for their daily driver will help you. I dont I just use it for testing basic things making sure they work. Worst case just use the command line to setup your project then import them as normal.