FabricMC / fabric-loom

Gradle build system plugin used to automate the setup of a minecraft mod development environment.
MIT License
226 stars 194 forks source link

[Enchancement] An easier way to enable mixin class export and mixin hot swap agent #1037

Open maityyy opened 5 months ago

maityyy commented 5 months ago

I use this and it looks ugly

afterEvaluate {
    loom.runs.configureEach {
        // https://gist.github.com/maityyy/3dbcd558d58a6412c3a2a38c72706e8e
        vmArg "-javaagent:${ configurations.compileClasspath.find { it.name.contains("sponge-mixin") } }"

        // https://github.com/SpongePowered/Mixin/wiki/Mixin-Java-System-Properties
        property "mixin.debug.export=true" // export classes with all mixin changes to run/.mixin.out
    }
}

IMO, these features are quite useful and common since most of Fabric dev is working with mixins, so enabling these features should be easier.

I suggest that these features can be enabled globally and separately for each run config

// Globally
loom {
    exportMixinClasses
    enableMixinHotSwapAgent
}

// Per run config
loom {
    runs {
        client {
            exportMixinClasses
            enableMixinHotSwapAgent
        }
    }
}

And please, no boolean flags, they look really ugly

modmuss50 commented 5 months ago

This should be possible, loom will need a task to copy the mixin agent jar to somewhere static, within the project .gradle directory, as it cannot be set via DLI.