MinecraftForge / ForgeGradle

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

Cannot mutate content repository descriptor when using `jarJar.component` #914

Closed SquidDev closed 1 year ago

SquidDev commented 1 year ago

Steps to reproduce:

  1. Download the latest MDK
  2. Add a jarJar dependency and a call to jarJar.component(it) inside the publication. Alternatively, apply the following patch:

    ```diff index 010471f..f7900b8 100644 --- a/build.gradle +++ b/build.gradle @@ -123,6 +123,7 @@ repositories { // flatDir { // dir 'libs' // } + mavenCentral() } dependencies { @@ -131,6 +132,8 @@ dependencies { // The userdev artifact is a special name and will get all sorts of transformations applied to it. minecraft 'net.minecraftforge:forge:1.19.4-45.0.29' + jarJar(group: 'com.google.code.gson', name: 'gson', version: '[2.0,3.0)') + // Real mod deobf dependency examples - these get remapped to your current mappings // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency @@ -167,6 +170,7 @@ publishing { publications { mavenJava(MavenPublication) { artifact jar + jarJar.component(it) } } repositories { ```
  3. Start a build. You will receive a Cannot mutate content repository descriptor 'BUNDELED_-1772914211(file:/home/squid/.gradle/caches/forge_gradle/bundled_deobf_repo)' after repository has been used error

Further notes:

I realise this is a similar report to #912. However, this pattern of using jarJar.component is documented and (AFAIK) expected to work, so does feel like a bug

marchermans commented 1 year ago

@Matyrobbrt Will you take care of this?

Matyrobbrt commented 1 year ago

I'll take a look in a couple of hours.

SquidDev commented 1 year ago

Thank you!