Package net.darkhax.curseforgegradle
Class TaskPublishCurseForge
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
net.darkhax.curseforgegradle.TaskPublishCurseForge
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.util.Configurable<org.gradle.api.Task>
public abstract class TaskPublishCurseForge
extends org.gradle.api.DefaultTask
A Gradle task that can publish multiple files to CurseForge. A project can define any number of these tasks, and any
given task can be responsible for publishing any number of files to any number of projects.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Task
org.gradle.api.Task.Namer -
Field Summary
FieldsModifier and TypeFieldDescriptionThe game specific API endpoint.The API token used to publish files on your behalf.booleanDetermines if publishing should actually happen.Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply()This method is called when a gradle defined implementation of this task has been invoked.voidDisables automatic version detection for all artifacts published through the current task.abstract org.gradle.api.model.ObjectFactorystatic LongParses a long value from an object.static StringparseString(Object obj) Gradle can be annoying and represent strings as non-string objects.Creates a new main level artifact that the plugin will attempt to publish during thepublish()step.upload(Object projectId, Object toUpload, org.gradle.api.Action<UploadArtifact> action) Creates a new main level artifact that the plugin will attempt to publish during thepublish()step.Methods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, getConvention, notCompatibleWithConfigurationCache
-
Field Details
-
apiEndpoint
The game specific API endpoint. This is used to retrieve lists of valid versions for a game and to help files get uploaded to the right game. -
apiToken
The API token used to publish files on your behalf. This token must have the correct project permissions for the files to be published. These tokens can be generated here: https://legacy.curseforge.com/account/api-tokens -
debugMode
public boolean debugModeDetermines if publishing should actually happen. Set this totrueto log the json request instead of sending it to curse's servers.
-
-
Constructor Details
-
TaskPublishCurseForge
public TaskPublishCurseForge()This task should not be constructed manually. It will be constructed dynamically by Gradle when a user defines the task. Code inside the constructor will be executed before the user configuration.
-
-
Method Details
-
getUploadArtifacts
-
getObjectFactory
@Inject public abstract org.gradle.api.model.ObjectFactory getObjectFactory() -
upload
Creates a new main level artifact that the plugin will attempt to publish during thepublish()step. This method requires the minimum amount of information to define an artifact. Further configuration including defining additional sub files can be done by modifying the returned artifact instance.- Parameters:
projectId- The CurseForge project ID to publish this artifact to.toUpload- The artifact to upload when this artifact is published. This can accept files, archive tasks, and several other types of files. The resolution of this is handled byFileCollection.- Returns:
- An object that represents the artifact being published. This can be used to perform additional configuration such as defining a changelog.
-
upload
public UploadArtifact upload(Object projectId, Object toUpload, org.gradle.api.Action<UploadArtifact> action) Creates a new main level artifact that the plugin will attempt to publish during thepublish()step. This method requires the minimum amount of information to define an artifact. Further configuration including defining additional sub files can be done by modifying the returned artifact instance.- Parameters:
projectId- The CurseForge project ID to publish this artifact to.toUpload- The artifact to upload when this artifact is published. This can accept files, archive tasks, and several other types of files. The resolution of this is handled byFileCollection.action- TheActionto apply before returning the artifact.- Returns:
- An object that represents the artifact being published. This can be used to perform additional configuration such as defining a changelog.
-
disableVersionDetection
public void disableVersionDetection()Disables automatic version detection for all artifacts published through the current task. -
apply
public void apply()This method is called when a gradle defined implementation of this task has been invoked. The project and the task should already be configured at this point. -
parseLong
Parses a long value from an object. This currently supports numbers and strings.- Parameters:
obj- The value to resolve.- Returns:
- The resolved Long value.
-
parseString
Gradle can be annoying and represent strings as non-string objects. This allows a variety of data types to be accepted.- Parameters:
obj- The value to resolve.- Returns:
- The resolved value.
-