Skip to content

Commit

Permalink
Moved GoogleJavaFormat into spotless-lib.
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg committed Nov 30, 2016
1 parent 2b1b2c0 commit d4cf637
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d4cf637

Please sign in to comment.