Skip to content

Commit

Permalink
fixed bug(FibreFoX#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuuzed committed Jun 24, 2021
1 parent 178c9f6 commit 3efc0b3
Showing 1 changed file with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;

import org.gradle.api.*;

/**
*
Expand All @@ -51,11 +50,11 @@ public void apply(Project project) {
// gradle is lame, so replace existing tasks with MY NAMES ! *battle-cry*

// tasks will be available for the buldscript prior full evaluation
JfxJarTask jarTask = project.getTasks().replace(JfxJarTask.JFX_TASK_NAME, JfxJarTask.class);
JfxNativeTask nativeTask = project.getTasks().replace(JfxNativeTask.JFX_TASK_NAME, JfxNativeTask.class);
JfxGenerateKeystoreTask generateKeystoreTask = project.getTasks().replace(JfxGenerateKeystoreTask.JFX_TASK_NAME, JfxGenerateKeystoreTask.class);
JfxRunTask runTask = project.getTasks().replace(JfxRunTask.JFX_TASK_NAME, JfxRunTask.class);
JfxListBundlersTask jfxListBundlersTask = project.getTasks().replace(JfxListBundlersTask.JFX_TASK_NAME, JfxListBundlersTask.class);
JfxJarTask jarTask = setTask(project, JfxJarTask.JFX_TASK_NAME, JfxJarTask.class);
JfxNativeTask nativeTask = setTask(project, JfxNativeTask.JFX_TASK_NAME, JfxNativeTask.class);
JfxGenerateKeystoreTask generateKeystoreTask = setTask(project, JfxGenerateKeystoreTask.JFX_TASK_NAME, JfxGenerateKeystoreTask.class);
JfxRunTask runTask = setTask(project, JfxRunTask.JFX_TASK_NAME, JfxRunTask.class);
JfxListBundlersTask jfxListBundlersTask = setTask(project, JfxListBundlersTask.JFX_TASK_NAME, JfxListBundlersTask.class);

String taskGroupName = "JavaFX";

Expand Down Expand Up @@ -96,6 +95,17 @@ public void apply(Project project) {
});
}

private <T extends Task> T setTask(Project project, String taskName, Class<T> taskType) {
T task;
try {
project.getTasks().getByName(taskName);
task = project.getTasks().replace(taskName, taskType);
} catch (UnknownTaskException e) {
task = project.getTasks().create(taskName, taskType);
}
return task;
}

private void addJavaFXAntJARToGradleBuildpath(Project project) {
String jfxAntJarPath = "/../lib/" + ANT_JAVAFX_JAR_FILENAME;

Expand Down

0 comments on commit 3efc0b3

Please sign in to comment.