Package com.diffplug.gradle.spotless
Class SpotlessExtension
- java.lang.Object
-
- com.diffplug.gradle.spotless.SpotlessExtension
-
- Direct Known Subclasses:
SpotlessExtensionImpl
,SpotlessExtensionPredeclare
public abstract class SpotlessExtension extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
APPLY_DESCRIPTION
protected static java.lang.String
CHECK_DESCRIPTION
protected static java.lang.String
TASK_GROUP
-
Constructor Summary
Constructors Modifier Constructor Description protected
SpotlessExtension(Project project)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
antlr4(Action<Antlr4Extension> closure)
Configures the special antlr4-specific extension for antlr4 files.void
cpp(Action<CppExtension> closure)
Configures the special C/C++-specific extension.protected abstract void
createFormatTasks(java.lang.String name, FormatExtension formatExtension)
void
encoding(java.lang.String charset)
Sets encoding to use (defaults to UTF_8).void
encoding(java.nio.charset.Charset charset)
Sets encoding to use (defaults to UTF_8).<T extends FormatExtension>
voidformat(java.lang.String name, java.lang.Class<T> clazz, Action<T> configure)
void
format(java.lang.String name, Action<FormatExtension> closure)
Configures a custom extension.void
freshmark(Action<FreshMarkExtension> closure)
Configures the special freshmark-specific extension.java.nio.charset.Charset
getEncoding()
Returns the encoding to use.LineEnding
getLineEndings()
java.lang.String
getRatchetFrom()
void
gherkin(Action<GherkinExtension> closure)
Configures the special Gherkin-specific extension.void
groovy(Action<GroovyExtension> closure)
Configures the special groovy-specific extension.void
groovyGradle(Action<GroovyGradleExtension> closure)
Configures the special groovy-specific extension for Gradle files.boolean
isEnforceCheck()
Returnstrue
if Gradle'scheck
task should runspotlessCheck
;false
otherwise.void
java(Action<JavaExtension> closure)
Configures the special java-specific extension.void
javascript(Action<JavascriptExtension> closure)
Configures the special javascript-specific extension for javascript files.void
json(Action<JsonExtension> closure)
Configures the special JSON-specific extension.void
kotlin(Action<KotlinExtension> closure)
Configures the special kotlin-specific extension.void
kotlinGradle(Action<KotlinGradleExtension> closure)
Configures the special Gradle Kotlin DSL specific extension.protected <T extends FormatExtension>
TmaybeCreate(java.lang.String name, java.lang.Class<T> clazz)
protected void
predeclare(com.diffplug.gradle.spotless.GradleProvisioner.Policy policy)
void
predeclareDeps()
void
predeclareDepsFromBuildscript()
void
python(Action<PythonExtension> closure)
Configures the special python-specific extension for python files.void
ratchetFrom(java.lang.String ratchetFrom)
void
scala(Action<ScalaExtension> closure)
Configures the special scala-specific extension.void
setEncoding(java.lang.String name)
Sets encoding to use (defaults to UTF_8).void
setEncoding(java.nio.charset.Charset charset)
Sets encoding to use (defaults to UTF_8).void
setEnforceCheck(boolean enforceCheck)
Configures Gradle'scheck
task to runspotlessCheck
iftrue
, but to not do so iffalse
.void
setLineEndings(LineEnding lineEndings)
void
setRatchetFrom(java.lang.String ratchetFrom)
Limits the target to only the files which have changed since the given git reference, which is resolved according to thisvoid
sql(Action<SqlExtension> closure)
Configures the special sql-specific extension for SQL files.void
typescript(Action<TypescriptExtension> closure)
Configures the special typescript-specific extension for typescript files.void
yaml(Action<YamlExtension> closure)
Configures the special YAML-specific extension.
-
-
-
Field Detail
-
TASK_GROUP
protected static final java.lang.String TASK_GROUP
- See Also:
- Constant Field Values
-
CHECK_DESCRIPTION
protected static final java.lang.String CHECK_DESCRIPTION
- See Also:
- Constant Field Values
-
APPLY_DESCRIPTION
protected static final java.lang.String APPLY_DESCRIPTION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SpotlessExtension
protected SpotlessExtension(Project project)
-
-
Method Detail
-
getLineEndings
public LineEnding getLineEndings()
-
setLineEndings
public void setLineEndings(LineEnding lineEndings)
-
getEncoding
public java.nio.charset.Charset getEncoding()
Returns the encoding to use.
-
setEncoding
public void setEncoding(java.nio.charset.Charset charset)
Sets encoding to use (defaults to UTF_8).
-
setEncoding
public void setEncoding(java.lang.String name)
Sets encoding to use (defaults to UTF_8).
-
encoding
public void encoding(java.nio.charset.Charset charset)
Sets encoding to use (defaults to UTF_8).
-
encoding
public void encoding(java.lang.String charset)
Sets encoding to use (defaults to UTF_8).
-
setRatchetFrom
public void setRatchetFrom(java.lang.String ratchetFrom)
Limits the target to only the files which have changed since the given git reference, which is resolved according to this
-
getRatchetFrom
@Nullable public java.lang.String getRatchetFrom()
- See Also:
setRatchetFrom(String)
-
ratchetFrom
public void ratchetFrom(java.lang.String ratchetFrom)
- See Also:
setRatchetFrom(String)
-
java
public void java(Action<JavaExtension> closure)
Configures the special java-specific extension.
-
scala
public void scala(Action<ScalaExtension> closure)
Configures the special scala-specific extension.
-
kotlin
public void kotlin(Action<KotlinExtension> closure)
Configures the special kotlin-specific extension.
-
kotlinGradle
public void kotlinGradle(Action<KotlinGradleExtension> closure)
Configures the special Gradle Kotlin DSL specific extension.
-
freshmark
public void freshmark(Action<FreshMarkExtension> closure)
Configures the special freshmark-specific extension.
-
groovy
public void groovy(Action<GroovyExtension> closure)
Configures the special groovy-specific extension.
-
groovyGradle
public void groovyGradle(Action<GroovyGradleExtension> closure)
Configures the special groovy-specific extension for Gradle files.
-
sql
public void sql(Action<SqlExtension> closure)
Configures the special sql-specific extension for SQL files.
-
cpp
public void cpp(Action<CppExtension> closure)
Configures the special C/C++-specific extension.
-
javascript
public void javascript(Action<JavascriptExtension> closure)
Configures the special javascript-specific extension for javascript files.
-
typescript
public void typescript(Action<TypescriptExtension> closure)
Configures the special typescript-specific extension for typescript files.
-
antlr4
public void antlr4(Action<Antlr4Extension> closure)
Configures the special antlr4-specific extension for antlr4 files.
-
python
public void python(Action<PythonExtension> closure)
Configures the special python-specific extension for python files.
-
json
public void json(Action<JsonExtension> closure)
Configures the special JSON-specific extension.
-
yaml
public void yaml(Action<YamlExtension> closure)
Configures the special YAML-specific extension.
-
gherkin
public void gherkin(Action<GherkinExtension> closure)
Configures the special Gherkin-specific extension.
-
format
public void format(java.lang.String name, Action<FormatExtension> closure)
Configures a custom extension.
-
isEnforceCheck
public boolean isEnforceCheck()
Returnstrue
if Gradle'scheck
task should runspotlessCheck
;false
otherwise.
-
setEnforceCheck
public void setEnforceCheck(boolean enforceCheck)
Configures Gradle'scheck
task to runspotlessCheck
iftrue
, but to not do so iffalse
.true
by default.
-
format
public <T extends FormatExtension> void format(java.lang.String name, java.lang.Class<T> clazz, Action<T> configure)
-
maybeCreate
protected final <T extends FormatExtension> T maybeCreate(java.lang.String name, java.lang.Class<T> clazz)
-
createFormatTasks
protected abstract void createFormatTasks(java.lang.String name, FormatExtension formatExtension)
-
predeclareDepsFromBuildscript
public void predeclareDepsFromBuildscript()
-
predeclareDeps
public void predeclareDeps()
-
predeclare
protected void predeclare(com.diffplug.gradle.spotless.GradleProvisioner.Policy policy)
-
-