Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP NOK google-java-format via GoogleJavaFormatTest #18

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ shellcheck_test(
exclude = [
"bazel-bin/**",
"bazel-out/**",
".venv/**"
".venv/**",
],
),
tags = ["lint"],
)

# java_test(
# name = "google-java-format",
# srcs = ["tools/google-java-format-test/src/test/java/dev/enola/tools/test/GoogleJavaFormatTest.java"],
# deps = ["@maven//:com_google_googlejavaformat_google_java_format"],
# )
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

maven.install(
artifacts = [
"com.google.googlejavaformat:google-java-format:1.16.0",
"com.google.guava:guava:31.1-jre",
"com.google.truth:truth:1.1.3",
"io.kubernetes:client-java:17.0.1",
Expand Down
162 changes: 88 additions & 74 deletions maven_install.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dependency_tree": {
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
"__INPUT_ARTIFACTS_HASH": 955117512,
"__RESOLVED_ARTIFACTS_HASH": 839727221,
"__INPUT_ARTIFACTS_HASH": 839040131,
"__RESOLVED_ARTIFACTS_HASH": 1989677082,
"conflict_resolution": {},
"dependencies": [
{
Expand Down Expand Up @@ -97,31 +97,81 @@
"url": "https://repo1.maven.org/maven2/com/google/code/gson/gson/2.10/gson-2.10-sources.jar"
},
{
"coord": "com.google.errorprone:error_prone_annotations:2.7.1",
"coord": "com.google.errorprone:error_prone_annotations:2.11.0",
"dependencies": [],
"directDependencies": [],
"file": "v1/https/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.7.1/error_prone_annotations-2.7.1.jar",
"file": "v1/https/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.11.0/error_prone_annotations-2.11.0.jar",
"mirror_urls": [
"https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.7.1/error_prone_annotations-2.7.1.jar"
"https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.11.0/error_prone_annotations-2.11.0.jar"
],
"packages": [
"com.google.errorprone.annotations",
"com.google.errorprone.annotations.concurrent"
],
"sha256": "cd5257c08a246cf8628817ae71cb822be192ef91f6881ca4a3fcff4f1de1cff3",
"url": "https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.7.1/error_prone_annotations-2.7.1.jar"
"sha256": "721cb91842b46fa056847d104d5225c8b8e1e8b62263b993051e1e5a0137b7ec",
"url": "https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.11.0/error_prone_annotations-2.11.0.jar"
},
{
"coord": "com.google.errorprone:error_prone_annotations:jar:sources:2.7.1",
"coord": "com.google.errorprone:error_prone_annotations:jar:sources:2.11.0",
"dependencies": [],
"directDependencies": [],
"file": "v1/https/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.7.1/error_prone_annotations-2.7.1-sources.jar",
"file": "v1/https/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.11.0/error_prone_annotations-2.11.0-sources.jar",
"mirror_urls": [
"https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.7.1/error_prone_annotations-2.7.1-sources.jar"
"https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.11.0/error_prone_annotations-2.11.0-sources.jar"
],
"packages": [],
"sha256": "e38921f918b8ad8eabd12bc61de426fa96c72de077054e9147d2f9fe7c648923",
"url": "https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.7.1/error_prone_annotations-2.7.1-sources.jar"
"sha256": "31a8f1bd791fb22c606af95049062a3c8252ce4b1b17555d00dc609e6371101d",
"url": "https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.11.0/error_prone_annotations-2.11.0-sources.jar"
},
{
"coord": "com.google.googlejavaformat:google-java-format:1.16.0",
"dependencies": [
"com.google.code.findbugs:jsr305:3.0.2",
"com.google.errorprone:error_prone_annotations:2.11.0",
"com.google.guava:failureaccess:1.0.1",
"com.google.guava:guava:31.1-jre",
"com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava",
"com.google.j2objc:j2objc-annotations:1.3",
"org.checkerframework:checker-qual:3.13.0"
],
"directDependencies": [
"com.google.guava:guava:31.1-jre"
],
"file": "v1/https/repo1.maven.org/maven2/com/google/googlejavaformat/google-java-format/1.16.0/google-java-format-1.16.0.jar",
"mirror_urls": [
"https://repo1.maven.org/maven2/com/google/googlejavaformat/google-java-format/1.16.0/google-java-format-1.16.0.jar"
],
"packages": [
"com.google.googlejavaformat",
"com.google.googlejavaformat.java",
"com.google.googlejavaformat.java.filer",
"com.google.googlejavaformat.java.java17",
"com.google.googlejavaformat.java.javadoc"
],
"sha256": "0cff5d0230ba20d538f3f70b2aa68bd33f9fdc69768cde07337c563c23eb7c43",
"url": "https://repo1.maven.org/maven2/com/google/googlejavaformat/google-java-format/1.16.0/google-java-format-1.16.0.jar"
},
{
"coord": "com.google.googlejavaformat:google-java-format:jar:sources:1.16.0",
"dependencies": [
"com.google.code.findbugs:jsr305:jar:sources:3.0.2",
"com.google.errorprone:error_prone_annotations:jar:sources:2.11.0",
"com.google.guava:failureaccess:jar:sources:1.0.1",
"com.google.guava:guava:jar:sources:31.1-jre",
"com.google.guava:listenablefuture:jar:sources:9999.0-empty-to-avoid-conflict-with-guava",
"com.google.j2objc:j2objc-annotations:jar:sources:1.3",
"org.checkerframework:checker-qual:jar:sources:3.13.0"
],
"directDependencies": [
"com.google.guava:guava:jar:sources:31.1-jre"
],
"file": "v1/https/repo1.maven.org/maven2/com/google/googlejavaformat/google-java-format/1.16.0/google-java-format-1.16.0-sources.jar",
"mirror_urls": [
"https://repo1.maven.org/maven2/com/google/googlejavaformat/google-java-format/1.16.0/google-java-format-1.16.0-sources.jar"
],
"packages": [],
"sha256": "92c6b17eb446d847ffe43a84b6789c9d2ce4abb0d0537dab45c75d5c12c0f596",
"url": "https://repo1.maven.org/maven2/com/google/googlejavaformat/google-java-format/1.16.0/google-java-format-1.16.0-sources.jar"
},
{
"coord": "com.google.guava:failureaccess:1.0.1",
Expand Down Expand Up @@ -150,26 +200,26 @@
"url": "https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1-sources.jar"
},
{
"coord": "com.google.guava:guava:30.1.1-android",
"coord": "com.google.guava:guava:31.1-jre",
"dependencies": [
"com.google.code.findbugs:jsr305:3.0.2",
"com.google.errorprone:error_prone_annotations:2.7.1",
"com.google.errorprone:error_prone_annotations:2.11.0",
"com.google.guava:failureaccess:1.0.1",
"com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava",
"com.google.j2objc:j2objc-annotations:1.3",
"org.checkerframework:checker-compat-qual:2.5.5"
"org.checkerframework:checker-qual:3.13.0"
],
"directDependencies": [
"com.google.code.findbugs:jsr305:3.0.2",
"com.google.errorprone:error_prone_annotations:2.7.1",
"com.google.errorprone:error_prone_annotations:2.11.0",
"com.google.guava:failureaccess:1.0.1",
"com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava",
"com.google.j2objc:j2objc-annotations:1.3",
"org.checkerframework:checker-compat-qual:2.5.5"
"org.checkerframework:checker-qual:3.13.0"
],
"file": "v1/https/repo1.maven.org/maven2/com/google/guava/guava/30.1.1-android/guava-30.1.1-android.jar",
"file": "v1/https/repo1.maven.org/maven2/com/google/guava/guava/31.1-jre/guava-31.1-jre.jar",
"mirror_urls": [
"https://repo1.maven.org/maven2/com/google/guava/guava/30.1.1-android/guava-30.1.1-android.jar"
"https://repo1.maven.org/maven2/com/google/guava/guava/31.1-jre/guava-31.1-jre.jar"
],
"packages": [
"com.google.common.annotations",
Expand All @@ -191,34 +241,34 @@
"com.google.common.xml",
"com.google.thirdparty.publicsuffix"
],
"sha256": "355f79352f8c252f2bdaa06c687c4836a38016caccfc4c28d16ae77ecfdffa2f",
"url": "https://repo1.maven.org/maven2/com/google/guava/guava/30.1.1-android/guava-30.1.1-android.jar"
"sha256": "a42edc9cab792e39fe39bb94f3fca655ed157ff87a8af78e1d6ba5b07c4a00ab",
"url": "https://repo1.maven.org/maven2/com/google/guava/guava/31.1-jre/guava-31.1-jre.jar"
},
{
"coord": "com.google.guava:guava:jar:sources:30.1.1-android",
"coord": "com.google.guava:guava:jar:sources:31.1-jre",
"dependencies": [
"com.google.code.findbugs:jsr305:jar:sources:3.0.2",
"com.google.errorprone:error_prone_annotations:jar:sources:2.7.1",
"com.google.errorprone:error_prone_annotations:jar:sources:2.11.0",
"com.google.guava:failureaccess:jar:sources:1.0.1",
"com.google.guava:listenablefuture:jar:sources:9999.0-empty-to-avoid-conflict-with-guava",
"com.google.j2objc:j2objc-annotations:jar:sources:1.3",
"org.checkerframework:checker-compat-qual:jar:sources:2.5.5"
"org.checkerframework:checker-qual:jar:sources:3.13.0"
],
"directDependencies": [
"com.google.code.findbugs:jsr305:jar:sources:3.0.2",
"com.google.errorprone:error_prone_annotations:jar:sources:2.7.1",
"com.google.errorprone:error_prone_annotations:jar:sources:2.11.0",
"com.google.guava:failureaccess:jar:sources:1.0.1",
"com.google.guava:listenablefuture:jar:sources:9999.0-empty-to-avoid-conflict-with-guava",
"com.google.j2objc:j2objc-annotations:jar:sources:1.3",
"org.checkerframework:checker-compat-qual:jar:sources:2.5.5"
"org.checkerframework:checker-qual:jar:sources:3.13.0"
],
"file": "v1/https/repo1.maven.org/maven2/com/google/guava/guava/30.1.1-android/guava-30.1.1-android-sources.jar",
"file": "v1/https/repo1.maven.org/maven2/com/google/guava/guava/31.1-jre/guava-31.1-jre-sources.jar",
"mirror_urls": [
"https://repo1.maven.org/maven2/com/google/guava/guava/30.1.1-android/guava-30.1.1-android-sources.jar"
"https://repo1.maven.org/maven2/com/google/guava/guava/31.1-jre/guava-31.1-jre-sources.jar"
],
"packages": [],
"sha256": "dac52416371d86baea1ffe6ef7b54b2730b52fcea19091ae32942cb5cd9f868c",
"url": "https://repo1.maven.org/maven2/com/google/guava/guava/30.1.1-android/guava-30.1.1-android-sources.jar"
"sha256": "8ab1853cdaf936ec88be80c17302b7c20abafbd4f54d4fb54d7011c529e3a44a",
"url": "https://repo1.maven.org/maven2/com/google/guava/guava/31.1-jre/guava-31.1-jre-sources.jar"
},
{
"coord": "com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava",
Expand Down Expand Up @@ -295,22 +345,17 @@
"coord": "com.google.truth:truth:1.1.3",
"dependencies": [
"com.google.auto.value:auto-value-annotations:1.8.1",
"com.google.code.findbugs:jsr305:3.0.2",
"com.google.errorprone:error_prone_annotations:2.7.1",
"com.google.guava:failureaccess:1.0.1",
"com.google.guava:guava:30.1.1-android",
"com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava",
"com.google.j2objc:j2objc-annotations:1.3",
"com.google.errorprone:error_prone_annotations:2.11.0",
"com.google.guava:guava:31.1-jre",
"junit:junit:4.13.2",
"org.checkerframework:checker-compat-qual:2.5.5",
"org.checkerframework:checker-qual:3.13.0",
"org.hamcrest:hamcrest-core:1.3",
"org.ow2.asm:asm:9.1"
],
"directDependencies": [
"com.google.auto.value:auto-value-annotations:1.8.1",
"com.google.errorprone:error_prone_annotations:2.7.1",
"com.google.guava:guava:30.1.1-android",
"com.google.errorprone:error_prone_annotations:2.11.0",
"com.google.guava:guava:31.1-jre",
"junit:junit:4.13.2",
"org.checkerframework:checker-qual:3.13.0",
"org.ow2.asm:asm:9.1"
Expand All @@ -329,22 +374,17 @@
"coord": "com.google.truth:truth:jar:sources:1.1.3",
"dependencies": [
"com.google.auto.value:auto-value-annotations:jar:sources:1.8.1",
"com.google.code.findbugs:jsr305:jar:sources:3.0.2",
"com.google.errorprone:error_prone_annotations:jar:sources:2.7.1",
"com.google.guava:failureaccess:jar:sources:1.0.1",
"com.google.guava:guava:jar:sources:30.1.1-android",
"com.google.guava:listenablefuture:jar:sources:9999.0-empty-to-avoid-conflict-with-guava",
"com.google.j2objc:j2objc-annotations:jar:sources:1.3",
"com.google.errorprone:error_prone_annotations:jar:sources:2.11.0",
"com.google.guava:guava:jar:sources:31.1-jre",
"junit:junit:jar:sources:4.13.2",
"org.checkerframework:checker-compat-qual:jar:sources:2.5.5",
"org.checkerframework:checker-qual:jar:sources:3.13.0",
"org.hamcrest:hamcrest-core:jar:sources:1.3",
"org.ow2.asm:asm:jar:sources:9.1"
],
"directDependencies": [
"com.google.auto.value:auto-value-annotations:jar:sources:1.8.1",
"com.google.errorprone:error_prone_annotations:jar:sources:2.7.1",
"com.google.guava:guava:jar:sources:30.1.1-android",
"com.google.errorprone:error_prone_annotations:jar:sources:2.11.0",
"com.google.guava:guava:jar:sources:31.1-jre",
"junit:junit:jar:sources:4.13.2",
"org.checkerframework:checker-qual:jar:sources:3.13.0",
"org.ow2.asm:asm:jar:sources:9.1"
Expand Down Expand Up @@ -1528,32 +1568,6 @@
"sha256": "e3b6ad549180ff284d3858cfa38bf4cbbd082c7225ed7f236a981907284d488a",
"url": "https://repo1.maven.org/maven2/org/bouncycastle/bcutil-jdk18on/1.72/bcutil-jdk18on-1.72-sources.jar"
},
{
"coord": "org.checkerframework:checker-compat-qual:2.5.5",
"dependencies": [],
"directDependencies": [],
"file": "v1/https/repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar",
"mirror_urls": [
"https://repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar"
],
"packages": [
"org.checkerframework.checker.nullness.compatqual"
],
"sha256": "11d134b245e9cacc474514d2d66b5b8618f8039a1465cdc55bbc0b34e0008b7a",
"url": "https://repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar"
},
{
"coord": "org.checkerframework:checker-compat-qual:jar:sources:2.5.5",
"dependencies": [],
"directDependencies": [],
"file": "v1/https/repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5-sources.jar",
"mirror_urls": [
"https://repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5-sources.jar"
],
"packages": [],
"sha256": "7c63a4a46b2ef903f941aeac63da87dd345be3243b472796aa945fa715bf3ca9",
"url": "https://repo1.maven.org/maven2/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5-sources.jar"
},
{
"coord": "org.checkerframework:checker-qual:3.13.0",
"dependencies": [],
Expand Down
28 changes: 28 additions & 0 deletions tools/google-java-format-test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# java_library(
# name = "google-java-format-library",
# srcs = glob(["src/main/java/**/*.java"]),
# visibility = ["//:__subpackages__"],
# deps = [
# "@maven//:com_google_googlejavaformat_google_java_format",
# "@maven//:junit_junit",
# ],
# )

java_test(
name = "GoogleJavaFormatTest",
srcs = glob(["src/test/java/**/*Test.java"]),
deps = [
"@maven//:com_google_googlejavaformat_google_java_format",
# "@maven//:junit_junit",
],
)

# java_binary(
# name = "google-java-format-binary",
# main_class = "dev.enola.tools.format.GoogleJavaFormatTest",
# # srcs = glob(["src/main/java/**/*.java"]),
# visibility = ["//:__subpackages__"],
# runtime_deps = [
# ":google-java-format-library",
# ],
# )
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package dev.enola.tools.format;

import com.google.googlejavaformat.java.GoogleJavaFormatToolProvider;
import org.junit.Assert;
import org.junit.Test;

import java.io.OutputStreamWriter;
import java.io.PrintWriter;

import static java.nio.charset.StandardCharsets.UTF_8;

public class GoogleJavaFormatTest {
@Test
public void testGoogleJavaFormat() {
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out, UTF_8));
PrintWriter err = new PrintWriter(new OutputStreamWriter(System.err, UTF_8));
Assert.assertEquals(0, new GoogleJavaFormatToolProvider().run(out, err, "--help"));
}
}