Package io.github.smootheez
Class Publisher
java.lang.Object
io.github.smootheez.Publisher
- Direct Known Subclasses:
CurseforgePublisher,ModrinthPublisher
Base abstraction for all publishing implementations within the
Mc-Mod-Publisher Gradle plugin. Concrete subclasses provide the logic
necessary to publish a project to a specific platform such as
CurseForge, Modrinth, or other distribution services.
This class centralizes shared components needed by all publishers:
Project— the Gradle project instanceMcModPublisherExtension— user-defined configurationOkHttpClient— HTTP client for performing network requestsGson— serializer for JSON payloads
Implementations must define the publish() method, which
encapsulates the complete publishing workflow, including:
- reading configuration
- preparing request payloads
- executing HTTP calls
- handling responses and logging
This class is designed to be extended and used by Gradle tasks or other orchestration components inside the plugin.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final okhttp3.OkHttpClientHTTP client used to send HTTP requests to external publishing platforms.protected final McModPublisherExtensionGlobal extension containing configuration values supplied by users via Gradle DSL.protected static final com.google.gson.GsonShared Gson instance for serializing and deserializing JSON payloads.protected final org.gradle.api.ProjectThe current Gradle project, used for logging and access to build information. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidpublish()Executes the publishing workflow for a specific platform.
-
Field Details
-
project
protected final org.gradle.api.Project projectThe current Gradle project, used for logging and access to build information. -
extension
Global extension containing configuration values supplied by users via Gradle DSL. -
client
protected final okhttp3.OkHttpClient clientHTTP client used to send HTTP requests to external publishing platforms. -
GSON
protected static final com.google.gson.Gson GSONShared Gson instance for serializing and deserializing JSON payloads.
-
-
Constructor Details
-
Publisher
public Publisher()
-
-
Method Details
-
publish
public abstract void publish()Executes the publishing workflow for a specific platform.Implementations must provide the complete logic required to:
- validate configuration
- prepare metadata and artifacts
- send requests to the remote API
- handle failures and log results
This method is expected to be invoked from a Gradle task or another orchestrator responsible for running publishing actions.
-