Skip to content

Commit

Permalink
Update to latest bazel-common that has a newer android API level, so …
Browse files Browse the repository at this point in the history
…it works on the latest macos on github. Also update to the latest Bazel version that supports JavaInfo rule imports, and fix things that break w/ the latest bazel version (requiring imports for defining package statements if a package_info.java exists, and not using `@local_jdk//:jar`).

PiperOrigin-RevId: 631081930
  • Loading branch information
sameb authored and Guice Team committed May 6, 2024
1 parent 1561d4a commit 1701108
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: continuous-integration
env:
USE_BAZEL_VERSION: '6.2.0'
USE_BAZEL_VERSION: '7.1.1'
USE_JAVA_DISTRIBUTION: 'zulu'
USE_JAVA_VERSION: '11'

Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ load("@rules_jvm_external//:specs.bzl", "maven")

http_archive(
name = "google_bazel_common",
sha256 = "82a49fb27c01ad184db948747733159022f9464fc2e62da996fa700594d9ea42",
strip_prefix = "bazel-common-2a6b6406e12208e02b2060df0631fb30919080f3",
urls = ["https://github.com/google/bazel-common/archive/2a6b6406e12208e02b2060df0631fb30919080f3.zip"],
sha256 = "cba2aff0fb5e64dae880c8e1ead1b8d414a12b8e924315fac1a067de78a65e81",
strip_prefix = "bazel-common-d59d067c04e973f3c4aa34f6628bed97d6664c3c",
urls = ["https://github.com/google/bazel-common/archive/d59d067c04e973f3c4aa34f6628bed97d6664c3c.zip"],
)

load("@google_bazel_common//:workspace_defs.bzl", "google_common_workspace_rules")
Expand Down
4 changes: 4 additions & 0 deletions core/test/com/google/inject/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ guice_test_suites(
deps = [
":add_opens_tests",
":tests",
"//core/src/com/google/inject", # bazel requires this b/c of package_info.java
],
)

Expand All @@ -121,6 +122,7 @@ guice_test_suites(
deps = [
":add_opens_tests",
":tests",
"//core/src/com/google/inject", # bazel requires this b/c of package_info.java
],
)

Expand All @@ -142,6 +144,7 @@ guice_test_suites(
deps = [
":add_opens_tests",
":tests",
"//core/src/com/google/inject", # bazel requires this b/c of package_info.java
],
) for include_stack_trace_option in [
"OFF",
Expand All @@ -165,6 +168,7 @@ guice_test_suites(
deps = [
":add_opens_tests",
":tests",
"//core/src/com/google/inject", # bazel requires this b/c of package_info.java
],
) for custom_class_loading_option in [
"OFF",
Expand Down
4 changes: 3 additions & 1 deletion core/test/com/googlecode/guice/BytecodeGenTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ protected Class<?> loadClass(final String name, final boolean resolve)
// standard bootdelegation of java.*
return super.loadClass(name, resolve);

} else if (!name.contains(".internal.")) {
} else if (!name.contains(".internal.") || name.contains("InternalFlags")) {
// Note: the !!contains(InternalFlags) shouldn't be necessary,
// but Bazel 7.1.1 w/ JDK11 seems to have a weird classloader that causes issues w/o it.

/*
* load public and test classes directly from the classpath - we don't
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ java_library(
guice_test_suites(
name = "gen_tests",
sizes = ["small"],
deps = [":tests"],
deps = [
":tests",
"//extensions/assistedinject/src/com/google/inject/assistedinject", # bazel requires this b/c of package_info.java
],
)

[guice_test_suites(
Expand All @@ -59,7 +62,10 @@ guice_test_suites(
"small",
],
suffix = "_stack_trace_%s" % include_stack_trace_option,
deps = [":tests"],
deps = [
":tests",
"//extensions/assistedinject/src/com/google/inject/assistedinject", # bazel requires this b/c of package_info.java
],
) for include_stack_trace_option in [
"OFF",
]]
Expand All @@ -69,7 +75,10 @@ guice_test_suites(
srcs = ["subpkg/SubpackageTestPrivateFallbackOnly.java"],
sizes = ["small"],
suffix = "SubpackageTestPrivateFallbackOnly",
deps = [":SubpackageTestPrivateFallbackOnly"],
deps = [
":SubpackageTestPrivateFallbackOnly",
"//extensions/assistedinject/src/com/google/inject/assistedinject", # bazel requires this b/c of package_info.java
],
)

[guice_test_suites(
Expand All @@ -82,7 +91,10 @@ guice_test_suites(
"small",
],
suffix = "_SubpackageTestPrivateFallbackOnly_stack_trace_%s" % include_stack_trace_option,
deps = [":SubpackageTestPrivateFallbackOnly"],
deps = [
":SubpackageTestPrivateFallbackOnly",
"//extensions/assistedinject/src/com/google/inject/assistedinject", # bazel requires this b/c of package_info.java
],
) for include_stack_trace_option in [
"OFF",
]]
10 changes: 8 additions & 2 deletions extensions/persist/test/com/google/inject/persist/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ guice_test_suites(
"small",
"medium",
],
deps = [":tests"],
deps = [
":tests",
"//extensions/persist/src/com/google/inject/persist", # bazel requires this b/c of package_info.java
],
)

[guice_test_suites(
Expand All @@ -52,7 +55,10 @@ guice_test_suites(
"medium",
],
suffix = "_stack_trace_%s" % include_stack_trace_option,
deps = [":tests"],
deps = [
":tests",
"//extensions/persist/src/com/google/inject/persist", # bazel requires this b/c of package_info.java
],
) for include_stack_trace_option in [
"OFF",
]]
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ genrule(
name = "metainf",
srcs = glob(["META-INF/*"]),
outs = ["jpa-manifest.jar"],
cmd = "$(location @local_jdk//:jar) cvf $@ -C " +
cmd = "$(JAVABASE)/bin/jar cvf $@ -C " +
"extensions/persist/test/com/google/inject/persist/config META-INF",
tools = ["@local_jdk//:jar"],
toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
tools = ["@bazel_tools//tools/jdk:current_java_runtime"],
)
10 changes: 8 additions & 2 deletions extensions/servlet/test/com/google/inject/servlet/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ guice_test_suites(
"small",
"medium",
],
deps = [":tests"],
deps = [
":tests",
"//extensions/servlet/src/com/google/inject/servlet", # bazel requires this b/c of package_info.java
],
)

[guice_test_suites(
Expand All @@ -42,7 +45,10 @@ guice_test_suites(
"medium",
],
suffix = "_stack_trace_%s" % include_stack_trace_option,
deps = [":tests"],
deps = [
":tests",
"//extensions/servlet/src/com/google/inject/servlet", # bazel requires this b/c of package_info.java
],
) for include_stack_trace_option in [
"OFF",
]]
10 changes: 8 additions & 2 deletions extensions/spring/test/com/google/inject/spring/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ java_library(
guice_test_suites(
name = "gen_tests",
sizes = ["small"],
deps = [":tests"],
deps = [
":tests",
"//extensions/spring/src/com/google/inject/spring", # bazel requires this b/c of package_info.java
],
)

[guice_test_suites(
Expand All @@ -31,7 +34,10 @@ guice_test_suites(
"small",
],
suffix = "_stack_trace_%s" % include_stack_trace_option,
deps = [":tests"],
deps = [
":tests",
"//extensions/spring/src/com/google/inject/spring", # bazel requires this b/c of package_info.java
],
) for include_stack_trace_option in [
"OFF",
]]
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ java_library(
guice_test_suites(
name = "gen_tests",
sizes = ["small"],
deps = [":tests"],
deps = [
":tests",
"//extensions/throwingproviders/src/com/google/inject/throwingproviders", # bazel requires this b/c of package_info.java
],
)

[guice_test_suites(
Expand All @@ -35,7 +38,10 @@ guice_test_suites(
"small",
],
suffix = "_stack_trace_%s" % include_stack_trace_option,
deps = [":tests"],
deps = [
":tests",
"//extensions/throwingproviders/src/com/google/inject/throwingproviders", # bazel requires this b/c of package_info.java
],
) for include_stack_trace_option in [
"OFF",
]]

0 comments on commit 1701108

Please sign in to comment.