Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (

## [Unreleased]
### Changed
* Support toning down sortPom logging. ([#2185](https://github.com/diffplug/spotless/pull/2185))
* Bump default `ktlint` version to latest `1.2.1` -> `1.3.0`. ([#2165](https://github.com/diffplug/spotless/pull/2165))
* Bump default `ktfmt` version to latest `0.49` -> `0.51`. ([#2172](https://github.com/diffplug/spotless/pull/2172))
* Rename property `ktfmt` option `removeUnusedImport` -> `removeUnusedImports` to match `ktfmt`. ([#2172](https://github.com/diffplug/spotless/pull/2172))
Expand Down
2 changes: 2 additions & 0 deletions lib/src/main/java/com/diffplug/spotless/pom/SortPomCfg.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public class SortPomCfg implements Serializable {

public String predefinedSortOrder = "recommended_2008_06";

public boolean quiet = false;

public String sortOrderFile = null;

public String sortDependencies = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,28 @@ public String apply(String input) throws Exception {
.setSortEntities(cfg.sortDependencies, cfg.sortDependencyExclusions, cfg.sortDependencyManagement,
cfg.sortPlugins, cfg.sortProperties, cfg.sortModules, cfg.sortExecutions)
.setIgnoreLineSeparators(false);
sortPom.setup(new MySortPomLogger(), builder.build());
sortPom.setup(new MySortPomLogger(cfg.quiet), builder.build());
sortPom.sortPom();
return Files.readString(pom.toPath(), Charset.forName(cfg.encoding));
}

private static class MySortPomLogger implements SortPomLogger {
private final boolean quiet;

public MySortPomLogger(boolean quiet) {
this.quiet = quiet;
}

@Override
public void warn(String content) {
logger.warn(content);
}

@Override
public void info(String content) {
logger.info(content);
if (!quiet) {
logger.info(content);
}
}

@Override
Expand Down
1 change: 1 addition & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (

## [Unreleased]
### Changed
* Support toning down sortPom logging. ([#2185](https://github.com/diffplug/spotless/pull/2185))
* Bump default `ktlint` version to latest `1.2.1` -> `1.3.0`. ([#2165](https://github.com/diffplug/spotless/pull/2165))
* Bump default `ktfmt` version to latest `0.49` -> `0.51`. ([#2172](https://github.com/diffplug/spotless/pull/2172))
* Rename property `ktfmt` option `removeUnusedImport` -> `removeUnusedImports` to match `ktfmt`. ([#2172](https://github.com/diffplug/spotless/pull/2172))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public SortPomGradleConfig predefinedSortOrder(String predefinedSortOrder) {
return this;
}

public SortPomGradleConfig quiet(boolean quiet) {
cfg.quiet = quiet;
return this;
}

public SortPomGradleConfig sortOrderFile(String sortOrderFile) {
cfg.sortOrderFile = sortOrderFile;
return this;
Expand Down
1 change: 1 addition & 0 deletions plugin-maven/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (

## [Unreleased]
### Changed
* Support toning down sortPom logging. ([#2185](https://github.com/diffplug/spotless/pull/2185))
* Bump default `ktlint` version to latest `1.2.1` -> `1.3.0`. ([#2165](https://github.com/diffplug/spotless/pull/2165))
* Bump default `ktfmt` version to latest `0.49` -> `0.51`. ([#2172](https://github.com/diffplug/spotless/pull/2172))
* Rename property `ktfmt` option `removeUnusedImport` -> `removeUnusedImports` to match `ktfmt`. ([#2172](https://github.com/diffplug/spotless/pull/2172))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public class SortPom implements FormatterStepFactory {
@Parameter
String predefinedSortOrder = defaultValues.predefinedSortOrder;

@Parameter
boolean quiet = defaultValues.quiet;

@Parameter
String sortOrderFile = defaultValues.sortOrderFile;

Expand Down Expand Up @@ -101,6 +104,7 @@ public FormatterStep newFormatterStep(FormatterStepConfig stepConfig) {
cfg.indentSchemaLocation = indentSchemaLocation;
cfg.indentAttribute = indentAttribute;
cfg.predefinedSortOrder = predefinedSortOrder;
cfg.quiet = quiet;
cfg.sortOrderFile = sortOrderFile;
cfg.sortDependencies = sortDependencies;
cfg.sortDependencyManagement = sortDependencyManagement;
Expand Down