[ObjC] make the bazel build always use generated WKTs.

This is done in basically the same way the C++ does this.

It was tested locally be putting `#error` directives in the pre-generated
sources and running the bazel build (it worked).

PiperOrigin-RevId: 509261352
pull/11921/head
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent e45e66b5f4
commit a2c5ea614c
  1. 35
      objectivec/BUILD.bazel

@ -7,9 +7,11 @@ load(":defs.bzl", "objc_proto_camel_case_name")
# The WKTs have to be checked in to support the CocoaPods and Xcode builds. This
# generule and test ensure the source are current.
#
# TODO: Improve the bazel build so it uses these generated headers so it is
# always current, and only the builds that can't easily build protoc and
# generate the files rely on the checked in ones.
# Within the ":objectivec" target, the outputs of the genrule are then used to
# ensure they are always "current". This implementation is basically the same
# has how the WKTs are handled in src/google/protobuf/BUILD.bazel for the C++
# version. They share the potential downsides around layer checks and that
# someone could #include the header with the `wkt/` prefix on the name.
_WELL_KNOWN_TYPES = [
"any",
@ -59,16 +61,6 @@ staleness_test(
objc_library(
name = "objectivec",
hdrs = [
"GPBAny.pbobjc.h",
"GPBApi.pbobjc.h",
"GPBDuration.pbobjc.h",
"GPBEmpty.pbobjc.h",
"GPBFieldMask.pbobjc.h",
"GPBSourceContext.pbobjc.h",
"GPBStruct.pbobjc.h",
"GPBTimestamp.pbobjc.h",
"GPBType.pbobjc.h",
"GPBWrappers.pbobjc.h",
"GPBArray.h",
"GPBBootstrap.h",
"GPBCodedInputStream.h",
@ -109,39 +101,30 @@ objc_library(
"GPBUnknownFieldSet_PackagePrivate.h",
"GPBUnknownField_PackagePrivate.h",
"GPBUtilities_PackagePrivate.h",
],
] + ["wkt/GPB" + wkt + ".pbobjc.h" for wkt in _OBJC_WKT_NAMES],
copts = [
"-Wno-vla",
],
includes = [
".",
"wkt",
],
non_arc_srcs = [
"GPBAny.pbobjc.m",
"GPBApi.pbobjc.m",
"GPBArray.m",
"GPBCodedInputStream.m",
"GPBCodedOutputStream.m",
"GPBDescriptor.m",
"GPBDictionary.m",
"GPBDuration.pbobjc.m",
"GPBEmpty.pbobjc.m",
"GPBExtensionInternals.m",
"GPBExtensionRegistry.m",
"GPBFieldMask.pbobjc.m",
"GPBMessage.m",
"GPBRootObject.m",
"GPBSourceContext.pbobjc.m",
"GPBStruct.pbobjc.m",
"GPBTimestamp.pbobjc.m",
"GPBType.pbobjc.m",
"GPBUnknownField.m",
"GPBUnknownFieldSet.m",
"GPBUtilities.m",
"GPBWellKnownTypes.m",
"GPBWireFormat.m",
"GPBWrappers.pbobjc.m",
],
] + ["wkt/GPB" + wkt + ".pbobjc.m" for wkt in _OBJC_WKT_NAMES],
target_compatible_with = select({
"@platforms//os:macos": [],
"@platforms//os:ios": [],
@ -159,8 +142,8 @@ objc_library(
conformance_test(
name = "conformance_test",
failure_list = "//conformance:failure_list_objc.txt",
testee = "//conformance:conformance_objc",
target_compatible_with = ["@platforms//os:macos"],
testee = "//conformance:conformance_objc",
)
# -------------------------------------------------------------------

Loading…
Cancel
Save