diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/java/GoogleJavaFormat.java b/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormat.java similarity index 92% rename from plugin-gradle/src/main/java/com/diffplug/gradle/spotless/java/GoogleJavaFormat.java rename to lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormat.java index 4c99f30c50..acf1ed7d73 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/java/GoogleJavaFormat.java +++ b/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormat.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.diffplug.gradle.spotless.java; +package com.diffplug.spotless.java; import java.io.Serializable; import java.lang.reflect.Method; @@ -26,8 +26,12 @@ import com.diffplug.spotless.Provisioner; /** Wraps up [google-java-format](https://github.com/google/google-java-format) as a FormatterStep. */ -class GoogleJavaFormat { - static final String DEFAULT_VERSION = "1.1"; +public class GoogleJavaFormat { + public static final String defaultVersion() { + return DEFAULT_VERSION; + } + + private static final String DEFAULT_VERSION = "1.1"; private static final String NAME = "google-java-format"; private static final String MAVEN_COORDINATE = "com.google.googlejavaformat:google-java-format:"; private static final String FORMATTER_CLASS = "com.google.googlejavaformat.java.Formatter"; diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/java/JavaExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/java/JavaExtension.java index 95e62c7f61..6f713b16ed 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/java/JavaExtension.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/java/JavaExtension.java @@ -28,6 +28,7 @@ import com.diffplug.gradle.spotless.LicenseHeaderStep; import com.diffplug.gradle.spotless.SpotlessExtension; import com.diffplug.spotless.SerializableFileFilter; +import com.diffplug.spotless.java.GoogleJavaFormat; public class JavaExtension extends FormatExtension { public static final String NAME = "java"; @@ -68,7 +69,7 @@ public void eclipseFormatFile(String eclipseVersion, Object eclipseFormatFile) { /** Uses the [google-java-format](https://github.com/google/google-java-format) jar to format source code. */ public void googleJavaFormat() { - googleJavaFormat(GoogleJavaFormat.DEFAULT_VERSION); + googleJavaFormat(GoogleJavaFormat.defaultVersion()); } /** diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/java/GoogleJavaFormatTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/java/GoogleJavaFormatTest.java index dd443d2cc4..6fdf976e8a 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/java/GoogleJavaFormatTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/java/GoogleJavaFormatTest.java @@ -28,6 +28,7 @@ import com.diffplug.gradle.spotless.GradleIntegrationTest; import com.diffplug.gradle.spotless.GradleProvisioner; import com.diffplug.spotless.FormatterStep; +import com.diffplug.spotless.java.GoogleJavaFormat; public class GoogleJavaFormatTest extends GradleIntegrationTest { @Test