Skip to content

Commit 55316cf

Browse files
committed
Merge numerous abseil-cpp-tstring sublibraries to ease unbundling
commit_hash:257c1f495ecb3aac071ea951e8384c5b7d0a5251
1 parent f973252 commit 55316cf

File tree

73 files changed

+3585
-1376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3585
-1376
lines changed

contrib/libs/grpc/.yandex_meta/__init__.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ def fix_ssl_certificates():
4444
m.SRCS.add("src/core/lib/security/security_connector/add_arcadia_root_certs.cpp")
4545
m.PEERDIR |= {"certs", "library/cpp/resource"}
4646

47-
# in the name of selective checkout
48-
# https://st.yandex-team.ru/DTCC-615
49-
def fix_selective_checkout():
50-
self.yamakes["."].PEERDIR |= {
51-
"contrib/restricted/abseil-cpp-tstring/y_absl/algorithm",
52-
"contrib/restricted/abseil-cpp-tstring/y_absl/functional",
53-
"contrib/restricted/abseil-cpp-tstring/y_absl/memory",
54-
"contrib/restricted/abseil-cpp-tstring/y_absl/meta",
55-
"contrib/restricted/abseil-cpp-tstring/y_absl/hash",
56-
"contrib/restricted/abseil-cpp-tstring/y_absl/utility",
57-
}
58-
5947
for name, m in self.yamakes.items():
6048
with m:
6149
fix_protos(m)
@@ -78,7 +66,6 @@ def fix_selective_checkout():
7866
m.NO_UTIL = False
7967

8068
fix_ssl_certificates()
81-
fix_selective_checkout()
8269

8370
# remove unnecessary folder with protos duplicates
8471
shutil.rmtree(f"{self.dstdir}/protos")

contrib/libs/grpc/grpc++_reflection/ya.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PEERDIR(
1414
contrib/libs/grpc/third_party/address_sorting
1515
contrib/libs/grpc/third_party/upb
1616
contrib/libs/protobuf
17-
contrib/restricted/abseil-cpp-tstring/y_absl/synchronization
17+
contrib/restricted/abseil-cpp-tstring
1818
)
1919

2020
ADDINCL(

contrib/libs/grpc/grpcpp_channelz/ya.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ PEERDIR(
1414
contrib/libs/grpc/third_party/address_sorting
1515
contrib/libs/grpc/third_party/upb
1616
contrib/libs/protobuf
17-
contrib/restricted/abseil-cpp-tstring/y_absl/synchronization
17+
contrib/restricted/abseil-cpp-tstring
1818
)
1919

2020
ADDINCL(

contrib/libs/grpc/ya.make

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,7 @@ PEERDIR(
2323
contrib/libs/re2
2424
contrib/libs/xxhash
2525
contrib/libs/zlib
26-
contrib/restricted/abseil-cpp-tstring/y_absl/algorithm
27-
contrib/restricted/abseil-cpp-tstring/y_absl/base
28-
contrib/restricted/abseil-cpp-tstring/y_absl/container
29-
contrib/restricted/abseil-cpp-tstring/y_absl/flags
30-
contrib/restricted/abseil-cpp-tstring/y_absl/functional
31-
contrib/restricted/abseil-cpp-tstring/y_absl/hash
32-
contrib/restricted/abseil-cpp-tstring/y_absl/memory
33-
contrib/restricted/abseil-cpp-tstring/y_absl/meta
34-
contrib/restricted/abseil-cpp-tstring/y_absl/random
35-
contrib/restricted/abseil-cpp-tstring/y_absl/status
36-
contrib/restricted/abseil-cpp-tstring/y_absl/strings
37-
contrib/restricted/abseil-cpp-tstring/y_absl/synchronization
38-
contrib/restricted/abseil-cpp-tstring/y_absl/time
39-
contrib/restricted/abseil-cpp-tstring/y_absl/utility
26+
contrib/restricted/abseil-cpp-tstring
4027
library/cpp/resource
4128
)
4229

contrib/libs/protobuf/.yandex_meta/__init__.py

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,6 @@ def post_install(self):
148148

149149
libprotobuf.PEERDIR.add("library/cpp/sanitizer/include")
150150

151-
# Dont use full y_absl library
152-
# fmt: off
153-
libprotobuf.PEERDIR = set([
154-
lib for lib in libprotobuf.PEERDIR
155-
if 'abseil-cpp-tstring' not in lib
156-
])
157-
# fmt: on
158-
libprotobuf.PEERDIR.add("contrib/restricted/abseil-cpp-tstring/y_absl/status")
159-
libprotobuf.PEERDIR.add("contrib/restricted/abseil-cpp-tstring/y_absl/log")
160-
161151
del self.yamakes["src/google/protobuf/compiler"]
162152
# merging src/google/protobuf/compiler/protoc library and
163153
# src/google/protobuf/compiler binary into top-level binary
@@ -168,25 +158,26 @@ def post_install(self):
168158
libprotoc.after("LICENSE", "LICENSE_TEXTS(.yandex_meta/licenses.list.txt)\n")
169159
libprotoc.after(
170160
"ORIGINAL_SOURCE",
171-
"""IF (OPENSOURCE_REPLACE_PROTOBUF AND EXPORT_CMAKE)
172-
173-
OPENSOURCE_EXPORT_REPLACEMENT(
174-
CMAKE Protobuf
175-
CMAKE_TARGET protobuf::libprotobuf protobuf::libprotoc
176-
CONAN protobuf/${OPENSOURCE_REPLACE_PROTOBUF}
177-
CONAN_ADDITIONAL_SEMS
178-
"&& conan_require_tool" protobuf/${OPENSOURCE_REPLACE_PROTOBUF} "&& conan-tool_requires" protobuf/${OPENSOURCE_REPLACE_PROTOBUF}
179-
"&& conan_import \\"bin, protoc* -> ./bin\\" && conan-imports 'bin, protoc* -> ./bin' && vanilla_protobuf"
180-
)
181-
182-
ELSE()
183-
184-
ADDINCL(
185-
GLOBAL contrib/libs/protoc/src
186-
)
161+
"""
162+
IF (OPENSOURCE_REPLACE_PROTOBUF AND EXPORT_CMAKE)
163+
164+
OPENSOURCE_EXPORT_REPLACEMENT(
165+
CMAKE Protobuf
166+
CMAKE_TARGET protobuf::libprotobuf protobuf::libprotoc
167+
CONAN protobuf/${OPENSOURCE_REPLACE_PROTOBUF}
168+
CONAN_ADDITIONAL_SEMS
169+
"&& conan_require_tool" protobuf/${OPENSOURCE_REPLACE_PROTOBUF} "&& conan-tool_requires" protobuf/${OPENSOURCE_REPLACE_PROTOBUF}
170+
"&& conan_import \\"bin, protoc* -> ./bin\\" && conan-imports 'bin, protoc* -> ./bin' && vanilla_protobuf"
171+
)
172+
173+
ELSE()
174+
175+
ADDINCL(
176+
GLOBAL contrib/libs/protoc/src
177+
)
187178
188-
ENDIF()
189-
""",
179+
ENDIF()
180+
""",
190181
)
191182

192183
libprotoc.ADDINCL = ["contrib/libs/protobuf/third_party/utf8_range"]
@@ -244,7 +235,9 @@ def post_install(self):
244235
# Specifying protoc will install both libprotoc and protoc executable
245236
"protoc",
246237
],
247-
unbundle_from={"abseil-cpp": "third_party/abseil-cpp"},
238+
unbundle_from={
239+
"abseil-cpp-tstring": "third_party/abseil-cpp",
240+
},
248241
put={"protobuf": "."},
249242
disable_includes=[
250243
"sys/isa_defs.h",

contrib/libs/protobuf/ya.make

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ ENDIF()
4343

4444
PEERDIR(
4545
contrib/libs/zlib
46-
contrib/restricted/abseil-cpp-tstring/y_absl/log
47-
contrib/restricted/abseil-cpp-tstring/y_absl/status
46+
contrib/restricted/abseil-cpp-tstring
4847
library/cpp/sanitizer/include
4948
)
5049

contrib/python/protobuf/py3/.yandex_meta/build.ym

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ PEERDIR(
2424
contrib/libs/protobuf/builtin_proto/protos_from_protobuf
2525
contrib/libs/protobuf/builtin_proto/protos_from_protoc
2626
contrib/libs/python
27-
contrib/restricted/abseil-cpp-tstring/y_absl/strings
28-
contrib/restricted/abseil-cpp-tstring/y_absl/log
27+
contrib/restricted/abseil-cpp-tstring
2928
)
3029

3130
NO_LINT()

contrib/python/protobuf/py3/ya.make

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ PEERDIR(
2020
contrib/libs/protobuf/builtin_proto/protos_from_protobuf
2121
contrib/libs/protobuf/builtin_proto/protos_from_protoc
2222
contrib/libs/python
23-
contrib/restricted/abseil-cpp-tstring/y_absl/strings
24-
contrib/restricted/abseil-cpp-tstring/y_absl/log
23+
contrib/restricted/abseil-cpp-tstring
2524
)
2625

2726
NO_LINT()
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
from devtools.yamaker.arcpath import ArcPath
2+
from devtools.yamaker.fileutil import re_sub_dir, rename
3+
from devtools.yamaker.modules import Library, Linkable, Switch, Words
4+
from devtools.yamaker.project import CMakeNinjaNixProject
5+
6+
7+
def post_build(self):
8+
rename(f"{self.dstdir}/absl", "y_absl")
9+
re_sub_dir(self.dstdir, r"\babsl\b", "y_absl")
10+
re_sub_dir(self.dstdir, r"\bABSL_", "Y_ABSL_")
11+
re_sub_dir(self.dstdir, r"\bANNOTATE_", "Y_ANNOTATE_")
12+
re_sub_dir(self.dstdir, "ts_unchecked_read", "y_ts_unchecked_read")
13+
re_sub_dir(self.dstdir, r"\bTS_UNCHECKED_READ\b", "Y_TS_UNCHECKED_READ")
14+
# AbslInternalGetFileMappingHint has C-linkage and thus comes in conflict with vanilla abseil.
15+
re_sub_dir(
16+
self.dstdir,
17+
r"\bAbslInternalGetFileMappingHint\b",
18+
"YAbslInternalGetFileMappingHint",
19+
)
20+
re_sub_dir(self.dstdir, r"\bstd::string\b", "TString")
21+
re_sub_dir(self.dstdir, "#include <string>", "#include <util/generic/string.h>")
22+
23+
24+
def post_install(self):
25+
def subst(p):
26+
return ArcPath.re_sub(p, r"\babsl\b", "y_absl")
27+
28+
with self.yamakes["."] as absl:
29+
absl.NO_UTIL = False
30+
absl.PEERDIR.add("library/cpp/sanitizer/include")
31+
absl.after(
32+
"ADDINCL",
33+
Switch(
34+
{
35+
"OS_DARWIN OR OS_IOS": Linkable(EXTRALIBS=[Words("-framework CoreFoundation")]),
36+
"OS_ANDROID": Linkable(LDFLAGS=["-llog"]),
37+
}
38+
),
39+
)
40+
absl.ADDINCL = [subst(include) for include in absl.ADDINCL]
41+
absl.SRCS = [subst(src) for src in absl.SRCS]
42+
43+
44+
# Disable debug library form this targets if flag `Y_ABSL_DONT_USE_DEBUG` is set
45+
DISABLED_DBG_LIBRARY = [
46+
"absl/log",
47+
"absl/strings",
48+
"absl/synchronization",
49+
]
50+
51+
with self.yamakes["."] as absl:
52+
absl.after(
53+
"CFLAGS",
54+
"""
55+
IF (Y_ABSL_DONT_USE_DEBUG)
56+
CFLAGS(-DY_ABSL_DONT_USE_DEBUG_LIBRARY=1)
57+
ENDIF()
58+
""",
59+
)
60+
61+
62+
abseil_cpp = CMakeNinjaNixProject(
63+
owners=["g:cpp-contrib"],
64+
arcdir="contrib/restricted/abseil-cpp-tstring",
65+
nixattr="abseil-cpp",
66+
disable_includes=[
67+
# if defined(__myriad2__)
68+
"rtems.h",
69+
# if defined(__Fuchsia__)
70+
"fuchsia/intl/cpp/fidl.h",
71+
"lib/async-loop/cpp/loop.h",
72+
"lib/fdio/directory.h",
73+
"lib/sys/cpp/component_context.h",
74+
"zircon/types.h",
75+
],
76+
copy_sources=[
77+
"absl/base/internal/*.inc",
78+
"absl/flags/internal/*.inc",
79+
"absl/synchronization/internal/*.inc",
80+
"absl/numeric/int128_no_intrinsic.inc",
81+
"absl/debugging/internal/*.inc",
82+
"absl/debugging/*.inc",
83+
"absl/strings/internal/stl_type_traits.h",
84+
"absl/time/internal/*.inc",
85+
"absl/**/*.h",
86+
],
87+
ignore_targets=[
88+
# these depend on gtest, ignore it.
89+
"absl_scoped_mock_log",
90+
"absl_status_matchers",
91+
],
92+
copy_sources_except=[
93+
"absl/status/status_matchers.h",
94+
],
95+
put={
96+
"absl_base": ".",
97+
},
98+
put_with={
99+
"absl_base": [
100+
"absl_bad_any_cast_impl",
101+
"absl_bad_optional_access",
102+
"absl_bad_variant_access",
103+
"absl_city",
104+
"absl_civil_time",
105+
"absl_cord",
106+
"absl_cord_internal",
107+
"absl_cordz_functions",
108+
"absl_cordz_handle",
109+
"absl_cordz_info",
110+
"absl_cordz_sample_token",
111+
"absl_crc32c",
112+
"absl_crc_cord_state",
113+
"absl_crc_cpu_detect",
114+
"absl_crc_internal",
115+
"absl_debugging_internal",
116+
"absl_decode_rust_punycode",
117+
"absl_demangle_internal",
118+
"absl_demangle_rust",
119+
"absl_die_if_null",
120+
"absl_examine_stack",
121+
"absl_exponential_biased",
122+
"absl_failure_signal_handler",
123+
"absl_flags_commandlineflag",
124+
"absl_flags_commandlineflag_internal",
125+
"absl_flags_config",
126+
"absl_flags_internal",
127+
"absl_flags_marshalling",
128+
"absl_flags_parse",
129+
"absl_flags_private_handle_accessor",
130+
"absl_flags_program_name",
131+
"absl_flags_reflection",
132+
"absl_flags_usage",
133+
"absl_flags_usage_internal",
134+
"absl_graphcycles_internal",
135+
"absl_hash",
136+
"absl_hashtablez_sampler",
137+
"absl_int128",
138+
"absl_kernel_timeout_internal",
139+
"absl_leak_check",
140+
"absl_log_entry",
141+
"absl_log_flags",
142+
"absl_log_globals",
143+
"absl_log_initialize",
144+
"absl_log_internal_check_op",
145+
"absl_log_internal_conditions",
146+
"absl_log_internal_fnmatch",
147+
"absl_log_internal_format",
148+
"absl_log_internal_globals",
149+
"absl_log_internal_log_sink_set",
150+
"absl_log_internal_message",
151+
"absl_log_internal_nullguard",
152+
"absl_log_internal_proto",
153+
"absl_log_severity",
154+
"absl_log_sink",
155+
"absl_low_level_hash",
156+
"absl_malloc_internal",
157+
"absl_periodic_sampler",
158+
"absl_poison",
159+
"absl_random_distributions",
160+
"absl_random_internal_distribution_test_util",
161+
"absl_random_internal_platform",
162+
"absl_random_internal_pool_urbg",
163+
"absl_random_internal_randen",
164+
"absl_random_internal_randen_hwaes",
165+
"absl_random_internal_randen_hwaes_impl",
166+
"absl_random_internal_randen_slow",
167+
"absl_random_internal_seed_material",
168+
"absl_random_seed_gen_exception",
169+
"absl_random_seed_sequences",
170+
"absl_raw_hash_set",
171+
"absl_raw_logging_internal",
172+
"absl_scoped_set_env",
173+
"absl_spinlock_wait",
174+
"absl_stacktrace",
175+
"absl_status",
176+
"absl_statusor",
177+
"absl_str_format_internal",
178+
"absl_strerror",
179+
"absl_string_view",
180+
"absl_strings",
181+
"absl_strings_internal",
182+
"absl_symbolize",
183+
"absl_synchronization",
184+
"absl_throw_delegate",
185+
"absl_time",
186+
"absl_time_zone",
187+
"absl_utf8_for_code_point",
188+
"absl_vlog_config_internal",
189+
],
190+
},
191+
post_build=post_build,
192+
post_install=post_install,
193+
)

0 commit comments

Comments
 (0)