Mixin processing runs under scala, allowing java mixins to call scala methods (#125)

dev/0.11
Elise 2019-08-23 06:59:06 -04:00 committed by Modmuss50
parent 0b07f1badf
commit 5ab5097b4d
1 changed files with 20 additions and 0 deletions

View File

@ -50,6 +50,7 @@ import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.bundling.AbstractArchiveTask;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.api.tasks.javadoc.Javadoc;
import org.gradle.api.tasks.scala.ScalaCompile;
import org.gradle.plugins.ide.eclipse.model.EclipseModel;
import org.gradle.plugins.ide.idea.model.IdeaModel;
@ -133,6 +134,7 @@ public class AbstractPlugin implements Plugin<Project> {
configureIDEs();
configureCompile();
configureScala();
Map<Project, Set<Task>> taskMap = project.getAllTasks(true);
for (Map.Entry<Project, Set<Task>> entry : taskMap.entrySet()) {
@ -164,6 +166,24 @@ public class AbstractPlugin implements Plugin<Project> {
return project;
}
protected void configureScala() {
project.afterEvaluate(proj -> {
if (project.getPluginManager().hasPlugin("scala")) {
ScalaCompile task = (ScalaCompile) project.getTasks().getByName("compileScala");
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
project.getLogger().warn(":configuring scala compilation processing");
try {
task.getOptions().getCompilerArgs().add("-AinMapFileNamedIntermediary=" + extension.getMappingsProvider().MAPPINGS_TINY.getCanonicalPath());
task.getOptions().getCompilerArgs().add("-AoutMapFileNamedIntermediary=" + extension.getMappingsProvider().MAPPINGS_MIXIN_EXPORT.getCanonicalPath());
task.getOptions().getCompilerArgs().add("-AoutRefMapFile=" + new File(task.getDestinationDir(), extension.getRefmapName()).getCanonicalPath());
task.getOptions().getCompilerArgs().add("-AdefaultObfuscationEnv=named:intermediary");
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
/**
* Permit to add a Maven repository to a target project
*