Hook up checked-in gencode to staleness infrastructure

php-regen
Mike Kruskal 6 months ago
parent e02c872ba9
commit 5ac2626018
  1. 2
      conformance/BUILD.bazel
  2. 8
      conformance/autoload.php
  3. 206
      php/BUILD.bazel
  4. 248
      php/ext/google/protobuf/wkt.inc
  5. 1
      regenerate_stale_files.sh

@ -346,7 +346,7 @@ inline_sh_binary(
"conformance_php.php",
],
cmd = """
php -d include_path=conformance:src/google/protobuf:editions/golden \\
php -d include_path=php/generated:conformance:src/google/protobuf:editions/golden \\
-d auto_prepend_file=$(rootpath autoload.php) \\
$(rootpath conformance_php.php)
""",

@ -7,8 +7,12 @@ define("GOOGLE_GPBMETADATA_NAMESPACE", "GPBMetadata\\Google\\Protobuf\\");
function protobuf_autoloader_impl($class, $prefix) {
$length = strlen($prefix);
if ((substr($class, 0, $length) === $prefix)) {
$path = 'php/src/' . implode('/', array_map('ucwords', explode('\\', $class))) . '.php';
include_once $path;
$path = 'src/' . implode('/', array_map('ucwords', explode('\\', $class))) . '.php';
if (file_exists('php/' . $path)) {
include_once 'php/' . $path;
} else {
include_once 'php/generated/' . $path;
}
}
}

@ -9,15 +9,152 @@ load("//build_defs:internal_shell.bzl", "inline_sh_binary")
load("//conformance:defs.bzl", "conformance_test")
load("//upb/cmake:build_defs.bzl", "staleness_test")
# We must explicitly classify every checked-in php file because we can't
# distinguish gencode from hand-written code. The former must be kept
# up-to-date though, using our staleness infrastructure.
_WKT_GENERATED_FILES = glob([
"src/Google/Protobuf/Any.php",
"src/Google/Protobuf/Api.php",
"src/Google/Protobuf/BoolValue.php",
"src/Google/Protobuf/BytesValue.php",
"src/Google/Protobuf/DoubleValue.php",
"src/Google/Protobuf/Duration.php",
"src/Google/Protobuf/Enum.php",
"src/Google/Protobuf/EnumValue.php",
"src/Google/Protobuf/Field.php",
"src/Google/Protobuf/Field/**/*.php",
"src/Google/Protobuf/FieldMask.php",
"src/Google/Protobuf/FloatValue.php",
"src/Google/Protobuf/GPBEmpty.php",
"src/Google/Protobuf/Int32Value.php",
"src/Google/Protobuf/Int64Value.php",
"src/Google/Protobuf/ListValue.php",
"src/Google/Protobuf/Method.php",
"src/Google/Protobuf/Mixin.php",
"src/Google/Protobuf/NullValue.php",
"src/Google/Protobuf/Option.php",
"src/Google/Protobuf/SourceContext.php",
"src/Google/Protobuf/StringValue.php",
"src/Google/Protobuf/Struct.php",
"src/Google/Protobuf/Syntax.php",
"src/Google/Protobuf/Timestamp.php",
"src/Google/Protobuf/Type.php",
"src/Google/Protobuf/UInt32Value.php",
"src/Google/Protobuf/UInt64Value.php",
"src/Google/Protobuf/Value.php",
"src/GPBMetadata/Google/Protobuf/Any.php",
"src/GPBMetadata/Google/Protobuf/Api.php",
"src/GPBMetadata/Google/Protobuf/Duration.php",
"src/GPBMetadata/Google/Protobuf/FieldMask.php",
"src/GPBMetadata/Google/Protobuf/GPBEmpty.php",
"src/GPBMetadata/Google/Protobuf/SourceContext.php",
"src/GPBMetadata/Google/Protobuf/Struct.php",
"src/GPBMetadata/Google/Protobuf/Timestamp.php",
"src/GPBMetadata/Google/Protobuf/Type.php",
"src/GPBMetadata/Google/Protobuf/Wrappers.php",
])
_DESCRIPTOR_GENERATED_FILES = glob([
"src/Google/Protobuf/Internal/DescriptorProto.php",
"src/Google/Protobuf/Internal/DescriptorProto/**/*.php",
"src/Google/Protobuf/Internal/Edition.php",
"src/Google/Protobuf/Internal/EnumDescriptorProto.php",
"src/Google/Protobuf/Internal/EnumDescriptorProto/**/*.php",
"src/Google/Protobuf/Internal/EnumOptions.php",
"src/Google/Protobuf/Internal/EnumValueDescriptorProto.php",
"src/Google/Protobuf/Internal/EnumValueOptions.php",
"src/Google/Protobuf/Internal/ExtensionRangeOptions.php",
"src/Google/Protobuf/Internal/ExtensionRangeOptions/**/*.php",
"src/Google/Protobuf/Internal/FeatureSet.php",
"src/Google/Protobuf/Internal/FeatureSet/**/*.php",
"src/Google/Protobuf/Internal/FeatureSetDefaults.php",
"src/Google/Protobuf/Internal/FeatureSetDefaults/**/*.php",
"src/Google/Protobuf/Internal/FieldDescriptorProto.php",
"src/Google/Protobuf/Internal/FieldDescriptorProto/**/*.php",
"src/Google/Protobuf/Internal/FieldOptions.php",
"src/Google/Protobuf/Internal/FieldOptions/**/*.php",
"src/Google/Protobuf/Internal/FileDescriptorProto.php",
"src/Google/Protobuf/Internal/FileDescriptorSet.php",
"src/Google/Protobuf/Internal/FileOptions.php",
"src/Google/Protobuf/Internal/FileOptions/**/*.php",
"src/Google/Protobuf/Internal/GeneratedCodeInfo.php",
"src/Google/Protobuf/Internal/GeneratedCodeInfo/**/*.php",
"src/Google/Protobuf/Internal/MessageOptions.php",
"src/Google/Protobuf/Internal/MethodDescriptorProto.php",
"src/Google/Protobuf/Internal/MethodOptions.php",
"src/Google/Protobuf/Internal/MethodOptions/**/*.php",
"src/Google/Protobuf/Internal/OneofDescriptorProto.php",
"src/Google/Protobuf/Internal/OneofOptions.php",
"src/Google/Protobuf/Internal/ServiceDescriptorProto.php",
"src/Google/Protobuf/Internal/ServiceOptions.php",
"src/Google/Protobuf/Internal/SourceCodeInfo.php",
"src/Google/Protobuf/Internal/SourceCodeInfo/**/*.php",
"src/Google/Protobuf/Internal/UninterpretedOption.php",
"src/Google/Protobuf/Internal/UninterpretedOption/**/*.php",
"src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php",
])
_RUNTIME_SOURCES = [
"src/Google/Protobuf/Descriptor.php",
"src/Google/Protobuf/DescriptorPool.php",
"src/Google/Protobuf/EnumDescriptor.php",
"src/Google/Protobuf/EnumValueDescriptor.php",
"src/Google/Protobuf/Field_Cardinality.php",
"src/Google/Protobuf/Field_Kind.php",
"src/Google/Protobuf/FieldDescriptor.php",
"src/Google/Protobuf/Internal/AnyBase.php",
"src/Google/Protobuf/Internal/CodedInputStream.php",
"src/Google/Protobuf/Internal/CodedOutputStream.php",
"src/Google/Protobuf/Internal/Descriptor.php",
"src/Google/Protobuf/Internal/DescriptorPool.php",
"src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php",
"src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php",
"src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php",
"src/Google/Protobuf/Internal/EnumBuilderContext.php",
"src/Google/Protobuf/Internal/EnumDescriptor.php",
"src/Google/Protobuf/Internal/FieldDescriptor.php",
"src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php",
"src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php",
"src/Google/Protobuf/Internal/FieldOptions_CType.php",
"src/Google/Protobuf/Internal/FieldOptions_JSType.php",
"src/Google/Protobuf/Internal/FileDescriptor.php",
"src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php",
"src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php",
"src/Google/Protobuf/Internal/GetPublicDescriptorTrait.php",
"src/Google/Protobuf/Internal/GPBDecodeException.php",
"src/Google/Protobuf/Internal/GPBJsonWire.php",
"src/Google/Protobuf/Internal/GPBLabel.php",
"src/Google/Protobuf/Internal/GPBType.php",
"src/Google/Protobuf/Internal/GPBUtil.php",
"src/Google/Protobuf/Internal/GPBWire.php",
"src/Google/Protobuf/Internal/GPBWireType.php",
"src/Google/Protobuf/Internal/HasPublicDescriptorTrait.php",
"src/Google/Protobuf/Internal/MapEntry.php",
"src/Google/Protobuf/Internal/MapField.php",
"src/Google/Protobuf/Internal/MapFieldIter.php",
"src/Google/Protobuf/Internal/Message.php",
"src/Google/Protobuf/Internal/MessageBuilderContext.php",
"src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php",
"src/Google/Protobuf/Internal/OneofDescriptor.php",
"src/Google/Protobuf/Internal/OneofField.php",
"src/Google/Protobuf/Internal/RawInputStream.php",
"src/Google/Protobuf/Internal/RepeatedField.php",
"src/Google/Protobuf/Internal/RepeatedFieldIter.php",
"src/Google/Protobuf/Internal/SourceCodeInfo_Location.php",
"src/Google/Protobuf/Internal/TimestampBase.php",
"src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php",
"src/Google/Protobuf/OneofDescriptor.php",
]
filegroup(
name = "source_files",
srcs = glob([
"src/GPBMetadata/Google/Protobuf/**/*.php",
"src/Google/Protobuf/**/*.php",
]) + [
"composer.json",
":php_ext_source_files",
],
srcs = _RUNTIME_SOURCES +
["generated/" + f for f in _DESCRIPTOR_GENERATED_FILES + _WKT_GENERATED_FILES] +
[
"composer.json",
":php_ext_source_files",
],
visibility = [
"//conformance:__pkg__",
"//php:__pkg__",
@ -47,9 +184,16 @@ genrule(
srcs = [
":source_files",
"//third_party/utf8_range:utf8_range_srcs",
"generated/ext/google/protobuf/wkt.inc",
"generated/ext/google/protobuf/php-upb.h",
"generated/ext/google/protobuf/php-upb.c",
],
outs = ["protobuf.so"],
cmd = """
rm php/ext/google/protobuf/wkt.inc php/ext/google/protobuf/php-upb.h php/ext/google/protobuf/php-upb.c
cp $(location generated/ext/google/protobuf/wkt.inc) php/ext/google/protobuf
cp $(location generated/ext/google/protobuf/php-upb.h) php/ext/google/protobuf
cp $(location generated/ext/google/protobuf/php-upb.c) php/ext/google/protobuf
./$(execpath :build_extension) $@
cp php/ext/google/protobuf/modules/protobuf.so $(OUTS)
""",
@ -80,14 +224,14 @@ conformance_test(
genrule(
name = "copy_php_amalgamation_h",
srcs = ["//upb:php-upb.h"],
outs = ["generated-in/ext/google/protobuf/php-upb.h"],
outs = ["generated/ext/google/protobuf/php-upb.h"],
cmd = "cp $< $@",
)
genrule(
name = "copy_php_amalgamation_c",
srcs = ["//upb:php-upb.c"],
outs = ["generated-in/ext/google/protobuf/php-upb.c"],
outs = ["generated/ext/google/protobuf/php-upb.c"],
cmd = "cp $< $@",
)
@ -96,8 +240,50 @@ staleness_test(
outs = [
"ext/google/protobuf/php-upb.c",
"ext/google/protobuf/php-upb.h",
"ext/google/protobuf/wkt.inc",
],
generated_pattern = "generated-in/%s",
generated_pattern = "generated/%s",
tags = ["manual"],
)
# The WKTs have to be checked in to support the Composer builds. This
# generule and test ensure the source are current.
# Make sure we error if new files start showing up, since that may go unnoticed.
_CHECK_GENCODE = """
for f in $$(find $(@D) -name "*.php"); do
local=$$(echo $$f | sed "s:bazel-out.*/bin/php/::g");
if [[ "$(OUTS)" != *$$local* ]]; then
echo "Extra generated file $$local! Please update the lists in php/BUILD.bazel" && exit 1;
fi
done
"""
genrule(
name = "gen_wkt_sources",
srcs = ["//src/google/protobuf:well_known_type_protos"],
cmd = "$(execpath //:protoc) --php_out=internal_generate_c_wkt:$(RULEDIR)/generated/src --proto_path=src $(SRCS);"
+ _CHECK_GENCODE,
tags = ["manual"],
tools = ["//:protoc"],
outs = ["generated/" + wkt for wkt in _WKT_GENERATED_FILES] +
["generated/ext/google/protobuf/wkt.inc"],
)
genrule(
name = "gen_descriptor_sources",
srcs = ["//src/google/protobuf:descriptor_proto_srcs"],
cmd = "$(execpath //:protoc) --php_out=internal:$(RULEDIR)/generated/src --proto_path=src $(SRCS);"
+ _CHECK_GENCODE,
tags = ["manual"],
tools = ["//:protoc"],
outs = ["generated/" + wkt for wkt in _DESCRIPTOR_GENERATED_FILES],
)
staleness_test(
name = "proto_staleness_test",
outs = glob(["src/**/*.php"], exclude = _RUNTIME_SOURCES),
generated_pattern = "generated/%s",
tags = ["manual"],
)

@ -12,8 +12,8 @@ static void google_protobuf_empty_proto_AddDescriptor();
static void google_protobuf_field_mask_proto_AddDescriptor();
static void google_protobuf_source_context_proto_AddDescriptor();
static void google_protobuf_struct_proto_AddDescriptor();
static void google_protobuf_type_proto_AddDescriptor();
static void google_protobuf_timestamp_proto_AddDescriptor();
static void google_protobuf_type_proto_AddDescriptor();
static void google_protobuf_wrappers_proto_AddDescriptor();
/* google/protobuf/any.proto */
@ -1497,6 +1497,127 @@ static void google_protobuf_NullValue_ModuleInit() {
strlen("NULL_VALUE"), 0);
}
/* google/protobuf/timestamp.proto */
zend_class_entry* GPBMetadata_Google_Protobuf_Timestamp_ce;
const char google_protobuf_timestamp_proto_descriptor [239] = {
'\n', '\037', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'i', 'm', 'e', 's', 't', 'a',
'm', 'p', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f',
'\"', '+', '\n', '\t', 'T', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', '\022', '\017', '\n', '\007', 's', 'e', 'c', 'o', 'n', 'd', 's', '\030',
'\001', ' ', '\001', '(', '\003', '\022', '\r', '\n', '\005', 'n', 'a', 'n', 'o', 's', '\030', '\002', ' ', '\001', '(', '\005', 'B', '\205', '\001', '\n', '\023',
'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\016', 'T', 'i', 'm', 'e',
's', 't', 'a', 'm', 'p', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '2', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a',
'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o',
'w', 'n', '/', 't', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002',
'\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w',
'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3',
};
static void google_protobuf_timestamp_proto_AddDescriptor() {
if (DescriptorPool_HasFile("google/protobuf/timestamp.proto")) return;
DescriptorPool_AddDescriptor("google/protobuf/timestamp.proto", google_protobuf_timestamp_proto_descriptor,
sizeof(google_protobuf_timestamp_proto_descriptor));
}
static PHP_METHOD(GPBMetadata_Google_Protobuf_Timestamp, initOnce) {
google_protobuf_timestamp_proto_AddDescriptor();
}
static zend_function_entry GPBMetadata_Google_Protobuf_Timestamp_methods[] = {
PHP_ME(GPBMetadata_Google_Protobuf_Timestamp, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
ZEND_FE_END
};
static void GPBMetadata_Google_Protobuf_Timestamp_ModuleInit() {
zend_class_entry tmp_ce;
INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Timestamp",
GPBMetadata_Google_Protobuf_Timestamp_methods);
GPBMetadata_Google_Protobuf_Timestamp_ce = zend_register_internal_class(&tmp_ce);
}
/* google_protobuf_Timestamp */
zend_class_entry* google_protobuf_Timestamp_ce;
static PHP_METHOD(google_protobuf_Timestamp, __construct) {
google_protobuf_timestamp_proto_AddDescriptor();
zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
static PHP_METHOD(google_protobuf_Timestamp, getSeconds) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const upb_FieldDef *f = upb_MessageDef_FindFieldByName(
intern->desc->msgdef, "seconds");
zval ret;
Message_get(intern, f, &ret);
RETURN_COPY_VALUE(&ret);
}
static PHP_METHOD(google_protobuf_Timestamp, setSeconds) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const upb_FieldDef *f = upb_MessageDef_FindFieldByName(
intern->desc->msgdef, "seconds");
zval *val;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val)
== FAILURE) {
return;
}
Message_set(intern, f, val);
RETURN_COPY(getThis());
}
static PHP_METHOD(google_protobuf_Timestamp, getNanos) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const upb_FieldDef *f = upb_MessageDef_FindFieldByName(
intern->desc->msgdef, "nanos");
zval ret;
Message_get(intern, f, &ret);
RETURN_COPY_VALUE(&ret);
}
static PHP_METHOD(google_protobuf_Timestamp, setNanos) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const upb_FieldDef *f = upb_MessageDef_FindFieldByName(
intern->desc->msgdef, "nanos");
zval *val;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val)
== FAILURE) {
return;
}
Message_set(intern, f, val);
RETURN_COPY(getThis());
}
ZEND_BEGIN_ARG_INFO_EX(arginfo_timestamp_fromdatetime, 0, 0, 1)
ZEND_ARG_INFO(0, datetime)
ZEND_END_ARG_INFO()
static zend_function_entry google_protobuf_Timestamp_phpmethods[] = {
PHP_ME(google_protobuf_Timestamp, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, getSeconds, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, setSeconds, arginfo_setter, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, getNanos, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, setNanos, arginfo_setter, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, fromDateTime, arginfo_timestamp_fromdatetime, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, toDateTime, arginfo_void, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
static void google_protobuf_Timestamp_ModuleInit() {
zend_class_entry tmp_ce;
INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Timestamp",
google_protobuf_Timestamp_phpmethods);
google_protobuf_Timestamp_ce = zend_register_internal_class(&tmp_ce);
google_protobuf_Timestamp_ce->ce_flags |= ZEND_ACC_FINAL;
google_protobuf_Timestamp_ce->create_object = Message_create;
zend_do_inheritance(google_protobuf_Timestamp_ce, message_ce);
}
/* google/protobuf/type.proto */
zend_class_entry* GPBMetadata_Google_Protobuf_Type_ce;
@ -2636,127 +2757,6 @@ static void google_protobuf_Syntax_ModuleInit() {
strlen("SYNTAX_EDITIONS"), 2);
}
/* google/protobuf/timestamp.proto */
zend_class_entry* GPBMetadata_Google_Protobuf_Timestamp_ce;
const char google_protobuf_timestamp_proto_descriptor [239] = {
'\n', '\037', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'i', 'm', 'e', 's', 't', 'a',
'm', 'p', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f',
'\"', '+', '\n', '\t', 'T', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', '\022', '\017', '\n', '\007', 's', 'e', 'c', 'o', 'n', 'd', 's', '\030',
'\001', ' ', '\001', '(', '\003', '\022', '\r', '\n', '\005', 'n', 'a', 'n', 'o', 's', '\030', '\002', ' ', '\001', '(', '\005', 'B', '\205', '\001', '\n', '\023',
'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\016', 'T', 'i', 'm', 'e',
's', 't', 'a', 'm', 'p', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', '2', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a',
'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'k', 'n', 'o',
'w', 'n', '/', 't', 'i', 'm', 'e', 's', 't', 'a', 'm', 'p', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002',
'\036', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'W', 'e', 'l', 'l', 'K', 'n', 'o', 'w',
'n', 'T', 'y', 'p', 'e', 's', 'b', '\006', 'p', 'r', 'o', 't', 'o', '3',
};
static void google_protobuf_timestamp_proto_AddDescriptor() {
if (DescriptorPool_HasFile("google/protobuf/timestamp.proto")) return;
DescriptorPool_AddDescriptor("google/protobuf/timestamp.proto", google_protobuf_timestamp_proto_descriptor,
sizeof(google_protobuf_timestamp_proto_descriptor));
}
static PHP_METHOD(GPBMetadata_Google_Protobuf_Timestamp, initOnce) {
google_protobuf_timestamp_proto_AddDescriptor();
}
static zend_function_entry GPBMetadata_Google_Protobuf_Timestamp_methods[] = {
PHP_ME(GPBMetadata_Google_Protobuf_Timestamp, initOnce, arginfo_void, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
ZEND_FE_END
};
static void GPBMetadata_Google_Protobuf_Timestamp_ModuleInit() {
zend_class_entry tmp_ce;
INIT_CLASS_ENTRY(tmp_ce, "GPBMetadata\\Google\\Protobuf\\Timestamp",
GPBMetadata_Google_Protobuf_Timestamp_methods);
GPBMetadata_Google_Protobuf_Timestamp_ce = zend_register_internal_class(&tmp_ce);
}
/* google_protobuf_Timestamp */
zend_class_entry* google_protobuf_Timestamp_ce;
static PHP_METHOD(google_protobuf_Timestamp, __construct) {
google_protobuf_timestamp_proto_AddDescriptor();
zim_Message___construct(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
static PHP_METHOD(google_protobuf_Timestamp, getSeconds) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const upb_FieldDef *f = upb_MessageDef_FindFieldByName(
intern->desc->msgdef, "seconds");
zval ret;
Message_get(intern, f, &ret);
RETURN_COPY_VALUE(&ret);
}
static PHP_METHOD(google_protobuf_Timestamp, setSeconds) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const upb_FieldDef *f = upb_MessageDef_FindFieldByName(
intern->desc->msgdef, "seconds");
zval *val;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val)
== FAILURE) {
return;
}
Message_set(intern, f, val);
RETURN_COPY(getThis());
}
static PHP_METHOD(google_protobuf_Timestamp, getNanos) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const upb_FieldDef *f = upb_MessageDef_FindFieldByName(
intern->desc->msgdef, "nanos");
zval ret;
Message_get(intern, f, &ret);
RETURN_COPY_VALUE(&ret);
}
static PHP_METHOD(google_protobuf_Timestamp, setNanos) {
Message* intern = (Message*)Z_OBJ_P(getThis());
const upb_FieldDef *f = upb_MessageDef_FindFieldByName(
intern->desc->msgdef, "nanos");
zval *val;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &val)
== FAILURE) {
return;
}
Message_set(intern, f, val);
RETURN_COPY(getThis());
}
ZEND_BEGIN_ARG_INFO_EX(arginfo_timestamp_fromdatetime, 0, 0, 1)
ZEND_ARG_INFO(0, datetime)
ZEND_END_ARG_INFO()
static zend_function_entry google_protobuf_Timestamp_phpmethods[] = {
PHP_ME(google_protobuf_Timestamp, __construct, arginfo_construct, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, getSeconds, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, setSeconds, arginfo_setter, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, getNanos, arginfo_void, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, setNanos, arginfo_setter, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, fromDateTime, arginfo_timestamp_fromdatetime, ZEND_ACC_PUBLIC)
PHP_ME(google_protobuf_Timestamp, toDateTime, arginfo_void, ZEND_ACC_PUBLIC)
ZEND_FE_END
};
static void google_protobuf_Timestamp_ModuleInit() {
zend_class_entry tmp_ce;
INIT_CLASS_ENTRY(tmp_ce, "Google\\Protobuf\\Timestamp",
google_protobuf_Timestamp_phpmethods);
google_protobuf_Timestamp_ce = zend_register_internal_class(&tmp_ce);
google_protobuf_Timestamp_ce->ce_flags |= ZEND_ACC_FINAL;
google_protobuf_Timestamp_ce->create_object = Message_create;
zend_do_inheritance(google_protobuf_Timestamp_ce, message_ce);
}
/* google/protobuf/wrappers.proto */
zend_class_entry* GPBMetadata_Google_Protobuf_Wrappers_ce;
@ -3278,6 +3278,8 @@ static void WellKnownTypes_ModuleInit() {
google_protobuf_Value_ModuleInit();
google_protobuf_ListValue_ModuleInit();
google_protobuf_NullValue_ModuleInit();
GPBMetadata_Google_Protobuf_Timestamp_ModuleInit();
google_protobuf_Timestamp_ModuleInit();
GPBMetadata_Google_Protobuf_Type_ModuleInit();
google_protobuf_Type_ModuleInit();
google_protobuf_Field_ModuleInit();
@ -3287,8 +3289,6 @@ static void WellKnownTypes_ModuleInit() {
google_protobuf_EnumValue_ModuleInit();
google_protobuf_Option_ModuleInit();
google_protobuf_Syntax_ModuleInit();
GPBMetadata_Google_Protobuf_Timestamp_ModuleInit();
google_protobuf_Timestamp_ModuleInit();
GPBMetadata_Google_Protobuf_Wrappers_ModuleInit();
google_protobuf_DoubleValue_ModuleInit();
google_protobuf_FloatValue_ModuleInit();

@ -19,6 +19,7 @@ STALENESS_TESTS=(
"src/google/protobuf:well_known_types_staleness_test"
"objectivec:well_known_types_staleness_test"
"php:test_amalgamation_staleness"
"php:proto_staleness_test"
"ruby/ext/google/protobuf_c:test_amalgamation_staleness"
"upb/cmake:test_generated_files"
"upb/reflection:descriptor_upb_proto_staleness_test"

Loading…
Cancel
Save