Skip to content

Commit

Permalink
plugin-development: Correct a configuration cache problem in runServer
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Apr 11, 2021
1 parent 2087db4 commit 2e1eb6b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.gradle.api.file.FileCollection;
import org.gradle.api.plugins.JavaLibraryPlugin;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.JavaExec;
import org.gradle.api.tasks.SourceSet;
Expand All @@ -50,6 +51,7 @@
import org.gradle.jvm.tasks.Jar;
import org.gradle.process.CommandLineArgumentProvider;
import org.spongepowered.gradle.common.Constants;
import org.spongepowered.gradle.common.SpongePlatform;
import org.spongepowered.gradle.plugin.config.PluginConfiguration;
import org.spongepowered.gradle.plugin.task.WritePluginMetadataTask;

Expand Down Expand Up @@ -171,6 +173,7 @@ private TaskProvider<JavaExec> createRunTask(final NamedDomainObjectProvider<Con
*/
final Directory projectDir = this.project.getLayout().getProjectDirectory();
final Property<SpongePlatform> spongePlatform = sponge.platform();
final TaskProvider<JavaExec> runServer = this.project.getTasks().register("runServer", JavaExec.class, task -> {
task.setGroup(Constants.TASK_GROUP);
task.setDescription("Run a Sponge server to test this plugin");
Expand All @@ -194,7 +197,7 @@ public Iterable<String> asArguments() {
if (id instanceof ModuleComponentIdentifier) {
final ModuleComponentIdentifier moduleId = (ModuleComponentIdentifier) id;
if (moduleId.getGroup().equals(Constants.Dependencies.SPONGE_GROUP)
&& moduleId.getModule().equals(sponge.platform().get().artifactId())) {
&& moduleId.getModule().equals(spongePlatform.get().artifactId())) {
task.getLogger().info("Using file {} as Sponge agent", dep.getFile());
return Collections.singletonList("-javaagent:" + dep.getFile());
}
Expand Down

0 comments on commit 2e1eb6b

Please sign in to comment.