From 5faaeefde6c7dada2d0ed54a08bd1ad1f4ad6c61 Mon Sep 17 00:00:00 2001 From: Maxwell Heiber Date: Thu, 18 Jan 2024 05:53:54 -0800 Subject: [PATCH] buck2-ocaml: Don't link when generating IDE support files Summary: it's faster! see fb-only section for more context Reviewed By: ndmitchell Differential Revision: D52840634 fbshipit-source-id: 0ccfe7ff409467bc906241982737065f1296da8a --- prelude/ocaml/ocaml.bzl | 8 +++----- prelude/ocaml/ocaml_toolchain_types.bzl | 6 ++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/prelude/ocaml/ocaml.bzl b/prelude/ocaml/ocaml.bzl index abd652b8..99694ff4 100644 --- a/prelude/ocaml/ocaml.bzl +++ b/prelude/ocaml/ocaml.bzl @@ -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") @@ -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 = [ @@ -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"))], ), ] diff --git a/prelude/ocaml/ocaml_toolchain_types.bzl b/prelude/ocaml/ocaml_toolchain_types.bzl index de38f9e8..f301a29d 100644 --- a/prelude/ocaml/ocaml_toolchain_types.bzl +++ b/prelude/ocaml/ocaml_toolchain_types.bzl @@ -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`"