1 load("@rules_cc//cc:defs.bzl", "objc_library")
2 load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix")
3 load("//conformance:defs.bzl", "conformance_test")
4 load("//upb/cmake:build_defs.bzl", "staleness_test")
5 load(":defs.bzl", "objc_proto_camel_case_name")
7 # The WKTs have to be checked in to support the CocoaPods and Xcode builds. This
8 # generule and test ensure the source are current.
10 # TODO: Improve the bazel build so it uses these generated headers so it is
11 # always current, and only the builds that can't easily build protoc and
12 # generate the files rely on the checked in ones.
27 _OBJC_WKT_NAMES = [objc_proto_camel_case_name(x) for x in _WELL_KNOWN_TYPES]
35 name = "gen_wkt_sources",
36 srcs = ["//src/google/protobuf:well_known_type_protos"],
37 outs = ["wkt/GPB" + wkt + ext for wkt in _OBJC_WKT_NAMES for ext in _OBJC_EXTS],
39 "$(execpath //:protoc) --objc_out=$(RULEDIR)/wkt --proto_path=src $(SRCS)",
41 "mv $(RULEDIR)/wkt/google/protobuf/" + wkt + ext + " $(RULEDIR)/wkt/GPB" + wkt + ext
42 for wkt in _OBJC_WKT_NAMES
46 tools = ["//:protoc"],
50 name = "well_known_types_staleness_test",
51 outs = ["GPB" + wkt + ext for wkt in _OBJC_WKT_NAMES for ext in _OBJC_EXTS],
52 generated_pattern = "wkt/%s",
56 ################################################################################
57 # Objective-C Runtime Library
58 ################################################################################
63 # Private headers that aren't used from the generated sources.
64 "GPBUnknownFields_PackagePrivate.h",
69 "GPBDuration.pbobjc.h",
71 "GPBFieldMask.pbobjc.h",
72 "GPBSourceContext.pbobjc.h",
74 "GPBTimestamp.pbobjc.h",
76 "GPBWrappers.pbobjc.h",
79 "GPBCodedInputStream.h",
80 "GPBCodedOutputStream.h",
83 "GPBExtensionInternals.h",
84 "GPBExtensionRegistry.h",
86 "GPBProtocolBuffers.h",
87 "GPBProtocolBuffers_RuntimeSupport.h",
93 "GPBWellKnownTypes.h",
95 # Package private headers, but exposed because the generated sources
97 "GPBArray_PackagePrivate.h",
98 "GPBCodedInputStream_PackagePrivate.h",
99 "GPBCodedOutputStream_PackagePrivate.h",
100 "GPBDescriptor_PackagePrivate.h",
101 "GPBDictionary_PackagePrivate.h",
102 "GPBMessage_PackagePrivate.h",
103 "GPBRootObject_PackagePrivate.h",
104 "GPBUnknownField_PackagePrivate.h",
105 "GPBUtilities_PackagePrivate.h",
117 "GPBCodedInputStream.m",
118 "GPBCodedOutputStream.m",
121 "GPBDuration.pbobjc.m",
123 "GPBExtensionInternals.m",
124 "GPBExtensionRegistry.m",
125 "GPBFieldMask.pbobjc.m",
128 "GPBSourceContext.pbobjc.m",
129 "GPBStruct.pbobjc.m",
130 "GPBTimestamp.pbobjc.m",
133 "GPBUnknownFields.m",
135 "GPBWellKnownTypes.m",
137 "GPBWrappers.pbobjc.m",
139 target_compatible_with = select({
140 "@platforms//os:macos": [],
141 "@platforms//os:ios": [],
142 "@platforms//os:tvos": [],
143 "@platforms//os:watchos": [],
144 "//conditions:default": ["@platforms//:incompatible"],
146 visibility = ["//visibility:public"],
149 ################################################################################
151 ################################################################################
154 name = "conformance_test",
155 failure_list = "//conformance:failure_list_objc.txt",
156 maximum_edition = "2023",
157 target_compatible_with = ["@platforms//os:macos"],
158 testee = "//conformance:conformance_objc",
161 # -------------------------------------------------------------------
162 # Current Version Check between Generator and Runtime Sources
164 name = "check_version_stamps",
166 srcs = ["DevTools/check_version_stamps.sh"],
169 "//src/google/protobuf/compiler/objectivec:file.cc",
173 # -------------------------------------------------------------------
174 # Validation of pddm expansion.
178 srcs = ["DevTools/pddm.py"],
186 "DevTools/pddm_tests.py",
191 name = "sources_pddm_expansion_test",
193 srcs = ["DevTools/sources_pddm_expansion_test.sh"],
194 data = [":pddm"] + glob([
201 ################################################################################
203 ################################################################################
216 "ProtocolBuffers_iOS.xcodeproj/**/*",
217 "ProtocolBuffers_OSX.xcodeproj/**/*",
218 "ProtocolBuffers_tvOS.xcodeproj/**/*",
227 "Tests/golden_message",
228 "Tests/golden_packed_fields_message",
229 "generate_well_known_types.sh",
231 strip_prefix = strip_prefix.from_root(""),
232 visibility = ["//pkg:__pkg__"],