Class FormatJExtension
java.lang.Object
zone.rong.formatj.gradle.FormatJExtension
The
formatJ { } block.
formatJ {
preset = Preset.GOOGLE
styleFile = file("formatj.toml")
rule("indent.size", 4)
sourceSets = listOf("main", "test")
}
Rules are addressed by the same dotted keys the style file and the CLI use, so a project can move a rule between build script and style file without translating anything.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.gradle.api.provider.Property<Boolean> Whethercheckdepends onformatJavaCheck.abstract org.gradle.api.provider.Property<zone.rong.formatj.api.LanguageLevel> Syntax level to parse.abstract org.gradle.api.provider.Property<zone.rong.formatj.api.Preset> Starting point for the rules.abstract org.gradle.api.provider.Property<Boolean> Whether preview syntax is accepted.getRules()Individual rule overrides, applied last.abstract org.gradle.api.provider.ListProperty<String> Names of the source sets to format.abstract org.gradle.api.file.RegularFilePropertyA style file whose rules are applied on top of the preset.voidSets one rule, validating the key against the catalogue immediately.voidSets several rules at once.voidsourceSets(String... names) Convenience forsourceSets = listOf(...).
-
Constructor Details
-
FormatJExtension
public FormatJExtension()
-
-
Method Details
-
getPreset
public abstract org.gradle.api.provider.Property<zone.rong.formatj.api.Preset> getPreset()Starting point for the rules. Defaults toPreset.FORMATJ. -
getStyleFile
public abstract org.gradle.api.file.RegularFileProperty getStyleFile()A style file whose rules are applied on top of the preset. -
getRules
-
getSourceSets
Names of the source sets to format. Defaults to every source set in the project. -
getLanguageLevel
public abstract org.gradle.api.provider.Property<zone.rong.formatj.api.LanguageLevel> getLanguageLevel()Syntax level to parse. Defaults to the newest FormatJ knows. -
getPreviewFeatures
Whether preview syntax is accepted. Defaults to false. -
getEnforceOnCheck
Whethercheckdepends onformatJavaCheck. Defaults to true. -
rule
-
rules
-
sourceSets
Convenience forsourceSets = listOf(...).
-