java-mixin-stubber
Removes everything from java source files that is not needed for Mixin's RefMap generation. This currently includes comments, project specific imports and method bodies.
Using this to generate a RefMap from src/main/scala in forgegradle
buildscript {
dependencies {
classpath 'de.lolhens:java-mixin-stubber:0.0.2'
}
}
def mixinstubsDir = file("$compileJava.temporaryDir/mixinstubs")
sourceSets.main.java.srcDirs += mixinstubsDir
def mixinstubs = task('mixinstubs') {
doLast {
delete(mixinstubsDir)
de.lolhens.jstubber.Stubber.MIXIN.stubDirectory(sourceSets.main.scala.srcDirs[0].toPath(), mixinstubsDir.toPath())
}
}
compileJava.dependsOn(mixinstubs)
compileJava.doLast {
delete(compileJava.destinationDir)
delete(mixinstubsDir)
}
compileScala.doFirst {
compileScala.options.compilerArgs += compileJava.options.compilerArgs
}
mixin {
add sourceSets.main, "${mod_id}.refmap.json"
}