Skip to content

Commit e013f9a

Browse files
committed
Forecefully remove CC toolchain dependency for Slack
See: bazelbuild#281
1 parent 0663d0d commit e013f9a

File tree

2 files changed

+53
-52
lines changed

2 files changed

+53
-52
lines changed

rules/android_binary/attrs.bzl

+5-5
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ ATTRS = _attrs.replace(
201201
# This is for only generating proguard outputs when proguard_specs is not empty or of type select.
202202
_generate_proguard_outputs = attr.bool(),
203203
_enable_manifest_merging = attr.bool(default = True),
204-
_cc_toolchain_split = attr.label(
205-
cfg = android_split_transition,
206-
default = "@bazel_tools//tools/cpp:current_cc_toolchain",
207-
aspects = [split_config_aspect],
208-
),
204+
# _cc_toolchain_split = attr.label(
205+
# cfg = android_split_transition,
206+
# default = "@bazel_tools//tools/cpp:current_cc_toolchain",
207+
# aspects = [split_config_aspect],
208+
# ),
209209
_optimizing_dexer = attr.label(
210210
cfg = "exec",
211211
allow_single_file = True,

rules/native_deps.bzl

+48-47
Original file line numberDiff line numberDiff line change
@@ -72,53 +72,54 @@ def process(ctx, filename, merged_libraries_map = {}):
7272
native_libs_basename = None
7373
libs_name = None
7474
libs = dict()
75-
for key, deps in ctx.split_attr.deps.items():
76-
cc_toolchain_dep = ctx.split_attr._cc_toolchain_split[key]
77-
cc_toolchain = cc_toolchain_dep[cc_common.CcToolchainInfo]
78-
build_config = cc_toolchain_dep[SplitConfigInfo].build_config
79-
libs_dir_name = _get_libs_dir_name(
80-
cc_toolchain_dep[SplitConfigInfo].target_platform,
81-
)
82-
linker_input = cc_common.create_linker_input(
83-
owner = ctx.label,
84-
user_link_flags = ["-Wl,-soname=lib" + target_name],
85-
)
86-
cc_info = cc_common.merge_cc_infos(
87-
cc_infos = _concat(
88-
[CcInfo(linking_context = cc_common.create_linking_context(
89-
linker_inputs = depset([linker_input]),
90-
))],
91-
[dep[JavaInfo].cc_link_params_info for dep in deps if JavaInfo in dep],
92-
[dep[AndroidCcLinkParamsInfo].link_params for dep in deps if AndroidCcLinkParamsInfo in dep],
93-
[dep[CcInfo] for dep in deps if CcInfo in dep],
94-
),
95-
)
96-
new_libraries = []
97-
stub_libraries = []
98-
if merged_libraries_map:
99-
new_libraries.extend(merged_libraries_map[key].new_libraries)
100-
stub_libraries.extend(merged_libraries_map[key].stub_libraries)
101-
102-
native_deps_lib = _link_native_deps_if_present(ctx, cc_info, cc_toolchain, build_config, target_name)
103-
if native_deps_lib:
104-
new_libraries.append(native_deps_lib)
105-
native_libs_basename = native_deps_lib.basename
106-
107-
shared_libs = _collect_unique_shared_libs(
108-
new_libraries,
109-
stub_libraries,
110-
cc_info,
111-
)
112-
113-
if shared_libs:
114-
libs[libs_dir_name] = depset(shared_libs)
115-
116-
if libs and native_libs_basename:
117-
libs_name = ctx.actions.declare_file("nativedeps_filename/" + target_name + "/" + filename)
118-
ctx.actions.write(output = libs_name, content = native_libs_basename)
119-
120-
transitive_native_libs = _get_transitive_native_libs(ctx)
121-
return AndroidBinaryNativeLibsInfo(libs, libs_name, transitive_native_libs)
75+
return AndroidBinaryNativeLibsInfo(libs, libs_name, depset([]))
76+
# for key, deps in ctx.split_attr.deps.items():
77+
# # cc_toolchain_dep = ctx.split_attr._cc_toolchain_split[key]
78+
# # cc_toolchain = cc_toolchain_dep[cc_common.CcToolchainInfo]
79+
# # build_config = cc_toolchain_dep[SplitConfigInfo].build_config
80+
# # libs_dir_name = _get_libs_dir_name(
81+
# # cc_toolchain_dep[SplitConfigInfo].target_platform,
82+
# # )
83+
# linker_input = cc_common.create_linker_input(
84+
# owner = ctx.label,
85+
# user_link_flags = ["-Wl,-soname=lib" + target_name],
86+
# )
87+
# cc_info = cc_common.merge_cc_infos(
88+
# cc_infos = _concat(
89+
# [CcInfo(linking_context = cc_common.create_linking_context(
90+
# linker_inputs = depset([linker_input]),
91+
# ))],
92+
# [dep[JavaInfo].cc_link_params_info for dep in deps if JavaInfo in dep],
93+
# [dep[AndroidCcLinkParamsInfo].link_params for dep in deps if AndroidCcLinkParamsInfo in dep],
94+
# [dep[CcInfo] for dep in deps if CcInfo in dep],
95+
# ),
96+
# )
97+
# new_libraries = []
98+
# stub_libraries = []
99+
# if merged_libraries_map:
100+
# new_libraries.extend(merged_libraries_map[key].new_libraries)
101+
# stub_libraries.extend(merged_libraries_map[key].stub_libraries)
102+
103+
# native_deps_lib = _link_native_deps_if_present(ctx, cc_info, cc_toolchain, build_config, target_name)
104+
# if native_deps_lib:
105+
# new_libraries.append(native_deps_lib)
106+
# native_libs_basename = native_deps_lib.basename
107+
108+
# shared_libs = _collect_unique_shared_libs(
109+
# new_libraries,
110+
# stub_libraries,
111+
# cc_info,
112+
# )
113+
114+
# # if shared_libs:
115+
# # libs[libs_dir_name] = depset(shared_libs)
116+
117+
# if libs and native_libs_basename:
118+
# libs_name = ctx.actions.declare_file("nativedeps_filename/" + target_name + "/" + filename)
119+
# ctx.actions.write(output = libs_name, content = native_libs_basename)
120+
121+
# transitive_native_libs = _get_transitive_native_libs(ctx)
122+
# return AndroidBinaryNativeLibsInfo(libs, libs_name, transitive_native_libs)
122123

123124
# Collect all native shared libraries across split transitions. Some AARs
124125
# contain shared libraries across multiple architectures, e.g. x86 and

0 commit comments

Comments
 (0)