fabric-loom icon indicating copy to clipboard operation
fabric-loom copied to clipboard

Adding a `whenTaskAdded` hook before loom applies causes loom to fail (and hooking after with loom 0.11+)

Open SilverAndro opened this issue 2 years ago • 2 comments

Seems to happen with loom 0.7 and above minimum

PoC: https://github.com/p03w-rehost/LoomFailurePoC

When testing, make sure to publish to maven local first (LoomFailurePoCPlugin:publishToMavenLocal) before un-commenting the apply block in build.gradle


0.7-0.10 gives

> Failed to apply plugin 'fabric-loom'.
   > Could not create task ':runClient'.
      > Could not create task of type 'RunGameTask'.
         > Run configuration 'client' must specify 'defaultMainClass'

0.11 and 0.12 both give

> Failed to apply plugin 'fabric-loom'.
   > Task with name 'genIdeaWorkspace' not found in root project 'LoomFailure'.

Likely because I'm using IDEA, unknown behavior on eclipse

0.11 and 0.12 with the plugin applying after gives

> Failed to apply plugin 'io.github.p03w.loomFailure'.
   > Could not create task ':extractNatives'.
      > Could not create task of type 'ExtractNativesTask'.
         > Cannot get MinecraftProvider before it has been setup

SilverAndro avatar Mar 06 '22 03:03 SilverAndro

whenTaskAdded isnt great as it forces all tasks to instantly be configured, I would try using configureEach. I dont think we can really solve this tbh.

modmuss50 avatar Apr 15 '22 23:04 modmuss50

Technically this could be solved if tasks are only registered when it's safe to run their initialisers (or register the initialisers only when it's safe to do so), but that's quite a change in the code base

Juuxel avatar Apr 16 '22 22:04 Juuxel

I dont think think is something we are going to change. You shouldnt realise all of the tasks at once.

modmuss50 avatar Mar 19 '24 22:03 modmuss50