Improve C++, Python, Java runtime version representations to avoid merge conflicts during release.

PiperOrigin-RevId: 626480269
pull/16574/head
Protobuf Team Bot 10 months ago committed by Copybara-Service
parent c413b1231c
commit 971f88aa63
  1. 20
      java/core/src/main/java/com/google/protobuf/RuntimeVersion.java
  2. 25
      python/google/protobuf/runtime_version.py
  3. 16
      src/google/protobuf/runtime_version.h

@ -24,12 +24,18 @@ public final class RuntimeVersion {
// The version of this runtime.
// Automatically updated by Protobuf release process. Do not edit manually.
public static final RuntimeDomain DOMAIN = RuntimeDomain.PUBLIC;
public static final int MAJOR = 4;
public static final int MINOR = 28;
public static final int PATCH = 0;
public static final String SUFFIX = "-dev";
// These OSS versions are not stripped to avoid merging conflicts.
public static final RuntimeDomain OSS_DOMAIN = RuntimeDomain.PUBLIC;
public static final int OSS_MAJOR = 4;
public static final int OSS_MINOR = 28;
public static final int OSS_PATCH = 0;
public static final String OSS_SUFFIX = "-dev";
public static final RuntimeDomain DOMAIN = OSS_DOMAIN;
public static final int MAJOR = OSS_MAJOR;
public static final int MINOR = OSS_MINOR;
public static final int PATCH = OSS_PATCH;
public static final String SUFFIX = OSS_SUFFIX;
private static final String VERSION_STRING = versionString(MAJOR, MINOR, PATCH, SUFFIX);
private static final Logger logger = Logger.getLogger(RuntimeVersion.class.getName());
@ -88,7 +94,7 @@ public final class RuntimeVersion {
}
// Check that runtime version is newer than the gencode version.
if (MINOR < minor || (MINOR == minor && PATCH < patch)) {
if (MINOR < minor || (minor == MINOR && PATCH < patch)) {
throw new ProtobufRuntimeVersionException(
String.format(
"Detected incompatible Protobuf Gencode/Runtime versions when loading %s: gencode %s,"

@ -22,17 +22,24 @@ class Domain(Enum):
PUBLIC = 2
class VersionError(Exception):
"""Exception class for version violation."""
# The versions of this Python Protobuf runtime to be changed automatically by
# the Protobuf release process. Do not edit them manually.
DOMAIN = Domain.PUBLIC
MAJOR = 5
MINOR = 28
PATCH = 0
SUFFIX = '-dev'
# These OSS versions are not stripped to avoid merging conflicts.
OSS_DOMAIN = Domain.PUBLIC
OSS_MAJOR = 5
OSS_MINOR = 28
OSS_PATCH = 0
OSS_SUFFIX = '-dev'
DOMAIN = OSS_DOMAIN
MAJOR = OSS_MAJOR
MINOR = OSS_MINOR
PATCH = OSS_PATCH
SUFFIX = OSS_SUFFIX
class VersionError(Exception):
"""Exception class for version violation."""
def ValidateProtobufRuntimeVersion(

@ -9,7 +9,19 @@
#error PROTOBUF_VERSION_SUFFIX was previously defined
#endif // PROTOBUF_VERSION_SUFFIX
#define PROTOBUF_VERSION 5028000
#define PROTOBUF_VERSION_SUFFIX "-dev"
#ifdef PROTOBUF_OSS_VERSION
#error PROTOBUF_OSS_VERSION was previously defined
#endif // PROTOBUF_OSS_VERSION
#ifdef PROTOBUF_OSS_VERSION_SUFFIX
#error PROTOBUF_OSS_VERSION_SUFFIX was previously defined
#endif // PROTOBUF_OSS_VERSION_SUFFIX
// The OSS versions are not stripped to avoid merging conflicts.
#define PROTOBUF_OSS_VERSION 5028000
#define PROTOBUF_OSS_VERSION_SUFFIX "-dev"
#define PROTOBUF_VERSION PROTOBUF_OSS_VERSION
#define PROTOBUF_VERSION_SUFFIX PROTOBUF_OSS_VERSION_SUFFIX
#endif // GOOGLE_PROTOBUF_RUNTIME_VERSION_H__

Loading…
Cancel
Save