Skip to content

Commit

Permalink
Replace run_tests script with actual build tests.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 682478434
  • Loading branch information
chaoren authored and Google Java Core Libraries committed Oct 4, 2024
1 parent e2204d6 commit 46b374c
Show file tree
Hide file tree
Showing 31 changed files with 256 additions and 47 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,4 +24,4 @@ jobs:
bazel-
- name: 'Test'
shell: bash
run: ./run_tests.sh
run: bazelisk test --lockfile_mode=error --test_output=errors //...
27 changes: 0 additions & 27 deletions run_tests.sh

This file was deleted.

7 changes: 7 additions & 0 deletions third_party/java/apache_bcel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# BUILD rules for https://commons.apache.org/proper/commons-bcel/

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])
Expand All @@ -22,3 +23,9 @@ java_library(
name = "apache_bcel",
exports = ["@maven//:org_apache_bcel_bcel"],
)

build_test(
name = "build_test",
targets = [":apache_bcel"],
visibility = ["//visibility:private"],
)
11 changes: 11 additions & 0 deletions third_party/java/asm/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# BUILD rules for http://asm.ow2.org/

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])
Expand All @@ -32,3 +33,13 @@ java_library(
name = "asm-commons",
exports = ["@maven//:org_ow2_asm_asm_commons"],
)

build_test(
name = "build_test",
targets = [
":asm",
":asm-tree",
":asm-commons",
],
visibility = ["//visibility:private"],
)
19 changes: 18 additions & 1 deletion third_party/java/auto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# BUILD rules for https://github.com/google/auto

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library", "java_plugin")

package(default_visibility = ["//visibility:public"])
Expand Down Expand Up @@ -75,7 +76,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 = [
Expand Down Expand Up @@ -112,3 +113,19 @@ java_library(
tags = ["maven:compile_only"],
exports = ["@maven//:com_google_auto_service_auto_service_annotations"],
)

build_test(
name = "build_test",
targets = [
":common",
":auto_value_processor",
":auto_annotation_processor",
":auto_oneof_processor",
":value",
":auto_factory_processor",
":factory",
":auto_service_processor",
":service",
],
visibility = ["//visibility:private"],
)
11 changes: 9 additions & 2 deletions third_party/java/byte_buddy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
# 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("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])

java_library(
name = "byte_buddy",
testonly = 1,
testonly = True,
exports = ["@maven//:net_bytebuddy_byte_buddy"],
)

build_test(
name = "build_test",
targets = [":byte_buddy"],
visibility = ["//visibility:private"],
)
11 changes: 9 additions & 2 deletions third_party/java/byte_buddy_agent/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
# 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("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])

java_library(
name = "byte_buddy_agent",
testonly = 1,
testonly = True,
exports = ["@maven//:net_bytebuddy_byte_buddy_agent"],
)

build_test(
name = "build_test",
targets = [":byte_buddy_agent"],
visibility = ["//visibility:private"],
)
7 changes: 7 additions & 0 deletions third_party/java/checker_framework/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# BUILD rules for https://checkerframework.org/

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])
Expand All @@ -26,3 +27,9 @@ java_library(
"@maven//:org_checkerframework_javacutil",
],
)

build_test(
name = "build_test",
targets = [":dataflow"],
visibility = ["//visibility:private"],
)
7 changes: 7 additions & 0 deletions third_party/java/checker_framework_annotations/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# BUILD rules for https://checkerframework.org/

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])
Expand All @@ -22,3 +23,9 @@ java_library(
name = "checker_framework_annotations",
exports = ["@maven//:org_checkerframework_checker_compat_qual"],
)

build_test(
name = "build_test",
targets = [":checker_framework_annotations"],
visibility = ["//visibility:private"],
)
9 changes: 8 additions & 1 deletion third_party/java/compile_testing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@

# BUILD rules for https://github.com/google/compile-testing

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

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",
Expand All @@ -36,3 +37,9 @@ java_library(
"//third_party/java/truth",
],
)

build_test(
name = "build_test",
targets = [":compile_testing"],
visibility = ["//visibility:private"],
)
9 changes: 8 additions & 1 deletion third_party/java/diffutils/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
# 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("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])
Expand All @@ -22,3 +23,9 @@ java_library(
name = "diffutils",
exports = ["@maven//:com_googlecode_java_diff_utils_diffutils"],
)

build_test(
name = "build_test",
targets = [":diffutils"],
visibility = ["//visibility:private"],
)
11 changes: 11 additions & 0 deletions third_party/java/error_prone/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# applies the Error Prone compiler to all java compilations - this package exports
# dependencies for Error Prone's libraries

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])
Expand Down Expand Up @@ -45,3 +46,13 @@ java_library(
"//third_party/java/jsr305_annotations",
],
)

build_test(
name = "build_test",
targets = [
":annotations",
":error_prone_javac",
":check_api",
],
visibility = ["//visibility:private"],
)
7 changes: 7 additions & 0 deletions third_party/java/google_java_format/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# BUILD rules for https://github.com/google/google-java-format

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])
Expand All @@ -26,3 +27,9 @@ java_library(
"//third_party/java/guava",
],
)

build_test(
name = "build_test",
targets = [":google_java_format"],
visibility = ["//visibility:private"],
)
15 changes: 15 additions & 0 deletions third_party/java/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# BUILD rules for https://github.com/grpc/grpc-java

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])
Expand Down Expand Up @@ -52,3 +53,17 @@ java_library(
name = "stub",
exports = ["@maven//:io_grpc_grpc_stub"],
)

build_test(
name = "build_test",
targets = [
":grpc",
":api",
":core",
":netty",
":context",
":protobuf",
":stub",
],
visibility = ["//visibility:private"],
)
13 changes: 12 additions & 1 deletion third_party/java/guava/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# BUILD rules for https://github.com/google/guava

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library", "java_plugin")

package(default_visibility = ["//visibility:public"])
Expand All @@ -29,7 +30,7 @@ java_library(

java_library(
name = "testlib",
testonly = 1,
testonly = True,
exports = ["@maven//:com_google_guava_guava_testlib"],
runtime_deps = [":guava"],
)
Expand All @@ -39,3 +40,13 @@ java_plugin(
visibility = ["//visibility:private"],
deps = ["@maven//:com_google_guava_guava_beta_checker"],
)

build_test(
name = "build_test",
targets = [
":guava",
":testlib",
":beta-checker",
],
visibility = ["//visibility:private"],
)
9 changes: 8 additions & 1 deletion third_party/java/hamcrest/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@

# BUILD rules for https://github.com/hamcrest/JavaHamcrest

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//visibility:public"])

java_library(
name = "hamcrest",
testonly = 1,
testonly = True,
exports = ["@maven//:org_hamcrest_hamcrest_core"],
)

build_test(
name = "build_test",
targets = [":hamcrest"],
visibility = ["//visibility:private"],
)
10 changes: 10 additions & 0 deletions third_party/java/incap/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# BUILD rules for https://github.com/tbroyer/gradle-incap-helper

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_java//java:defs.bzl", "java_library", "java_plugin")

package(default_visibility = ["//visibility:public"])
Expand All @@ -33,3 +34,12 @@ java_plugin(
"@maven//:net_ltgt_gradle_incap_incap_processor",
],
)

build_test(
name = "build_test",
targets = [
":incap",
":processor",
],
visibility = ["//visibility:private"],
)
Loading

0 comments on commit 46b374c

Please sign in to comment.