diff --git a/lib/src/main/java/com/diffplug/spotless/kotlin/KotlinConstants.java b/lib/src/main/java/com/diffplug/spotless/kotlin/KotlinConstants.java new file mode 100644 index 0000000000..5df0231b8d --- /dev/null +++ b/lib/src/main/java/com/diffplug/spotless/kotlin/KotlinConstants.java @@ -0,0 +1,24 @@ +/* + * Copyright 2016 DiffPlug + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.diffplug.spotless.kotlin; + +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)"; + + private KotlinConstants() {} +} diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinExtension.java index 45a81a2630..0476dec337 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinExtension.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinExtension.java @@ -15,6 +15,8 @@ */ package com.diffplug.gradle.spotless; +import static com.diffplug.spotless.kotlin.KotlinConstants.LICENSE_HEADER_DELIMITER; + import java.util.Objects; import org.gradle.api.GradleException; @@ -25,8 +27,6 @@ import com.diffplug.spotless.kotlin.KtLintStep; public class KotlinExtension extends FormatExtension { - // '^' is prepended to the regex in LICENSE_HEADER_DELIMITER later in FormatExtension.licenseHeader(String, String) - private static final String LICENSE_HEADER_DELIMITER = "(package |@file)"; static final String NAME = "kotlin"; public KotlinExtension(SpotlessExtension rootExtension) { diff --git a/plugin-maven/src/main/java/com/diffplug/spotless/maven/kotlin/Kotlin.java b/plugin-maven/src/main/java/com/diffplug/spotless/maven/kotlin/Kotlin.java index 9fd0b1f8af..a53d6bd6f1 100644 --- a/plugin-maven/src/main/java/com/diffplug/spotless/maven/kotlin/Kotlin.java +++ b/plugin-maven/src/main/java/com/diffplug/spotless/maven/kotlin/Kotlin.java @@ -16,6 +16,7 @@ package com.diffplug.spotless.maven.kotlin; import static com.diffplug.common.collect.Sets.newHashSet; +import static com.diffplug.spotless.kotlin.KotlinConstants.LICENSE_HEADER_DELIMITER; import static java.util.Collections.unmodifiableSet; import java.util.Set; @@ -27,8 +28,6 @@ public class Kotlin extends FormatterFactory { private static final Set DEFAULT_INCLUDES = unmodifiableSet(newHashSet("src/main/kotlin/**/*.kt", "src/test/kotlin/**/*.kt")); - private static final String LICENSE_HEADER_DELIMITER = "(package |@file)"; - @Override public Set defaultIncludes() { return DEFAULT_INCLUDES;