Skip to content

Commit

Permalink
plugin-development: Mark some metadata fields as optional for Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Mar 1, 2021
1 parent 4fd7d8d commit b583c11
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ private void configurePluginMetaGeneration(final SpongePluginExtension sponge) {
sponge.plugins().configureEach(plugin -> {
plugin.getDisplayName().convention(this.project.provider(this.project::getName));
plugin.getVersion().convention(this.project.provider(() -> String.valueOf(this.project.getVersion())));
plugin.getDescription().convention(this.project.provider(() -> this.project.getDescription()));
plugin.getDependencies().matching(dep -> dep.getName().equals(Constants.Dependencies.SPONGE_API))
.configureEach(dep -> dep.getVersion().convention(sponge.apiVersion()));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;

import javax.inject.Inject;

Expand All @@ -50,6 +51,7 @@ public String getName() {
}

@Input
@Optional
public Property<String> getDescription() {
return this.description;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import org.spongepowered.plugin.metadata.PluginDependency;

import javax.inject.Inject;
Expand Down Expand Up @@ -66,6 +67,7 @@ public void version(final String version) {
}

@Input
@Optional
public Property<PluginDependency.LoadOrder> getLoadOrder() {
return this.loadOrder;
}
Expand All @@ -75,6 +77,7 @@ public void loadOrder(final PluginDependency.LoadOrder loadOrder) {
}

@Input
@Optional
public Property<Boolean> getOptional() {
return this.optional;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;

import java.net.MalformedURLException;
import java.net.URL;
Expand All @@ -47,6 +48,7 @@ public PluginLinksConfiguration(final ObjectFactory factory) {
}

@Input
@Optional
public Property<URL> getHomepage() {
return this.homepage;
}
Expand All @@ -56,6 +58,7 @@ public void homepage(final String homepage) throws MalformedURLException {
}

@Input
@Optional
public Property<URL> getSource() {
return this.source;
}
Expand All @@ -65,6 +68,7 @@ public void source(final String source) throws MalformedURLException {
}

@Input
@Optional
public Property<URL> getIssues() {
return this.issues;
}
Expand Down

0 comments on commit b583c11

Please sign in to comment.