diff --git a/CHANGES.md b/CHANGES.md index bed2af6281..8c079e0c4d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Added * Clang and Black no longer break the build when the binary is unavailable, if they will not be run during that build ([#1257](https://github.com/diffplug/spotless/pull/1257)). +* License header support for Kotlin files without `package` or `@file` but do at least have `import` ([#1263](https://github.com/diffplug/spotless/pull/1263)). ## [2.27.0] - 2022-06-30 ### Added diff --git a/lib/src/main/java/com/diffplug/spotless/kotlin/KotlinConstants.java b/lib/src/main/java/com/diffplug/spotless/kotlin/KotlinConstants.java index 5df0231b8d..da2240f16c 100644 --- a/lib/src/main/java/com/diffplug/spotless/kotlin/KotlinConstants.java +++ b/lib/src/main/java/com/diffplug/spotless/kotlin/KotlinConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 DiffPlug + * Copyright 2016-2022 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ public final class KotlinConstants { // '^' is prepended to the regex in LICENSE_HEADER_DELIMITER later in FormatExtension.licenseHeader(String, String) - public static final String LICENSE_HEADER_DELIMITER = "(package |@file)"; + public static final String LICENSE_HEADER_DELIMITER = "(package |@file|import )"; private KotlinConstants() {} } diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index d38d6ee70a..1653838a3a 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -5,6 +5,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Added * Clang and Black no longer break the build when the binary is unavailable, if they will not be run during that build ([#1257](https://github.com/diffplug/spotless/pull/1257)). +* License header support for Kotlin files without `package` or `@file` but do at least have `import` ([#1263](https://github.com/diffplug/spotless/pull/1263)). ### Fixed * Warnings about missing `Task#usesService` for Gradle 8.0 ([#1262](https://github.com/diffplug/spotless/pull/1262) fixes [#1260](https://github.com/diffplug/spotless/issues/1260)) diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 3499aeab36..732489f81f 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -5,6 +5,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Added * Clang and Black no longer break the build when the binary is unavailable, if they will not be run during that build ([#1257](https://github.com/diffplug/spotless/pull/1257)). +* License header support for Kotlin files without `package` or `@file` but do at least have `import` ([#1263](https://github.com/diffplug/spotless/pull/1263)). ## [2.23.0] - 2022-06-30 ### Added