Package com.diffplug.gradle.spotless
Class RomeStepConfig<Self extends RomeStepConfig<Self>>
- java.lang.Object
-
- com.diffplug.gradle.spotless.RomeStepConfig<Self>
-
- Direct Known Subclasses:
FormatExtension.RomeGeneric,JavascriptExtension.RomeJs,JsonExtension.RomeJson,TypescriptExtension.RomeTs
public abstract class RomeStepConfig<Self extends RomeStepConfig<Self>> extends java.lang.Object
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRomeStepConfig(Project project, java.util.function.Consumer<FormatterStep> replaceStep, java.lang.String version)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description SelfconfigPath(java.lang.Object configPath)Optional path to the directory with configuration file for Rome.protected FormatterStepcreateStep()Creates a new formatter step that formats code by calling the Rome executable, using the current configuration.SelfdownloadDir(java.lang.Object downloadDir)Optional directory where the downloaded Rome executable is placed.protected abstract java.lang.StringgetLanguage()Gets the language (syntax) of the input files to format.protected abstract SelfgetThis()SelfpathToExe(java.lang.Object pathToExe)Optional path to the Rome executable.protected voidreplaceStep()Creates a new Rome step and replaces the existing Rome step in the list of format steps.
-
-
-
Constructor Detail
-
RomeStepConfig
protected RomeStepConfig(Project project, java.util.function.Consumer<FormatterStep> replaceStep, java.lang.String version)
-
-
Method Detail
-
configPath
public Self configPath(java.lang.Object configPath)
Optional path to the directory with configuration file for Rome. The file must be namedrome.json. When none is given, the default configuration is used. If this is a relative path, it is resolved against the project's base directory.- Returns:
- This step for further configuration.
-
downloadDir
public Self downloadDir(java.lang.Object downloadDir)
Optional directory where the downloaded Rome executable is placed. If this is a relative path, it is resolved against the project's base directory. Defaults to~/.m2/repository/com/diffplug/spotless/spotless-data/rome.- Returns:
- This step for further configuration.
-
pathToExe
public Self pathToExe(java.lang.Object pathToExe)
Optional path to the Rome executable. Overwrites the configured version. No attempt is made to download the Rome executable from the network.When an absolute path is given, that path is used as-is. When a relative path is given, it is resolved against the project's base directory. When only a file name (i.e. without any slashes or back slash path separators such as
rome) is given, this is interpreted as the name of a command with executable that is in yourpathenvironment variable. Use./executable-nameif you want to use an executable in the project's base directory.- Returns:
- This step for further configuration.
-
createStep
protected FormatterStep createStep()
Creates a new formatter step that formats code by calling the Rome executable, using the current configuration.- Returns:
- A new formatter step for the Rome formatter.
-
getLanguage
protected abstract java.lang.String getLanguage()
Gets the language (syntax) of the input files to format. Whennullor the empty string, the language is detected automatically from the file name. Currently the following languages are supported by Rome:- js (JavaScript)
- jsx (JavaScript + JSX)
- js? (JavaScript or JavaScript + JSX, depending on the file extension)
- ts (TypeScript)
- tsx (TypeScript + JSX)
- ts? (TypeScript or TypeScript + JSX, depending on the file extension)
- json (JSON)
- Returns:
- The language of the input files.
-
getThis
protected abstract Self getThis()
- Returns:
- This Rome config instance.
-
replaceStep
protected void replaceStep()
Creates a new Rome step and replaces the existing Rome step in the list of format steps.
-
-