Skip to content

Commit

Permalink
Pass through allow_cache_upload in cxx library
Browse files Browse the repository at this point in the history
Summary: WhatsApp cxx library rules do not run on RE right now because it uses toolchains from NDK installed locally. This diff passes through allow_cache_upload which allows cxx library to be uploaded to RE cache.

Differential Revision: D53033381

fbshipit-source-id: 8b6c7fc100fc0b76bdb4fbb0e2a208b62a05b2f8
  • Loading branch information
lty1308 authored and facebook-github-bot committed Jan 24, 2024
1 parent 18feaf2 commit 0723f68
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion prelude/cxx/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ def create_compile_cmds(
def compile_cxx(
ctx: AnalysisContext,
src_compile_cmds: list[CxxSrcCompileCommand],
pic: bool = False) -> list[CxxCompileOutput]:
pic: bool = False,
allow_cache_upload: bool = False) -> list[CxxCompileOutput]:
"""
For a given list of src_compile_cmds, generate output artifacts.
"""
Expand Down Expand Up @@ -461,6 +462,7 @@ def compile_cxx(
category = src_compile_cmd.cxx_compile_cmd.category,
identifier = identifier,
dep_files = action_dep_files,
allow_cache_upload = allow_cache_upload,
)

# If we're building with split debugging, where the debug info is in the
Expand Down
4 changes: 2 additions & 2 deletions prelude/cxx/cxx_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -906,12 +906,12 @@ def cxx_compile_srcs(
)

# Define object files.
pic_cxx_outs = compile_cxx(ctx, compile_cmd_output.src_compile_cmds, pic = True)
pic_cxx_outs = compile_cxx(ctx, compile_cmd_output.src_compile_cmds, pic = True, allow_cache_upload = ctx.attrs.allow_cache_upload)
pic = _get_library_compile_output(ctx, pic_cxx_outs, impl_params.extra_link_input)

non_pic = None
if preferred_linkage != Linkage("shared"):
non_pic_cxx_outs = compile_cxx(ctx, compile_cmd_output.src_compile_cmds, pic = False)
non_pic_cxx_outs = compile_cxx(ctx, compile_cmd_output.src_compile_cmds, pic = False, allow_cache_upload = ctx.attrs.allow_cache_upload)
non_pic = _get_library_compile_output(ctx, non_pic_cxx_outs, impl_params.extra_link_input)

return _CxxCompiledSourcesOutput(
Expand Down
3 changes: 2 additions & 1 deletion prelude/decls/cxx_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,8 @@ cxx_library = prelude_rule(
"weak_framework_names": attrs.list(attrs.string(), default = []),
"xcode_private_headers_symlinks": attrs.option(attrs.bool(), default = None),
"xcode_public_headers_symlinks": attrs.option(attrs.bool(), default = None),
}
} |
buck.allow_cache_upload_arg()
),
)

Expand Down
3 changes: 2 additions & 1 deletion prelude/decls/go_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ cgo_library = prelude_rule(
"thin_lto": attrs.bool(default = False),
"version_universe": attrs.option(attrs.string(), default = None),
"weak_framework_names": attrs.list(attrs.string(), default = []),
}
} |
buck.allow_cache_upload_arg()
),
)

Expand Down
6 changes: 4 additions & 2 deletions prelude/decls/ios_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ apple_library = prelude_rule(
"uses_modules": attrs.bool(default = False),
"xcode_private_headers_symlinks": attrs.option(attrs.bool(), default = None),
"xcode_public_headers_symlinks": attrs.option(attrs.bool(), default = None),
}
} |
buck.allow_cache_upload_arg()
),
)

Expand Down Expand Up @@ -781,7 +782,8 @@ apple_test = prelude_rule(
"xcode_private_headers_symlinks": attrs.option(attrs.bool(), default = None),
"xcode_product_type": attrs.option(attrs.string(), default = None),
"xcode_public_headers_symlinks": attrs.option(attrs.bool(), default = None),
}
} |
buck.allow_cache_upload_arg()
),
)

Expand Down

0 comments on commit 0723f68

Please sign in to comment.