Only generate the run configs on the root project

dev/0.11
modmuss50 2019-03-30 20:08:25 +00:00
parent a9a160b0bf
commit c43e771ef5
2 changed files with 12 additions and 1 deletions

View File

@ -65,7 +65,9 @@ public class AbstractPlugin implements Plugin<Project> {
public void apply(Project target) { public void apply(Project target) {
this.project = target; this.project = target;
if(isRootProject(target)){
project.getLogger().lifecycle("Fabric Loom: " + AbstractPlugin.class.getPackage().getImplementationVersion()); project.getLogger().lifecycle("Fabric Loom: " + AbstractPlugin.class.getPackage().getImplementationVersion());
}
// Apply default plugins // Apply default plugins
project.apply(ImmutableMap.of("plugin", "java")); project.apply(ImmutableMap.of("plugin", "java"));
@ -281,4 +283,8 @@ public class AbstractPlugin implements Plugin<Project> {
} }
}); });
} }
public static boolean isRootProject(Project project){
return project.getRootProject() == project;
}
} }

View File

@ -24,6 +24,7 @@
package net.fabricmc.loom.task; package net.fabricmc.loom.task;
import net.fabricmc.loom.AbstractPlugin;
import net.fabricmc.loom.LoomGradleExtension; import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.util.RunConfig; import net.fabricmc.loom.util.RunConfig;
import org.gradle.api.Project; import org.gradle.api.Project;
@ -50,6 +51,10 @@ public class GenIdeaProjectTask extends DefaultLoomTask {
@TaskAction @TaskAction
public void genIdeaRuns() throws IOException, ParserConfigurationException, SAXException, TransformerException { public void genIdeaRuns() throws IOException, ParserConfigurationException, SAXException, TransformerException {
Project project = this.getProject(); Project project = this.getProject();
//Only generate the idea runs on the root project
if(!AbstractPlugin.isRootProject(project)){
return;
}
LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class); LoomGradleExtension extension = project.getExtensions().getByType(LoomGradleExtension.class);
project.getLogger().lifecycle(":Building idea workspace"); project.getLogger().lifecycle(":Building idea workspace");