From 35d95678edfb9161c0e983cc7967ebbc11526c0f Mon Sep 17 00:00:00 2001 From: Chaoren Lin Date: Mon, 7 Oct 2024 09:52:09 -0700 Subject: [PATCH] Remove unnecessary `run_tests` script and other miscellaneous changes. - Setting `USE_BAZEL_VERSION` the environment is redundant with the `.bazelversion` file. - Boolean attributes should use `True` instead of `1`. - Some BUILD files contain copypasted comments that were incorrect. PiperOrigin-RevId: 683220153 --- .github/workflows/ci.yml | 5 +---- run_tests.sh | 27 ------------------------- third_party/java/auto/BUILD | 2 +- third_party/java/byte_buddy/BUILD | 4 ++-- third_party/java/byte_buddy_agent/BUILD | 4 ++-- third_party/java/compile_testing/BUILD | 2 +- third_party/java/diffutils/BUILD | 2 +- third_party/java/guava/BUILD | 2 +- third_party/java/hamcrest/BUILD | 2 +- third_party/java/junit/BUILD | 2 +- third_party/java/log4j/BUILD | 2 +- third_party/java/mockito/BUILD | 2 +- third_party/java/objenesis/BUILD | 4 ++-- third_party/java/slf4j_api/BUILD | 2 +- third_party/java/truth/BUILD | 2 +- 15 files changed, 17 insertions(+), 47 deletions(-) delete mode 100755 run_tests.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e336aa..9cf4283 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,6 @@ jobs: test: name: "Test" runs-on: ubuntu-latest - env: - # Used by bazelisk: https://github.com/bazelbuild/bazelisk - USE_BAZEL_VERSION: '7.3.1' steps: - name: 'Check out repository' uses: actions/checkout@v2 @@ -27,4 +24,4 @@ jobs: bazel- - name: 'Test' shell: bash - run: ./run_tests.sh + run: bazelisk test --lockfile_mode=error --test_output=errors //... diff --git a/run_tests.sh b/run_tests.sh deleted file mode 100755 index a12851b..0000000 --- a/run_tests.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -# Runs all tests, and tests that all libraries build without errors. - -readarray -t libraries < <(bazelisk query 'kind(_library, //third_party/...)') - -readonly DIR=build_test - -mkdir "${DIR}" -trap "rm -r ${DIR}/" EXIT - -cat <> "${DIR}"/BUILD -java_library( - name = "build_test", - testonly = True, - srcs = ["BuildTest.java"], - deps = [ -$(printf ' "%s",\n' "${libraries[@]}") - ], -) -BUILD_TEST - -echo "class BuildTest {}" > "${DIR}"/BuildTest.java - -bazelisk build //build_test //third_party/... - -bazelisk test //tools/... diff --git a/third_party/java/auto/BUILD b/third_party/java/auto/BUILD index 966e663..b851d50 100644 --- a/third_party/java/auto/BUILD +++ b/third_party/java/auto/BUILD @@ -75,7 +75,7 @@ java_library( java_plugin( name = "auto_factory_processor", - generates_api = 1, + generates_api = True, processor_class = "com.google.auto.factory.processor.AutoFactoryProcessor", visibility = ["//visibility:private"], deps = [ diff --git a/third_party/java/byte_buddy/BUILD b/third_party/java/byte_buddy/BUILD index 3079b98..4b9bdea 100644 --- a/third_party/java/byte_buddy/BUILD +++ b/third_party/java/byte_buddy/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# BUILD rules for https://github.com/mockito/mockito +# BUILD rules for https://bytebuddy.net/ load("@rules_java//java:defs.bzl", "java_library") @@ -20,6 +20,6 @@ package(default_visibility = ["//visibility:public"]) java_library( name = "byte_buddy", - testonly = 1, + testonly = True, exports = ["@maven//:net_bytebuddy_byte_buddy"], ) diff --git a/third_party/java/byte_buddy_agent/BUILD b/third_party/java/byte_buddy_agent/BUILD index a558cff..bd372d6 100644 --- a/third_party/java/byte_buddy_agent/BUILD +++ b/third_party/java/byte_buddy_agent/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# BUILD rules for https://github.com/mockito/mockito +# BUILD rules for https://bytebuddy.net/ load("@rules_java//java:defs.bzl", "java_library") @@ -20,6 +20,6 @@ package(default_visibility = ["//visibility:public"]) java_library( name = "byte_buddy_agent", - testonly = 1, + testonly = True, exports = ["@maven//:net_bytebuddy_byte_buddy_agent"], ) diff --git a/third_party/java/compile_testing/BUILD b/third_party/java/compile_testing/BUILD index e3ca4bb..e1aea61 100644 --- a/third_party/java/compile_testing/BUILD +++ b/third_party/java/compile_testing/BUILD @@ -20,7 +20,7 @@ package(default_visibility = ["//visibility:public"]) java_library( name = "compile_testing", - testonly = 1, + testonly = True, add_exports = [ "jdk.compiler/com.sun.tools.javac.api", "jdk.compiler/com.sun.tools.javac.main", diff --git a/third_party/java/diffutils/BUILD b/third_party/java/diffutils/BUILD index 6b9da84..e2624a6 100644 --- a/third_party/java/diffutils/BUILD +++ b/third_party/java/diffutils/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# BUILD rules for https://github.com/google/truth +# BUILD rules for https://code.google.com/archive/p/java-diff-utils/ load("@rules_java//java:defs.bzl", "java_library") diff --git a/third_party/java/guava/BUILD b/third_party/java/guava/BUILD index f9a54cb..a294218 100644 --- a/third_party/java/guava/BUILD +++ b/third_party/java/guava/BUILD @@ -29,7 +29,7 @@ java_library( java_library( name = "testlib", - testonly = 1, + testonly = True, exports = ["@maven//:com_google_guava_guava_testlib"], runtime_deps = [":guava"], ) diff --git a/third_party/java/hamcrest/BUILD b/third_party/java/hamcrest/BUILD index b6a0c70..ccc2f9c 100644 --- a/third_party/java/hamcrest/BUILD +++ b/third_party/java/hamcrest/BUILD @@ -20,6 +20,6 @@ package(default_visibility = ["//visibility:public"]) java_library( name = "hamcrest", - testonly = 1, + testonly = True, exports = ["@maven//:org_hamcrest_hamcrest_core"], ) diff --git a/third_party/java/junit/BUILD b/third_party/java/junit/BUILD index ea447dc..c1b3ec9 100644 --- a/third_party/java/junit/BUILD +++ b/third_party/java/junit/BUILD @@ -20,7 +20,7 @@ package(default_visibility = ["//visibility:public"]) java_library( name = "junit", - testonly = 1, + testonly = True, exports = ["@maven//:junit_junit"], runtime_deps = ["//third_party/java/hamcrest"], ) diff --git a/third_party/java/log4j/BUILD b/third_party/java/log4j/BUILD index c0a3f77..8a114ae 100644 --- a/third_party/java/log4j/BUILD +++ b/third_party/java/log4j/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# BUILD rules for https://logging.apache.org/log4j/1.2 +# BUILD rules for https://logging.apache.org/log4j/1.x/ load("@rules_java//java:defs.bzl", "java_library") diff --git a/third_party/java/mockito/BUILD b/third_party/java/mockito/BUILD index 0854543..86ea937 100644 --- a/third_party/java/mockito/BUILD +++ b/third_party/java/mockito/BUILD @@ -20,7 +20,7 @@ package(default_visibility = ["//visibility:public"]) java_library( name = "mockito", - testonly = 1, + testonly = True, exports = ["@maven//:org_mockito_mockito_core"], runtime_deps = [ "//third_party/java/byte_buddy", diff --git a/third_party/java/objenesis/BUILD b/third_party/java/objenesis/BUILD index e38c1ad..679bcaa 100644 --- a/third_party/java/objenesis/BUILD +++ b/third_party/java/objenesis/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# BUILD rules for https://github.com/mockito/mockito +# BUILD rules for https://objenesis.org/ load("@rules_java//java:defs.bzl", "java_library") @@ -20,6 +20,6 @@ package(default_visibility = ["//visibility:public"]) java_library( name = "objenesis", - testonly = 1, + testonly = True, exports = ["@maven//:org_objenesis_objenesis"], ) diff --git a/third_party/java/slf4j_api/BUILD b/third_party/java/slf4j_api/BUILD index 08230c8..79b33d5 100644 --- a/third_party/java/slf4j_api/BUILD +++ b/third_party/java/slf4j_api/BUILD @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# BUILD rules for org.slf4j:slf4j-api +# BUILD rules for https://www.slf4j.org/ load("@rules_java//java:defs.bzl", "java_library") diff --git a/third_party/java/truth/BUILD b/third_party/java/truth/BUILD index 9a471f6..6a8fcd1 100644 --- a/third_party/java/truth/BUILD +++ b/third_party/java/truth/BUILD @@ -20,7 +20,7 @@ package(default_visibility = ["//visibility:public"]) java_library( name = "truth", - testonly = 1, + testonly = True, exports = [ "@maven//:com_google_truth_extensions_truth_java8_extension", "@maven//:com_google_truth_truth",