Skip to content

Commit

Permalink
Unify toolchain to use graalvm everywhere
Browse files Browse the repository at this point in the history
Summary:
We have successfully switched from OpenJDK to GraalVM for running kotlincd and javacd actions in Buck2. GraalVM offers a smaller size, reducing download requirements on remote execution (RE), and it runs short-lived Java applications, like build actions, more efficiently.

In this update, we are standardizing our Buck toolchain to use GraalVM instead of JDK for all JVM-based build actions. This is a significant change across the board. Our toolchain allows users to provide their own java implementation, which can override the default GraalVM setup. This is the approach used in fbcode.

Reviewed By: IanChilds

Differential Revision: D67767200

fbshipit-source-id: 510f6378906eb339256974d3520096f2aaaf5ec2
  • Loading branch information
navidqar authored and facebook-github-bot committed Jan 3, 2025
1 parent 1e0e75f commit dcf6916
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions prelude/java/java_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ JavaToolchainInfo = provider(
"gen_class_to_source_map_debuginfo": provider_field(typing.Any, default = None), # optional
"gen_class_to_source_map_include_sourceless_compiled_packages": provider_field(typing.Any, default = None),
"global_code_config": provider_field(typing.Any, default = None),
"graalvm_java": provider_field(typing.Any, default = None),
"is_bootstrap_toolchain": provider_field(typing.Any, default = None),
"jar": provider_field(typing.Any, default = None),
"jar_builder": provider_field(typing.Any, default = None),
Expand All @@ -61,7 +60,6 @@ JavaToolchainInfo = provider(
"src_root_prefixes": provider_field(typing.Any, default = None),
"target_level": provider_field(typing.Any, default = None),
"track_class_usage": provider_field(bool, default = True),
"use_graalvm_java_for_javacd": provider_field(typing.Any, default = None),
"zip_scrubber": provider_field(typing.Any, default = None),
},
)
Expand Down
2 changes: 1 addition & 1 deletion prelude/java/javacd_jar_creator.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def create_jar_artifact_javacd(
compiler = java_toolchain.javac[DefaultInfo].default_outputs[0]
exe, local_only = prepare_cd_exe(
qualified_name,
java = java_toolchain.graalvm_java[RunInfo] if java_toolchain.use_graalvm_java_for_javacd else java_toolchain.java[RunInfo],
java = java_toolchain.java[RunInfo],
class_loader_bootstrapper = java_toolchain.class_loader_bootstrapper,
compiler = compiler,
main_class = java_toolchain.javacd_main_class,
Expand Down
2 changes: 1 addition & 1 deletion prelude/kotlin/kotlincd_jar_creator.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def create_jar_artifact_kotlincd(
compiler = kotlin_toolchain.kotlinc[DefaultInfo].default_outputs[0]
exe, local_only = prepare_cd_exe(
qualified_name,
java = java_toolchain.graalvm_java[RunInfo] if java_toolchain.use_graalvm_java_for_javacd else java_toolchain.java[RunInfo],
java = java_toolchain.java[RunInfo],
class_loader_bootstrapper = kotlin_toolchain.class_loader_bootstrapper,
compiler = compiler,
main_class = kotlin_toolchain.kotlincd_main_class,
Expand Down

0 comments on commit dcf6916

Please sign in to comment.