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

Allow changing default decompiler

Open zml2008 opened this issue 1 year ago • 4 comments

There are a few alternative decompilers available for loom -- it would be nice to be able to have an easy way to change the default used with a plain genSources task -- especially when using split source sets.

For some projects I've done this workaround, but it's a bit clunky to be copy & pasting everywhere:

// Ugly hack for easy genSourcening
afterEvaluate {
    tasks.matching { it.name == "genSources" }.configureEach {
      setDependsOn(setOf("genClientOnlySourcesWithQuiltflower", "genCommonSourcesWithQuiltflower"))
    }
}

(also supposedly matching is an anti-pattern in gradle because it may cause eager evaluation of tasks? just in case anyone is wanting to copy that snippet)

zml2008 avatar Dec 17 '22 19:12 zml2008

Yeah, this is something I have wanted for a while with one limitation: Plugins should not be changing the default decompiler.

May also need to consider support issues/possible confusion as people may be running genSources thinking they are using the official decompiler when in fact they arent.

With split sources is there not an existing genSourcesWithDecompiler? If not that seems like a bug and would help a little.

modmuss50 avatar Dec 17 '22 19:12 modmuss50

I don't believe there's a technical solution to plugins changing the defaults really -- anything buildscripts can do, plugins can do too.

I wouldn't mind logging the name of the active decompiler when executing a genSources task -- that would hopefully provide the neded clarity for support issues?

There wasn't that when I set up split sources -- I had my little shorthand of ./gradlew genCoSWQ genCOSWQ going for a while until I implemented the above workaround.

zml2008 avatar Dec 17 '22 19:12 zml2008

I don't believe there's a technical solution to plugins changing the defaults really -- anything buildscripts can do, plugins can do too.

Yeah, will just need to document that, nothing stopping them from doing it now if they really wanted to.

I wouldn't mind logging the name of the active decompiler when executing a genSources task -- that would hopefully provide the neded clarity for support issues?

Sounds reasonable, I have been meaning to add a log line with the output file path as well 👍

There wasn't that when I set up split sources

Sounds like an oversight, needs fixing as well 👍

modmuss50 avatar Dec 17 '22 19:12 modmuss50

Plugins should not be changing the default decompiler.

Will modders really change it in their buildscripts? IMO it makes sense for decompiler plugins that are explicitly applied like LQF to also change the default.

Juuxel avatar Dec 17 '22 19:12 Juuxel