Skip to content

Commit

Permalink
Compatible for Gradle 4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamesuta committed Mar 1, 2019
1 parent 739f174 commit 3be8636
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ uploadArchives {
mavenDeployer {
configuration = configurations.deployerJars

repository(url: "https://api.bintray.com" + '/maven/' + "team-fruit" + '/' + "mods" + '/' + "ForgeGradle" + "?publish=1") {
repository(url: "https://api.bintray.com" + '/maven/' + "team-fruit" + '/' + "mods" + '/' + "ForgeGradle" + ";publish=1") {
authentication(userName: project.getProperty('forgeMavenUser'), password: project.getProperty('forgeMavenPass'))
}

Expand Down
72 changes: 51 additions & 21 deletions src/main/java/net/minecraftforge/gradle/user/UserBasePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ public Object call()
{
TaskExecutionGraph graph = project.getGradle().getTaskGraph();
String path = project.getPath();
graph.getAllTasks().clear();

//graph.getAllTasks().clear();

if (graph.hasTask(path + "setupDecompWorkspace"))
{
Expand Down Expand Up @@ -354,7 +354,7 @@ protected void configureCompilation()

project.getConfigurations().getByName("apiCompile").extendsFrom(project.getConfigurations().getByName("compile"));
project.getConfigurations().getByName("testCompile").extendsFrom(project.getConfigurations().getByName("apiCompile"));

// set compile not to take from libs
JavaCompile compileTask = ((JavaCompile)project.getTasks().getByName(main.getCompileJavaTaskName()));
List<String> args = compileTask.getOptions().getCompilerArgs();
Expand Down Expand Up @@ -435,7 +435,7 @@ public void execute(Task task)
try
{
String module = task.getProject().getProjectDir().getCanonicalPath();

File root = task.getProject().getProjectDir().getCanonicalFile();
File file = null;
while (file == null && !root.equals(task.getProject().getRootProject().getProjectDir().getCanonicalFile().getParentFile()))
Expand All @@ -454,10 +454,10 @@ public void execute(Task task)
}
}
}

root = root.getParentFile();
}

if (file == null || !file.exists())
throw new RuntimeException("Intellij workspace file could not be found! are you sure you imported the project into intellij?");

Expand Down Expand Up @@ -693,9 +693,9 @@ private void tasks()
task.addReplacement("@@BOUNCERSERVER@@", delayedString("{RUN_BOUNCE_SERVER}"));
task.setStartOut(delayedFile(getStartDir()));
task.compileResources(CONFIG_DEPS);

// see delayed task config for some more config

task.dependsOn("extractUserDev", "getAssets", "getAssetsIndex", "extractNatives");
}

Expand Down Expand Up @@ -806,13 +806,18 @@ public Boolean call()
@SuppressWarnings({ "unchecked", "rawtypes" })
private void createExecTasks()
{
JavaExec exec = makeTask("runClient", JavaExec.class);
{
final JavaExec exec = makeTask("runClient", JavaExec.class);
exec.doFirst(new MakeDirExist(delayedFile("{RUN_DIR}")));
exec.setMain(GRADLE_START_CLIENT);
//exec.jvmArgs("-Xincgc", "-Xmx1024M", "-Xms1024M", "-Dfml.ignoreInvalidMinecraftCertificates=true");
exec.args(getClientRunArgs());
exec.workingDir(delayedFile("{RUN_DIR}"));
project.afterEvaluate(new Action<Project>() {
@Override
public void execute(Project arg0) {
exec.workingDir(delayedFile("{RUN_DIR}"));
}
});
exec.setStandardOutput(System.out);
exec.setErrorOutput(System.err);

Expand All @@ -822,12 +827,17 @@ private void createExecTasks()
exec.dependsOn("makeStart");
}

exec = makeTask("runServer", JavaExec.class);
{
final JavaExec exec = makeTask("runServer", JavaExec.class);
exec.doFirst(new MakeDirExist(delayedFile("{RUN_DIR}")));
exec.setMain(GRADLE_START_SERVER);
exec.jvmArgs("-Xincgc", "-Dfml.ignoreInvalidMinecraftCertificates=true");
exec.workingDir(delayedFile("{RUN_DIR}"));
project.afterEvaluate(new Action<Project>() {
@Override
public void execute(Project arg0) {
exec.workingDir(delayedFile("{RUN_DIR}"));
}
});
exec.args(getServerRunArgs());
exec.setStandardOutput(System.out);
exec.setStandardInput(System.in);
Expand All @@ -839,9 +849,14 @@ private void createExecTasks()
exec.dependsOn("makeStart");
}

exec = makeTask("debugClient", JavaExec.class);
{
exec.doFirst(new MakeDirExist(delayedFile("{RUN_DIR}")));
final JavaExec exec = makeTask("debugClient", JavaExec.class);
project.afterEvaluate(new Action<Project>() {
@Override
public void execute(Project arg0) {
exec.doFirst(new MakeDirExist(delayedFile("{RUN_DIR}")));
}
});
exec.doFirst( new Action() {
@Override public void execute(Object o)
{
Expand All @@ -858,7 +873,12 @@ private void createExecTasks()
exec.setMain(GRADLE_START_CLIENT);
exec.jvmArgs("-Xincgc", "-Xmx1024M", "-Xms1024M", "-Dfml.ignoreInvalidMinecraftCertificates=true");
exec.args(getClientRunArgs());
exec.workingDir(delayedFile("{RUN_DIR}"));
project.afterEvaluate(new Action<Project>() {
@Override
public void execute(Project arg0) {
exec.workingDir(delayedFile("{RUN_DIR}"));
}
});
exec.setStandardOutput(System.out);
exec.setErrorOutput(System.err);
exec.setDebug(true);
Expand All @@ -869,9 +889,14 @@ private void createExecTasks()
exec.dependsOn("makeStart");
}

exec = makeTask("debugServer", JavaExec.class);
{
exec.doFirst(new MakeDirExist(delayedFile("{RUN_DIR}")));
final JavaExec exec = makeTask("debugServer", JavaExec.class);
project.afterEvaluate(new Action<Project>() {
@Override
public void execute(Project arg0) {
exec.doFirst(new MakeDirExist(delayedFile("{RUN_DIR}")));
}
});
exec.doFirst( new Action() {
@Override public void execute(Object o)
{
Expand All @@ -887,7 +912,12 @@ private void createExecTasks()
});
exec.setMain(GRADLE_START_SERVER);
exec.jvmArgs("-Xincgc", "-Dfml.ignoreInvalidMinecraftCertificates=true");
exec.workingDir(delayedFile("{RUN_DIR}"));
project.afterEvaluate(new Action<Project>() {
@Override
public void execute(Project arg0) {
exec.workingDir(delayedFile("{RUN_DIR}"));
}
});
exec.args(getServerRunArgs());
exec.setStandardOutput(System.out);
exec.setStandardInput(System.in);
Expand Down Expand Up @@ -1064,11 +1094,11 @@ public void execute(ArtifactSpec arg0)
repackageTask.setArchiveName(out.getName());
repackageTask.setDestinationDir(out.getParentFile());
}

{
// because different versions of authlib
CreateStartTask task = (CreateStartTask) project.getTasks().getByName("makeStart");

if (getMcVersion(getExtension()).startsWith("1.7")) // MC 1.7.X
{
if (getMcVersion(getExtension()).endsWith("10")) // MC 1.7.10
Expand Down Expand Up @@ -1156,7 +1186,7 @@ protected void configurePostDecomp(boolean decomp, boolean remove)
}

setMinecraftDeps(decomp, remove);

if (decomp && remove)
{
(project.getTasks().getByName("deobfBinJar")).onlyIf(Constants.CALL_FALSE);
Expand Down

0 comments on commit 3be8636

Please sign in to comment.