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

DO_NOT_SUBMIT: Do not provide CrateInfo from staticlib/cdylib #1219

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions rust/private/rust.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def _rust_library_common(ctx, crate_type):
# deterministic name is important since it ends up embedded in the executable. This is problematic when one needs
# to include the library with a specific filename into a larger application.
# (see https://github.com/bazelbuild/rules_rust/issues/405#issuecomment-993089889 for more details)
if crate_type != "cdylib":
if crate_type not in ["cdylib", "staticlib"]:
output_hash = determine_output_hash(crate_root, ctx.label)
else:
output_hash = None
Expand Down Expand Up @@ -731,7 +731,7 @@ rust_library = rule(

rust_static_library = rule(
implementation = _rust_static_library_impl,
provides = _common_providers,
provides = [CcInfo],
attrs = dict(_common_attrs.items()),
fragments = ["cpp"],
host_fragments = ["cpp"],
Expand All @@ -755,7 +755,7 @@ rust_static_library = rule(

rust_shared_library = rule(
implementation = _rust_shared_library_impl,
provides = _common_providers,
provides = [CcInfo],
attrs = dict(_common_attrs.items()),
fragments = ["cpp"],
host_fragments = ["cpp"],
Expand Down
5 changes: 3 additions & 2 deletions rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -967,15 +967,16 @@ def rustc_compile_action(
out_binary = getattr(attr, "out_binary", False)

providers = [
crate_info,
dep_info,
DefaultInfo(
# nb. This field is required for cc_library to depend on our output.
files = depset(outputs),
runfiles = runfiles,
executable = crate_info.output if crate_info.type == "bin" or crate_info.is_test or out_binary else None,
),
]
if crate_info.type not in ["cdylib", "staticlib"]:
providers.append(crate_info)
providers.append(dep_info)
if toolchain.target_arch != "wasm32":
providers += establish_cc_info(ctx, attr, crate_info, toolchain, cc_toolchain, feature_configuration, interface_library)
if pdb_file:
Expand Down