Skip to content

Commit 599d31b

Browse files
authored
Drop old KtLint support - 0.3x and 0.45.2 (#1475)
2 parents 33f4abe + aab121d commit 599d31b

File tree

10 files changed

+14
-414
lines changed

10 files changed

+14
-414
lines changed

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
2020
### Changes
2121
* Rename `YamlJacksonStep` into `JacksonYamlStep` while normalizing Jackson usage ([#1492](https://github.com/diffplug/spotless/pull/1492))
2222
* Convert `gson` integration to use a compile-only source set ([#1510](https://github.com/diffplug/spotless/pull/1510)).
23+
* ** POTENTIALLY BREAKING** Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475))
24+
* `KtLint` does not maintain a stable API - before this PR, we supported every breaking change in the API since 2019.
25+
* From now on, we will support no more than 2 breaking changes at a time.
2326

2427
## [2.32.0] - 2023-01-13
2528
### Added

lib/build.gradle

+3-19
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ for (glue in NEEDS_GLUE) {
2929
versionCompatibility {
3030
adapters {
3131
namespaces.register('KtLint') {
32+
// as discussed at https://github.com/diffplug/spotless/pull/1475
33+
// we will support no more than 2 breaking changes at a time = 3 incompatible versions
34+
// we will try to drop down to only one version if a stable API can be maintained for a full year
3235
versions = [
33-
'0.31.0',
34-
'0.32.0',
35-
'0.34.2',
36-
'0.45.2',
3736
'0.46.0',
3837
'0.47.0',
3938
'0.48.0',
@@ -81,21 +80,6 @@ dependencies {
8180
ktlintCompileOnly "com.pinterest.ktlint:ktlint-ruleset-experimental:$VER_KTLINT"
8281
ktlintCompileOnly "com.pinterest.ktlint:ktlint-ruleset-standard:$VER_KTLINT"
8382

84-
compatKtLint0Dot31Dot0CompileOnly 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20'
85-
compatKtLint0Dot31Dot0CompileOnly 'com.github.shyiko.ktlint:ktlint-core:0.31.0'
86-
compatKtLint0Dot31Dot0CompileOnly 'com.github.shyiko.ktlint:ktlint-ruleset-experimental:0.31.0'
87-
compatKtLint0Dot31Dot0CompileOnly 'com.github.shyiko.ktlint:ktlint-ruleset-standard:0.31.0'
88-
compatKtLint0Dot32Dot0CompileOnly 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20'
89-
compatKtLint0Dot32Dot0CompileOnly 'com.pinterest.ktlint:ktlint-core:0.32.0'
90-
compatKtLint0Dot32Dot0CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-experimental:0.32.0'
91-
compatKtLint0Dot32Dot0CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.32.0'
92-
compatKtLint0Dot34Dot2CompileOnly 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20'
93-
compatKtLint0Dot34Dot2CompileOnly 'com.pinterest.ktlint:ktlint-core:0.34.2'
94-
compatKtLint0Dot34Dot2CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-experimental:0.34.2'
95-
compatKtLint0Dot34Dot2CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.34.2'
96-
compatKtLint0Dot45Dot2CompileOnly 'com.pinterest.ktlint:ktlint-core:0.45.2'
97-
compatKtLint0Dot45Dot2CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-experimental:0.45.2'
98-
compatKtLint0Dot45Dot2CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.45.2'
9983
compatKtLint0Dot46Dot0CompileOnly 'com.pinterest.ktlint:ktlint-core:0.46.0'
10084
compatKtLint0Dot46Dot0CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-experimental:0.46.0'
10185
compatKtLint0Dot46Dot0CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.46.0'

lib/src/compatKtLint0Dot31Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot31Dot0Adapter.java

-64
This file was deleted.

lib/src/compatKtLint0Dot32Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot32Dot0Adapter.java

-64
This file was deleted.

lib/src/compatKtLint0Dot34Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot34Dot2Adapter.java

-68
This file was deleted.

lib/src/compatKtLint0Dot45Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot45Dot2Adapter.java

-119
This file was deleted.

lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,9 @@ public KtlintFormatterFunc(String version, boolean isScript, boolean useExperime
4444
} else if (minorVersion == 47) {
4545
// rename RuleSet to RuleProvider
4646
this.adapter = new KtLintCompat0Dot47Dot0Adapter();
47-
} else if (minorVersion >= 46) {
47+
} else {
4848
// DefaultEditorConfigProperties.INSTANCE.getDefaultEditorConfigProperties() renamed to .getEditorConfigProperties()
4949
this.adapter = new KtLintCompat0Dot46Dot0Adapter();
50-
} else if (version.equals("0.45.2")) {
51-
// add editorConfigOverride
52-
this.adapter = new KtLintCompat0Dot45Dot2Adapter();
53-
} else if (minorVersion >= 34) {
54-
// KtLint.INSTANCE.format() now needs more parameters
55-
this.adapter = new KtLintCompat0Dot34Dot2Adapter();
56-
} else if (minorVersion >= 32) {
57-
// rename packages from `com.github.shyiko` to `com.pinterest`
58-
this.adapter = new KtLintCompat0Dot32Dot0Adapter();
59-
} else {
60-
// the OG
61-
this.adapter = new KtLintCompat0Dot31Dot0Adapter();
6250
}
6351
this.editorConfigPath = editorConfigPath;
6452
this.useExperimental = useExperimental;

0 commit comments

Comments
 (0)