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

Update bazel to use java 21. #4472

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 4 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ build --host_javacopt="-Xep:BetaApi:OFF"
build --incompatible_sandbox_hermetic_tmp

# Sets the JDK for compiling sources and executing tests.
build --java_language_version=18
build --tool_java_language_version=18
build --java_runtime_version=remotejdk_18
build --tool_java_runtime_version=remotejdk_18
build --java_language_version=21
build --tool_java_language_version=21
build --java_runtime_version=remotejdk_21
build --tool_java_runtime_version=remotejdk_21

# Default source/target versions.
build --javacopt="-source 8 -target 8"
Expand Down
9 changes: 7 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ bazel_skylib_workspace()
# Load rules_java repository
#############################

RULES_JAVA_VERSION = "7.12.1"

http_archive(
name = "rules_java",
sha256 = "c73336802d0b4882e40770666ad055212df4ea62cfa6edf9cb0f9d29828a0934",
url = "https://github.com/bazelbuild/rules_java/releases/download/5.3.5/rules_java-5.3.5.tar.gz",
urls = ["https://github.com/bazelbuild/rules_java/releases/download/%s/rules_java-%s.tar.gz" % (RULES_JAVA_VERSION, RULES_JAVA_VERSION)],
sha256 = "dfbadbb37a79eb9e1cc1e156ecb8f817edf3899b28bc02410a6c1eb88b1a6862",
)
load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
rules_java_dependencies()
rules_java_toolchains()

#############################
# Load Android Sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Description:
# ViewModelInject processor.
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@rules_java//java:defs.bzl", "java_plugin")

package(default_visibility = ["//:src"])
Expand Down
2 changes: 1 addition & 1 deletion java/dagger/hilt/processor/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Description:
# Internal code for implementing Hilt processors.

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@rules_java//java:defs.bzl", "java_library")

package(default_visibility = ["//:src"])
Expand Down
2 changes: 1 addition & 1 deletion java/dagger/hilt/processor/internal/root/ir/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# A library containing intermediate representations of the various Hilt
# aggregating annotations along with logic to process them.

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")

package(default_visibility = ["//:src"])

Expand Down
2 changes: 1 addition & 1 deletion java/dagger/lint/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Description:
# Dagger Lint Rules

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("//:build_defs.bzl", "POM_VERSION")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

Expand Down
2 changes: 1 addition & 1 deletion java/dagger/spi/model/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Description:
# Dagger's core APIs exposed for plugins

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")

package(default_visibility = [
# The dagger/spi should be the only direct dependent on this target.
Expand Down
2 changes: 1 addition & 1 deletion java/dagger/testing/compile/macros.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""Macros for building compiler tests."""

load("@rules_java//java:defs.bzl", "java_binary", "java_test")
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")

def compiler_test(name, size = "large", compiler_deps = None, **kwargs):
"""Generates a java_test that tests java compilation with the given compiler deps.
Expand Down
2 changes: 2 additions & 0 deletions javatests/dagger/functional/assisted/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ GenJavaTests(
srcs = ["AssistedFactoryAsQualifiedBindingTest.java"],
javacopts = DOCLINT_HTML_AND_SYNTAX,
test_only_deps = [
"//third_party/java/guava/collect", # TODO(b/): This shouldn't be needed.
"//:dagger_with_compiler",
"//third_party/java/truth",
"//third_party/java/junit",
Expand Down Expand Up @@ -114,6 +115,7 @@ GenJavaTests(
srcs = ["AssistedFactoryWithMultibindingsTest.java"],
javacopts = DOCLINT_HTML_AND_SYNTAX,
test_only_deps = [
"//third_party/java/guava/collect", # TODO(b/): This shouldn't be needed.
"//:dagger_with_compiler",
"//third_party/java/truth",
"//third_party/java/junit",
Expand Down
24 changes: 12 additions & 12 deletions javatests/dagger/functional/basic/BasicTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ public class BasicTest {
}

@Theory public void boxedPrimitives(BasicComponent basicComponent) {
assertThat(basicComponent.getBoxedByte()).isEqualTo(new Byte(BOUND_BYTE));
assertThat(basicComponent.getBoxedChar()).isEqualTo(new Character(BOUND_CHAR));
assertThat(basicComponent.getBoxedShort()).isEqualTo(new Short(BOUND_SHORT));
assertThat(basicComponent.getBoxedInt()).isEqualTo(new Integer(BOUND_INT));
assertThat(basicComponent.getBoxedLong()).isEqualTo(new Long(BOUND_LONG));
assertThat(basicComponent.getBoxedBoolean()).isEqualTo(new Boolean(BOUND_BOOLEAN));
assertThat(basicComponent.getBoxedByte()).isEqualTo(Byte.valueOf(BOUND_BYTE));
assertThat(basicComponent.getBoxedChar()).isEqualTo(Character.valueOf(BOUND_CHAR));
assertThat(basicComponent.getBoxedShort()).isEqualTo(Short.valueOf(BOUND_SHORT));
assertThat(basicComponent.getBoxedInt()).isEqualTo(Integer.valueOf(BOUND_INT));
assertThat(basicComponent.getBoxedLong()).isEqualTo(Long.valueOf(BOUND_LONG));
assertThat(basicComponent.getBoxedBoolean()).isEqualTo(Boolean.valueOf(BOUND_BOOLEAN));
assertThat(basicComponent.getBoxedFloat()).isEqualTo(BOUND_FLOAT);
assertThat(basicComponent.getBoxedDouble()).isEqualTo(BOUND_DOUBLE);
}

@Theory public void boxedPrimitiveProviders(BasicComponent basicComponent) {
assertThat(basicComponent.getByteProvider().get()).isEqualTo(new Byte(BOUND_BYTE));
assertThat(basicComponent.getCharProvider().get()).isEqualTo(new Character(BOUND_CHAR));
assertThat(basicComponent.getShortProvider().get()).isEqualTo(new Short(BOUND_SHORT));
assertThat(basicComponent.getIntProvider().get()).isEqualTo(new Integer(BOUND_INT));
assertThat(basicComponent.getLongProvider().get()).isEqualTo(new Long(BOUND_LONG));
assertThat(basicComponent.getBooleanProvider().get()).isEqualTo(new Boolean(BOUND_BOOLEAN));
assertThat(basicComponent.getByteProvider().get()).isEqualTo(Byte.valueOf(BOUND_BYTE));
assertThat(basicComponent.getCharProvider().get()).isEqualTo(Character.valueOf(BOUND_CHAR));
assertThat(basicComponent.getShortProvider().get()).isEqualTo(Short.valueOf(BOUND_SHORT));
assertThat(basicComponent.getIntProvider().get()).isEqualTo(Integer.valueOf(BOUND_INT));
assertThat(basicComponent.getLongProvider().get()).isEqualTo(Long.valueOf(BOUND_LONG));
assertThat(basicComponent.getBooleanProvider().get()).isEqualTo(Boolean.valueOf(BOUND_BOOLEAN));
assertThat(basicComponent.getFloatProvider().get()).isEqualTo(BOUND_FLOAT);
assertThat(basicComponent.getDoubleProvider().get()).isEqualTo(BOUND_DOUBLE);
}
Expand Down
2 changes: 1 addition & 1 deletion javatests/dagger/functional/kotlin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Description:
# Functional test code for Dagger-Android

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@rules_java//java:defs.bzl", "java_library")
load("//:test_defs.bzl", "GenJavaTests")

Expand Down
2 changes: 1 addition & 1 deletion javatests/dagger/functional/kotlin/processor/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@rules_java//java:defs.bzl", "java_plugin")

package(default_visibility = ["//:src"])
Expand Down
4 changes: 4 additions & 0 deletions javatests/dagger/functional/multibindings/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ GenJavaTests(
javacopts = DOCLINT_HTML_AND_SYNTAX + DOCLINT_REFERENCES,
deps = [
"//:dagger_with_compiler",
"//third_party/java/guava/collect", # TODO(b/): This shouldn't be needed.
"//third_party/java/junit",
"//third_party/java/truth",
],
Expand All @@ -85,6 +86,7 @@ GenJavaTests(
javacopts = DOCLINT_HTML_AND_SYNTAX + DOCLINT_REFERENCES,
deps = [
"//:dagger_with_compiler",
"//third_party/java/guava/collect", # TODO(b/): This shouldn't be needed.
"//third_party/java/junit",
"//third_party/java/truth",
],
Expand All @@ -97,6 +99,7 @@ GenJavaTests(
deps = [
"//:dagger_with_compiler",
"//third_party/java/auto:value",
"//third_party/java/guava/collect", # TODO(b/): This shouldn't be needed.
"//third_party/java/junit",
"//third_party/java/truth",
],
Expand All @@ -109,6 +112,7 @@ GenJavaTests(
deps = [
"//:dagger_with_compiler",
"//third_party/java/auto:value",
"//third_party/java/guava/collect", # TODO(b/): This shouldn't be needed.
"//third_party/java/junit",
"//third_party/java/truth",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Description:
# Tests for internal code for implementing Hilt processors.

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("//java/dagger/testing/compile:macros.bzl", "kt_compiler_test")

package(default_visibility = ["//:src"])
Expand Down
2 changes: 1 addition & 1 deletion javatests/dagger/internal/codegen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Description:
# Tests for the Dagger compiler/codegen

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@rules_java//java:defs.bzl", "java_library")
load("//:build_defs.bzl", "DOCLINT_HTML_AND_SYNTAX")
load("//:test_defs.bzl", "GenJavaTests")
Expand Down
2 changes: 1 addition & 1 deletion test_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
load("@rules_java//java:defs.bzl", "java_library", "java_test")
load("//:build_defs.bzl", "JAVA_RELEASE_MIN")
load(
"@io_bazel_rules_kotlin//kotlin:kotlin.bzl",
"@io_bazel_rules_kotlin//kotlin:jvm.bzl",
"kt_jvm_library",
"kt_jvm_test",
)
Expand Down
2 changes: 1 addition & 1 deletion third_party/kotlin/build_extensions/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

"""Convenience wrapper for kt_android_library."""

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", io_kt_android_library = "kt_android_library")
load("@io_bazel_rules_kotlin//kotlin:android.bzl", io_kt_android_library = "kt_android_library")

def kt_android_library(**kwargs):
io_kt_android_library(**kwargs)
Loading