MixinGradle is a Gradle plugin which simplifies the build-time complexity of working with the SpongePowered Mixin framework for Java. It currently only supports usage with ForgeGradle.
What is this fork for? This fork is intended for use with the Hyperium client's addon development for versions 1.3 and up. This fork makes it possible to generate refmaps Mixin based addons. Previously ForgeGradle and MixinGradle did the job, but in version 1.3, Hyperium will/has move from ForgeGradle to MCGradle.
MixinGradle automates the following tasks:
- Locating (via ForgeGradle) and supplying input mapping files to the Mixin Annotation Processor
- Providing processing options to the Annotation Processor
- Contributing the generated reference map (refmap) to the corresponding sourceSet compile task outputs
- Contributing the generated SRG files to appropriate ForgeGradle
reobf
tasks
To use MixinGradle you must be using ForgeGradle. To configure the plugin for your build:
- Add a source repository and the MixinGradle dependency to your
buildScript -> dependencies
block:
buildscript {
repositories {
<add source repository here>
}
dependencies {
...
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
Please ensure you are using the correct version of MixinGradle for your ForgeGradle version. Versions are not interchangeable.
ForgeGradle Version | Mixin Version | MixinGradle Version To Use |
---|---|---|
2.3 | 0.8 and below | 0.6-SNAPSHOT |
3.0 | 0.8 | 0.7-SNAPSHOT |
- Apply the plugin:
apply plugin: 'org.spongepowered.mixin'
- Create your
mixin
block, specify which sourceSets to process and provide refmap resource names for each one, the generated refmap will be added to the compiler task outputs automatically.
mixin {
add sourceSets.main, "main.refmap.json"
add sourceSets.another, "another.refmap.json"
}
- Alternatively, you can simply specify the
ext.refMap
property directly on your sourceSet:
sourceSets {
main {
ext.refMap = "main.refmap.json"
}
another {
ext.refMap = "another.refmap.json"
}
}
- You can define other mixin AP options in the
mixin
block, for exampledisableTargetValidator
anddisableTargetExport
can be configured either by setting them as boolean properties:
mixin {
disableTargetExport = true
disableTargetValidator = true
}
or simply issuing them as directives:
mixin {
disableTargetExport
disableTargetValidator
}
You can also set the default obfuscation environment for generated refmaps, this is the obfuscation environment which will be contributed to the refmap's mappings
node:
mixin {
// Specify "notch" or "searge" here
defaultObfuscationEnv notch
}
MixinGradle can of course be built using Gradle. To perform a build simply execute:
gradle
To add the compiled jar to your local maven repository, run:
gradle build install