MinecraftForge / ForgeGradle

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

Yet another issue with run tasks #750

Closed tie closed 3 years ago

tie commented 3 years ago

Running gradle runClient on 1.12 project with empty caches (as in rm -rf ~/.gradle) fails with the same error as in #748. Importing 1.12 project in IntelliJ does some weird Gradle magic incantations and things “just work”. See also https://github.com/MinecraftForge/ForgeGradle/issues/748#issuecomment-783112444

I can reproduce the issue with the latest FG 4.0.19 and older versions down to 3.0.166 (older than that probably just don’t work with 1.12 because I was getting userdev dependency errors). That is to say that I couldn’t track down the commit (if there is any) that broke things.

Minimal build.gradle ``` buildscript { repositories { maven { url = 'https://files.minecraftforge.net/maven' } jcenter() mavenCentral() } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:4.0.19' // down to 3.0.166 } } apply plugin: 'net.minecraftforge.gradle' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' minecraft { mappings channel: 'stable', version: '39-1.12' runs { client { } } } // See https://github.com/MinecraftForge/ForgeGradle/issues/627 configurations.all { resolutionStrategy { force 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209' } } dependencies { minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2854' } ```
Logs - [idea sync](https://github.com/MinecraftForge/ForgeGradle/files/6022929/00-idea-project-import.log) - [idea runClient](https://github.com/MinecraftForge/ForgeGradle/files/6022930/01-idea-run-client.log) - [gradle runClient](https://github.com/MinecraftForge/ForgeGradle/files/6022932/10-gradle-run-client.log)

The suspicious bits extracted from logs:

Log (IntelliJ IDEA, project import) ``` MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854_mapped_stable_39-1.12:sources@jar MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854:sources@jar Mapping: stable_39-1.12 Finding Decomp: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854/forge-1.12.2-14.23.5.2854-decomp.jar Decompiling Setting up MCP environment Initializing steps Executing steps > Running 'downloadManifest' > Running 'downloadJson' > Running 'downloadClient' > Running 'downloadServer' > Running 'stripClient' > Running 'stripServer' > Running 'merge' > Running 'rename' > Running 'mcinject' > Running 'listLibraries' > Running 'AccessTransformer' [17:52:26] [main/INFO]: Access Transformer processor running version 1.0.5+4+02b7b69 [17:52:26] [main/INFO]: Command line arguments [--inJar, /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/mcp/1.12.2-20200226.224830/joined/mcinject/output.jar, --outJar, /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/mcp/1.12.2-20200226.224830/joined/AccessTransformer/output.jar, --atFile, /var/folders/xt/1n6rpl0n5fq8d9hvyd5yp00h0000gn/T/FG_ats_2360715114856719641.cfg] [17:52:26] [main/INFO]: Reading from /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/mcp/1.12.2-20200226.224830/joined/mcinject/output.jar [17:52:26] [main/INFO]: Writing to /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/mcp/1.12.2-20200226.224830/joined/AccessTransformer/output.jar [17:52:26] [main/INFO]: Transformer file /var/folders/xt/1n6rpl0n5fq8d9hvyd5yp00h0000gn/T/FG_ats_2360715114856719641.cfg [17:52:26] [main/WARN]: Found existing output jar /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/mcp/1.12.2-20200226.224830/joined/AccessTransformer/output.jar, overwriting [17:52:27] [main/INFO]: JAR transformation complete /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/mcp/1.12.2-20200226.224830/joined/AccessTransformer/output.jar > Running 'decompile' > Running 'inject' > Running 'patch' MCP environment setup is complete Finding patched: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854/forge-1.12.2-14.23.5.2854-decomp.jar Generating […]DiffPatch log omitted[…] Injecting patcher extras Mapping: net.minecraft:mappings_stable:39-1.12@zip Finding Source: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854_mapped_stable_39-1.12/forge-1.12.2-14.23.5.2854_mapped_stable_39-1.12-sources.jar Renaming Sources, Javadocs: false MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854_mapped_stable_39-1.12:sources@jar MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854:sources@jar Mapping: stable_39-1.12 Finding Decomp: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854/forge-1.12.2-14.23.5.2854-decomp.jar Cache Hit Finding patched: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854/forge-1.12.2-14.23.5.2854-decomp.jar Cache Hit Mapping: net.minecraft:mappings_stable:39-1.12@zip Finding Source: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854_mapped_stable_39-1.12/forge-1.12.2-14.23.5.2854_mapped_stable_39-1.12-sources.jar Cache hit ```
Log (IntelliJ IDEA, runClient) ``` MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854_mapped_stable_39-1.12:null@jar MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854:@jar Mapping: stable_39-1.12 Mapping: net.minecraft:mappings_stable:39-1.12@zip Finding Decomp: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854/forge-1.12.2-14.23.5.2854-decomp.jar Cache Hit Finding patched: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854/forge-1.12.2-14.23.5.2854-decomp.jar Cache Hit Mapping: net.minecraft:mappings_stable:39-1.12@zip Finding Source: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854_mapped_stable_39-1.12/forge-1.12.2-14.23.5.2854_mapped_stable_39-1.12-sources.jar Cache hit Mapping: net.minecraft:mappings_stable:39-1.12@zip Finding Recomp: Cache Hit Finding Raw: Returning Recomp: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854_mapped_stable_39-1.12/forge-1.12.2-14.23.5.2854_mapped_stable_39-1.12-recomp.jar ```

So apparently runClient uses recomp jar that was generated when IDEA requested sources jar. However, recomp is not generated when running gradle runClient or even gradle build && gradle runClient.

Log (Gradle, runClient x2) Note that I’ve run `gradle runClient` once before this log so that it’s not spammed with assets “Downloading” messages. ``` > Task :runClient MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854_mapped_stable_39-1.12:null@pom MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854:@pom Mapping: stable_39-1.12 Finding Pom: Cache Hit MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854_mapped_stable_39-1.12:null@jar MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854:@jar Mapping: stable_39-1.12 Mapping: net.minecraft:mappings_stable:39-1.12@zip MinecraftUserRepo Request: net.minecraft:mappings_stable:39-1.12:null@zip MCPRepo Request: net.minecraft:mappings_stable:39-1.12:null@zip MCPRepo Request: net.minecraft:mappings_stable:39-1.12:@zip Mapping: de.oceanlabs.mcp:mcp_stable:39-1.12@zip Finding Decomp: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854/forge-1.12.2-14.23.5.2854-decomp.jar Finding Patched: Decomp not found Finding Source: Patched not found Finding Recomp: Sources not found Finding Raw: Cache Hit: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854_mapped_stable_39-1.12/forge-1.12.2-14.23.5.2854_mapped_stable_39-1.12.jar MinecraftUserRepo Request: net.minecraft:mappings_stable:39-1.12:null@pom MCPRepo Request: net.minecraft:mappings_stable:39-1.12:null@pom MCPRepo Request: net.minecraft:mappings_stable:39-1.12:@pom Finding pom: /Users/tie/.gradle/caches/forge_gradle/mcp_repo/net/minecraft/mappings_stable/39-1.12/mappings_stable-39-1.12.pom MinecraftUserRepo Request: net.minecraft:mappings_stable:39-1.12:null@jar MCPRepo Request: net.minecraft:mappings_stable:39-1.12:null@jar MCPRepo Request: net.minecraft:mappings_stable:39-1.12:@jar MinecraftRepo Request: net.minecraft:mappings_stable:39-1.12:null@jar MinecraftUserRepo Request: net.minecraft:mappings_stable:39-1.12:null@zip MCPRepo Request: net.minecraft:mappings_stable:39-1.12:null@zip MCPRepo Request: net.minecraft:mappings_stable:39-1.12:@zip Mapping: de.oceanlabs.mcp:mcp_stable:39-1.12@zip MinecraftUserRepo Request: net.minecraft:mappings_stable:39-1.12:null@zip MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854_mapped_stable_39-1.12:null@jar MCPRepo Request: net.minecraft:mappings_stable:39-1.12:null@zip MinecraftUserRepo Request: net.minecraftforge:forge:1.12.2-14.23.5.2854:@jar Mapping: stable_39-1.12 MCPRepo Request: net.minecraft:mappings_stable:39-1.12:@zip Mapping: net.minecraft:mappings_stable:39-1.12@zip Mapping: de.oceanlabs.mcp:mcp_stable:39-1.12@zip Finding Decomp: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854/forge-1.12.2-14.23.5.2854-decomp.jar Finding Patched: Decomp not found Finding Source: Patched not found Finding Recomp: Sources not found Finding Raw: Cache Hit: /Users/tie/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.12.2-14.23.5.2854_mapped_stable_39-1.12/forge-1.12.2-14.23.5.2854_mapped_stable_39-1.12.jar ```
tie commented 3 years ago

Not sure if this is intentional: should --output file contain relauncher.Side enum including BUKKIT case? https://github.com/MinecraftForge/ForgeGradle/issues/748#issuecomment-782861208

Yes https://github.com/MinecraftForge/ForgeGradle/issues/748#issuecomment-782867050

@LexManos could you please clarify why we need to inject these classes in 1.12.x and 1.13.x (and why does the injected Side enum have BUKKIT case)? E.g. MCPConfig’s for newer versions pass --inject false option to MergeTool.

tie commented 3 years ago

I’m not sure why you’ve closed the issue when it’s not resolved in 4.0.22.

Anyway, I’ve figured out that you’ve fixed Side.BUKKIT in https://github.com/MinecraftForge/MergeTool/commit/e68e1b06ba87c68bc1a5c922395286b53a17dddf commit.

However, the downloaded mcp_config artifact (1.12.2-20200226.224830) depends on net.minecraftforge:mergetool:1.0.13:forge instead of net.minecraftforge:mergetool:0.2.3.5:fatjar in config.json.

Edit: the config sets --inject to false so that shouldn’t be an issue.

tie commented 3 years ago

So if I understand that correctly, mcp_config version comes from userdev3 jar.

tie commented 3 years ago

At least I think it should, but in fact it doesn’t.

https://github.com/MinecraftForge/ForgeGradle/blob/a5ffcad0f555a8c6cd922ef53361e02bf1a8e080/src/mcp/java/net/minecraftforge/gradle/mcp/MCPRepo.java#L213-L215 https://github.com/MinecraftForge/ForgeGradle/blob/a5ffcad0f555a8c6cd922ef53361e02bf1a8e080/src/mcp/java/net/minecraftforge/gradle/mcp/MCPRepo.java#L301-L307

https://github.com/MinecraftForge/ForgeGradle/blob/a5ffcad0f555a8c6cd922ef53361e02bf1a8e080/src/mcp/java/net/minecraftforge/gradle/mcp/MCPRepo.java#L290-L295 https://github.com/MinecraftForge/ForgeGradle/blob/a5ffcad0f555a8c6cd922ef53361e02bf1a8e080/src/mcp/java/net/minecraftforge/gradle/mcp/MCPRepo.java#L173-L188
MCPRepo Request: net.minecraft:joined:1.12.2:null@jar
  MCPRepo Request: net.minecraft:joined:1.12.2:@jar
  Finding merge: ~/.gradle/caches/forge_gradle/mcp_repo/net/minecraft/joined/1.12.2/joined-1.12.2.jar

That is, the version is 1.12.2 and so the latest mcp_config for 1.12.2 is used instead of what’s specified in userdev jar config.

tie commented 3 years ago

@LexManos could you please reopen this issue as that appears to be a bug with ForgeGradle and it’s actually not related to the unsupported 1.12.x release?

Edit: submitted a fix, no need to reopen the issue as merging the PR will close it anyway.

tie commented 3 years ago

Looks like the following should be mcp.getVersion() + (notch ? "" : ":srg").

https://github.com/MinecraftForge/ForgeGradle/blob/f61d2a42b1c601b1ab92079ff5559ab16842b47c/src/userdev/java/net/minecraftforge/gradle/userdev/MinecraftUserRepo.java#L708-L712

m-doescode commented 1 year ago

If you don't mind me asking, have you managed to fix this issue yourself? Or is it still broken?

If so, do you mind letting me know how I could fix it for myself as I am experiencing the same error in the latest version of FG (5.1).

Thank you!

CliffracerX commented 1 year ago

I'll give this a bump. I'm doing some maintenance on legacy mods and this is still an issue; circumventable by copying the built mod into an otherwise-empty Forge instance, but still a hinderance to testing.