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

    Fields
    Modifier and Type
    Field
    Description
    The game specific API endpoint.
    The API token used to publish files on your behalf.
    boolean
    Determines 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
    Constructor
    Description
    This task should not be constructed manually.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method is called when a gradle defined implementation of this task has been invoked.
    void
    Disables automatic version detection for all artifacts published through the current task.
    abstract org.gradle.api.model.ObjectFactory
     
     
    static Long
    Parses a long value from an object.
    static String
    Gradle can be annoying and represent strings as non-string objects.
    upload(Object projectId, Object toUpload)
    Creates a new main level artifact that the plugin will attempt to publish during the publish() 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 the publish() 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, usesService

    Methods 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, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, getConvention, notCompatibleWithConfigurationCache
  • Field Details

    • apiEndpoint

      public Object 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

      public Object 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 debugMode
      Determines if publishing should actually happen. Set this to true to 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

      public List<UploadArtifact> getUploadArtifacts()
    • getObjectFactory

      @Inject public abstract org.gradle.api.model.ObjectFactory getObjectFactory()
    • upload

      public UploadArtifact upload(Object projectId, Object toUpload)
      Creates a new main level artifact that the plugin will attempt to publish during the publish() 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 by FileCollection.
      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 the publish() 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 by FileCollection.
      action - The Action to 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

      public static Long parseLong(Object obj)
      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

      public static String parseString(Object obj)
      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.