|
1 | 1 | package net.minecraftforge.gradle.user; |
2 | 2 |
|
3 | | -import static net.minecraftforge.gradle.user.UserConstants.*; |
| 3 | +import static net.minecraftforge.gradle.user.UserConstants.ASTYLE_CFG; |
| 4 | +import static net.minecraftforge.gradle.user.UserConstants.BINARIES_JAR; |
| 5 | +import static net.minecraftforge.gradle.user.UserConstants.BINPATCHES; |
| 6 | +import static net.minecraftforge.gradle.user.UserConstants.CONFIG; |
| 7 | +import static net.minecraftforge.gradle.user.UserConstants.CONFIG_API_JAVADOCS; |
| 8 | +import static net.minecraftforge.gradle.user.UserConstants.CONFIG_API_SRC; |
| 9 | +import static net.minecraftforge.gradle.user.UserConstants.CONFIG_NATIVES; |
| 10 | +import static net.minecraftforge.gradle.user.UserConstants.CONFIG_USERDEV; |
| 11 | +import static net.minecraftforge.gradle.user.UserConstants.DEOBF_MCP_SRG; |
| 12 | +import static net.minecraftforge.gradle.user.UserConstants.ECLIPSE_LOCATION; |
| 13 | +import static net.minecraftforge.gradle.user.UserConstants.FIELD_CSV; |
| 14 | +import static net.minecraftforge.gradle.user.UserConstants.JSON; |
| 15 | +import static net.minecraftforge.gradle.user.UserConstants.MCP_PATCH; |
| 16 | +import static net.minecraftforge.gradle.user.UserConstants.MERGE_CFG; |
| 17 | +import static net.minecraftforge.gradle.user.UserConstants.METHOD_CSV; |
| 18 | +import static net.minecraftforge.gradle.user.UserConstants.NATIVES_DIR; |
| 19 | +import static net.minecraftforge.gradle.user.UserConstants.PACKAGED_EXC; |
| 20 | +import static net.minecraftforge.gradle.user.UserConstants.PACKAGED_SRG; |
| 21 | +import static net.minecraftforge.gradle.user.UserConstants.PACK_DIR; |
| 22 | +import static net.minecraftforge.gradle.user.UserConstants.REOBF_NOTCH_SRG; |
| 23 | +import static net.minecraftforge.gradle.user.UserConstants.REOBF_SRG; |
| 24 | +import static net.minecraftforge.gradle.user.UserConstants.RES_DIR; |
| 25 | +import static net.minecraftforge.gradle.user.UserConstants.SOURCES_DIR; |
4 | 26 | import groovy.lang.Closure; |
5 | 27 | import groovy.util.Node; |
6 | 28 | import groovy.util.XmlParser; |
|
45 | 67 | import org.gradle.api.artifacts.Configuration; |
46 | 68 | import org.gradle.api.artifacts.Configuration.State; |
47 | 69 | import org.gradle.api.artifacts.dsl.DependencyHandler; |
| 70 | +import org.gradle.api.execution.TaskExecutionGraph; |
48 | 71 | import org.gradle.api.internal.plugins.DslObject; |
49 | 72 | import org.gradle.api.logging.Logger; |
50 | 73 | import org.gradle.api.plugins.JavaPluginConvention; |
@@ -78,6 +101,7 @@ public abstract class UserBasePlugin extends BasePlugin<UserExtension> |
78 | 101 | { |
79 | 102 | private boolean hasApplied = false; |
80 | 103 |
|
| 104 | + @SuppressWarnings("serial") |
81 | 105 | @Override |
82 | 106 | public void applyPlugin() |
83 | 107 | { |
@@ -110,6 +134,37 @@ public void applyPlugin() |
110 | 134 | project.getTasks().getByName("reobf").dependsOn("genSrgs"); |
111 | 135 | project.getTasks().getByName("compileJava").dependsOn("deobfBinJar"); |
112 | 136 | project.getTasks().getByName("compileApiJava").dependsOn("deobfBinJar"); |
| 137 | + |
| 138 | + // stop people screwing stuff up. |
| 139 | + project.getGradle().getTaskGraph().whenReady(new Closure<Object>(this, null) { |
| 140 | + @Override |
| 141 | + public Object call() |
| 142 | + { |
| 143 | + TaskExecutionGraph graph = project.getGradle().getTaskGraph(); |
| 144 | + String path = project.getPath(); |
| 145 | + |
| 146 | + if (graph.hasTask(path + "setupDecompWorkspace")) |
| 147 | + { |
| 148 | + if (!System.getProperty("java.version").startsWith("1.7")) |
| 149 | + { |
| 150 | + throw new RuntimeException("The setupDecompWorkspace will only work with Java 7! This is fixed in ForgeGradle 1.2"); |
| 151 | + } |
| 152 | + } |
| 153 | + return null; |
| 154 | + } |
| 155 | + |
| 156 | + @Override |
| 157 | + public Object call(Object obj) |
| 158 | + { |
| 159 | + return call(); |
| 160 | + } |
| 161 | + |
| 162 | + @Override |
| 163 | + public Object call(Object... obj) |
| 164 | + { |
| 165 | + return call(); |
| 166 | + } |
| 167 | + }); |
113 | 168 | } |
114 | 169 |
|
115 | 170 | protected Class<UserExtension> getExtensionClass() |
|
0 commit comments