Klasse MessageFormatPackTask

Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
de.sayayi.plugin.gradle.message.MessageFormatPackTask
Alle implementierten Schnittstellen:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

@CacheableTask public abstract class MessageFormatPackTask extends org.gradle.api.DefaultTask
Gradle task for scanning messages and templates in classes and packing them into a single file which can be imported into a MessageSupport.ConfigurableMessageSupport.
Seit:
0.8.0
Siehe auch:
  • Verschachtelte Klassen - Übersicht

    Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen org.gradle.api.Named

    org.gradle.api.Named.Namer
  • Feldübersicht

    Von Schnittstelle geerbte Felder org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    MessageFormatPackTask(@NotNull org.gradle.api.model.ObjectFactory objectFactory)
    Gradle task constructor.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    void
    action(org.gradle.api.Action<@NotNull de.sayayi.lib.message.MessageSupport.MessageAccessor> action)
    Provide the task with an action that allows for querying the scanned messages and templates.
    abstract org.gradle.api.provider.Property<@NotNull Boolean>
    Return compress message pack property.
    abstract org.gradle.api.file.DirectoryProperty
    Parameter containing the destination directory where the packed message file is stored.
    Returns the nested messages extension for configuring message inclusion/exclusion filters and duplicate message handling strategy.
    org.gradle.api.file.RegularFile
    Returns the target message pack file location.
    abstract org.gradle.api.provider.Property<@NotNull String>
    Parameter containing the packed message file name.
    abstract org.gradle.api.file.ConfigurableFileCollection
    Returns a collection of source files to scan for message and template annotations.
    Returns the nested templates extension for configuring template validation and filtering.
    void
    messages(@NotNull org.gradle.api.Action<? super MessageFormatMessagesExtension> action)
    Configures the nested messages block.
    void
    Scans the configured source files for message and template annotations, validates referenced templates, executes registered actions and writes the packed message file.
    void
    sourceSet(org.gradle.api.tasks.SourceSet sourceSet)
    Add all outputs for the given sourceSet to the collection of sources.
    void
    templates(@NotNull org.gradle.api.Action<? super MessageFormatTemplatesExtension> action)
    Configures the nested templates block.

    Von Klasse geerbte Methoden 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

    Von Klasse geerbte Methoden org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjects

    Von Klasse geerbte Methoden java.lang.Object

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

    Von Schnittstelle geerbte Methoden org.gradle.api.Task

    doNotTrackState, notCompatibleWithConfigurationCache
  • Konstruktordetails

    • MessageFormatPackTask

      @Inject public MessageFormatPackTask(@NotNull @NotNull org.gradle.api.model.ObjectFactory objectFactory)
      Gradle task constructor.
      Parameter:
      objectFactory - Gradle object factory for creating managed instances
  • Methodendetails

    • getMessages

      public MessageFormatMessagesExtension getMessages()
      Returns the nested messages extension for configuring message inclusion/exclusion filters and duplicate message handling strategy.
      Gibt zurück:
      nested messages extension, never null
      Seit:
      0.24.0
    • messages

      public void messages(@NotNull @NotNull org.gradle.api.Action<? super MessageFormatMessagesExtension> action)
      Configures the nested messages block.

      Example usage:

         messageFormatPack {
           messages {
             include 'xy'
             exclude 'r.*'
             duplicateStrategy = 'fail'
           }
         }
       
      Parameter:
      action - configuration action for the messages extension, not null
      Seit:
      0.24.0
    • getTemplates

      public MessageFormatTemplatesExtension getTemplates()
      Returns the nested templates extension for configuring template validation and filtering.
      Gibt zurück:
      nested templates extension, never null
      Seit:
      0.24.0
    • templates

      public void templates(@NotNull @NotNull org.gradle.api.Action<? super MessageFormatTemplatesExtension> action)
      Configures the nested templates block.

      Example usage:

         messageFormatPack {
           templates {
             validateReferences = true
             ignore 'tpl-.*'
           }
         }
       
      Parameter:
      action - configuration action for the templates extension, not null
      Seit:
      0.24.0
    • getDestinationDir

      @Internal("tracked via packFile") public abstract org.gradle.api.file.DirectoryProperty getDestinationDir()
      Parameter containing the destination directory where the packed message file is stored.
      Gibt zurück:
      destination directory parameter, never null
    • getPackFilename

      @Internal("tracked via packFile") public abstract org.gradle.api.provider.Property<@NotNull String> getPackFilename()
      Parameter containing the packed message file name.
      Gibt zurück:
      packed message file name, never null
    • getSources

      @InputFiles @IgnoreEmptyDirectories @PathSensitive(RELATIVE) public abstract org.gradle.api.file.ConfigurableFileCollection getSources()
      Returns a collection of source files to scan for message and template annotations.

      There's no restriction on what kind of files are in the collection. This task will only use and scan class (*.class) files.

      Gibt zurück:
      collection of source files to scan for messages and templates, never null
      Siehe auch:
    • sourceSet

      public void sourceSet(org.gradle.api.tasks.SourceSet sourceSet)
      Add all outputs for the given sourceSet to the collection of sources.
      Parameter:
      sourceSet - source set to include in message/template scanning
      Siehe auch:
    • getCompress

      @Input public abstract org.gradle.api.provider.Property<@NotNull Boolean> getCompress()
      Return compress message pack property. The default for this property is false.
      Gibt zurück:
      compress property, never null
    • getPackFile

      @OutputFile public org.gradle.api.file.RegularFile getPackFile()
      Returns the target message pack file location.
      Gibt zurück:
      message pack file, never null
    • action

      public void action(org.gradle.api.Action<@NotNull de.sayayi.lib.message.MessageSupport.MessageAccessor> action)
      Provide the task with an action that allows for querying the scanned messages and templates. This action is invoked just before the messages and templates are written to the packed message file.

      Here's an example of how to use this action.
      Let's say all message codes start with a prefix MSG- followed by a 4-digit number (e.g. MSG-0318). The action could then be used to output the next 10 available message codes:

         action {
             def codes = getMessageCodes()
             def unusedCodes = new ArrayList<String>()
      
             for(int n = 1; unusedCodes.size() < 10; n++)
             {
               def code = String.format("MSG-%04d", n)
      
               if (!codes.contains(code))
                 unusedCodes.add(code)
             }
      
             println 'Available message codes:'
             println String.join(" ", unusedCodes)
         }
       
      If multiple actions are provided, they are executed in the order of definition.
      Parameter:
      action - custom action, not null
      Seit:
      0.8.0
    • pack

      public void pack()
      Scans the configured source files for message and template annotations, validates referenced templates, executes registered actions and writes the packed message file.
      Löst aus:
      org.gradle.api.GradleException - if scanning, validation or writing fails