Klasse 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>
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 -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidaction(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.voidExclude messages matching theregex.abstract org.gradle.api.provider.Property<@NotNull Boolean> Return compress message pack property.abstract org.gradle.api.file.DirectoryPropertyParameter containing the destination directory where the packed message file is stored.abstract org.gradle.api.provider.Property<@NotNull Object> Property containing the strategy to use in case a duplicate message code or template name (with different message definition) is found.Return a list of regular expressions which will be matched against each message code.Return a list of regular expressions which will be matched against each message code.org.gradle.api.file.RegularFileReturns 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.ConfigurableFileCollectionReturns a collection of source files to scan for message and template annotations.abstract org.gradle.api.provider.Property<@NotNull Boolean> Property containing a boolean stating whether to validate referenced templates.voidInclude messages matching theregex.voidpack()Scans the configured source files for message and template annotations, validates referenced templates, executes registered actions and writes the packed message file.voidsourceSet(org.gradle.api.tasks.SourceSet sourceSet) Add all outputs for the givensourceSetto the collection of sources.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, usesServiceVon 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, setImpliesSubProjectsVon Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitVon Schnittstelle geerbte Methoden org.gradle.api.Task
doNotTrackState, notCompatibleWithConfigurationCache
-
Konstruktordetails
-
MessageFormatPackTask
public MessageFormatPackTask()Gradle task constructor.
-
-
Methodendetails
-
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
-
getIncludeRegexFilters
Return a list of regular expressions which will be matched against each message code. If it matches, the message will be included in the packed message file. If it doesn't match the message is skipped.If the list is empty, all messages are included, unless they're explicitly excluded.
- Gibt zurück:
- list of regular expressions for message inclusion, never
null - Siehe auch:
-
getExcludeRegexFilters
Return a list of regular expressions which will be matched against each message code. If it matches, the message will be excluded from the packed message file. If it doesn't match the message is included.- Gibt zurück:
- list of regular expressions for message exclusion, never
null - Siehe auch:
-
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:
-
getDuplicateMsgStrategy
Property containing the strategy to use in case a duplicate message code or template name (with different message definition) is found. The default strategy isIGNORE_AND_WARN.This property accepts various formats:
-
DuplicateMsgStrategyenum value (e.g.FAIL) -
Strategy string. The string is converted to uppercase, dashes are translated to underscores and the resulting
strategy name is matched against
DuplicateMsgStrategy(e.g.'override-and-warn'matchesOVERRIDE_AND_WARN)
A duplicate is either a message with an already known message code or a template with an already known template name and a different message definition. This means that if the same message or template is encountered twice, it is not considered a duplicate.
- Gibt zurück:
- duplicate message strategy property, never
null - Siehe auch:
-
-
getValidateReferencedTemplates
@Input public abstract org.gradle.api.provider.Property<@NotNull Boolean> getValidateReferencedTemplates()Property containing a boolean stating whether to validate referenced templates. The default value resolves totrue.If the property resolves to
truethe task will check whether all reference templates (including nested templates) are available and included in the packed message file.If the property resolves to
falseno checks are performed. This may lead to a situation where a message cannot be formatted if the referenced template is missing from the message support.- Gibt zurück:
- validate referenced templates property, never
null
-
getCompress
Return compress message pack property. The default for this property isfalse.- 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
-
include
Include messages matching theregex.- Parameter:
regex- regex matching message codes- Siehe auch:
-
exclude
Exclude messages matching theregex.- Parameter:
regex- regex matching message codes- Siehe auch:
-
sourceSet
public void sourceSet(org.gradle.api.tasks.SourceSet sourceSet) Add all outputs for the givensourceSetto the collection of sources.- Parameter:
sourceSet- source set to include in message/template scanning- Siehe auch:
-
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 prefixMSG-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, notnull- 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
-