Skip to content

Commit

Permalink
buck2-ocaml: Don't link when generating IDE support files
Browse files Browse the repository at this point in the history
Summary:
it's faster!

see fb-only section for more context

Reviewed By: ndmitchell

Differential Revision: D52840634

fbshipit-source-id: 0ccfe7ff409467bc906241982737065f1296da8a
  • Loading branch information
mheiber authored and facebook-github-bot committed Jan 18, 2024
1 parent 5b21491 commit 5faaeef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 3 additions & 5 deletions prelude/ocaml/ocaml.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ load("@prelude//utils:graph_utils.bzl", "breadth_first_traversal", "post_order_t
load("@prelude//utils:platform_flavors_util.bzl", "by_platform")
load("@prelude//utils:utils.bzl", "filter_and_map_idx", "flatten")
load(":makefile.bzl", "parse_makefile")
load(":ocaml_toolchain_types.bzl", "OCamlLibraryInfo", "OCamlLinkInfo", "OCamlToolchainInfo", "OtherOutputsInfo", "merge_ocaml_link_infos", "merge_other_outputs_info")
load(":ocaml_toolchain_types.bzl", "OCamlLibraryInfo", "OCamlLinkInfo", "OCamlToolchainInfo", "OcamlIdeInfo", "OtherOutputsInfo", "merge_ocaml_link_infos", "merge_other_outputs_info")

BuildMode = enum("native", "bytecode", "expand")

Expand Down Expand Up @@ -688,9 +688,8 @@ def ocaml_library_impl(ctx: AnalysisContext) -> list[Provider]:
other_outputs_info = merge_other_outputs_info(ctx, other_outputs, _attr_deps_other_outputs_infos(ctx))

info_ide = [
DefaultInfo(
default_output = cmxa,
other_outputs = [cmd_args(other_outputs_info.info.project_as_args("ide"))],
OcamlIdeInfo(
outputs = [cmd_args(other_outputs_info.info.project_as_args("ide"))],
),
]
info_byt = [
Expand Down Expand Up @@ -784,7 +783,6 @@ def ocaml_binary_impl(ctx: AnalysisContext) -> list[Provider]:

info_ide = [
DefaultInfo(
default_output = binary_nat,
other_outputs = [cmd_args(other_outputs_info.info.project_as_args("ide"))],
),
]
Expand Down
6 changes: 6 additions & 0 deletions prelude/ocaml/ocaml_toolchain_types.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ OCamlLinkInfo = provider(
fields = {"info": provider_field(typing.Any, default = None)},
)

OcamlIdeInfo = provider(
fields = {
"outputs": provider_field(typing.Any, default = []),
},
)

# A record of an OCaml library.
OCamlLibraryInfo = record(
# The library target name: e.g. "`foo`"
Expand Down

0 comments on commit 5faaeef

Please sign in to comment.