Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update_version.py, so that PROTOBUF_VERSION is always a 9 digit number #6643

Merged
merged 1 commit into from
Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/google/protobuf/any.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/google/protobuf/api.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/google/protobuf/compiler/plugin.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/google/protobuf/descriptor.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/google/protobuf/duration.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/google/protobuf/empty.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/google/protobuf/field_mask.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/google/protobuf/port_def.inc
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,14 @@

// Shared google3/opensource definitions. //////////////////////////////////////

#define PROTOBUF_VERSION 30010000
#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 30010000
#define PROTOBUF_MIN_PROTOC_VERSION 30010000
#define PROTOBUF_VERSION 3010000
#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3010000
#define PROTOBUF_MIN_PROTOC_VERSION 3010000
#define PROTOBUF_VERSION_SUFFIX ""

// The minimum library version which works with the current version of the
// headers.
#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 30010000
#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3010000

#if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI
#define PROTOBUF_RTTI 0
Expand Down
4 changes: 2 additions & 2 deletions src/google/protobuf/source_context.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/google/protobuf/struct.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/google/protobuf/stubs/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,23 @@ namespace internal {

// The current version, represented as a single integer to make comparison
// easier: major * 10^6 + minor * 10^3 + micro
#define GOOGLE_PROTOBUF_VERSION 30010000
#define GOOGLE_PROTOBUF_VERSION 3010000

// A suffix string for alpha, beta or rc releases. Empty for stable releases.
#define GOOGLE_PROTOBUF_VERSION_SUFFIX ""

// The minimum header version which works with the current version of
// the library. This constant should only be used by protoc's C++ code
// generator.
static const int kMinHeaderVersionForLibrary = 30010000;
static const int kMinHeaderVersionForLibrary = 3010000;

// The minimum protoc version which works with the current version of the
// headers.
#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 30010000
#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3010000

// The minimum header version which works with the current version of
// protoc. This constant should only be used in VerifyVersion().
static const int kMinHeaderVersionForProtoc = 30010000;
static const int kMinHeaderVersionForProtoc = 3010000;

// Verifies that the headers and libraries are compatible. Use the macro
// below to call this.
Expand Down
4 changes: 2 additions & 2 deletions src/google/protobuf/timestamp.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/google/protobuf/type.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/google/protobuf/wrappers.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
exit(1)

NEW_VERSION = sys.argv[1]
NEW_VERSION_INFO = NEW_VERSION.split('.')
NEW_VERSION_INFO = [int(x) for x in NEW_VERSION.split('.')]
if len(NEW_VERSION_INFO) != 3:
print """
[ERROR] Version must be in the format <MAJOR>.<MINOR>.<MICRO>
Expand Down Expand Up @@ -99,7 +99,7 @@ def UpdateConfigure():


def UpdateCpp():
cpp_version = '%s00%s00%s' % (
cpp_version = '%d%03d%03d' % (
NEW_VERSION_INFO[0], NEW_VERSION_INFO[1], NEW_VERSION_INFO[2])
def RewriteCommon(line):
line = re.sub(
Expand All @@ -110,7 +110,7 @@ def RewriteCommon(line):
r'^#define PROTOBUF_VERSION .*$',
'#define PROTOBUF_VERSION %s' % cpp_version,
line)
if NEW_VERSION_INFO[2] == '0':
if NEW_VERSION_INFO[2] == 0:
line = re.sub(
r'^#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC .*$',
'#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC %s' % cpp_version,
Expand All @@ -134,7 +134,7 @@ def RewritePortDef(line):
r'^#define PROTOBUF_VERSION .*$',
'#define PROTOBUF_VERSION %s' % cpp_version,
line)
if NEW_VERSION_INFO[2] == '0':
if NEW_VERSION_INFO[2] == 0:
line = re.sub(
r'^#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC .*$',
'#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC %s' % cpp_version,
Expand Down Expand Up @@ -228,7 +228,7 @@ def UpdateJavaScript():

def UpdateMakefile():
protobuf_version_offset = 11
expected_major_version = '3'
expected_major_version = 3
if NEW_VERSION_INFO[0] != expected_major_version:
print """[ERROR] Major protobuf version has changed. Please update
update_version.py to readjust the protobuf_version_offset and
Expand All @@ -237,8 +237,8 @@ def UpdateMakefile():
"""
exit(1)

protobuf_version_info = '%s:%s:0' % (
int(NEW_VERSION_INFO[1]) + protobuf_version_offset, NEW_VERSION_INFO[2])
protobuf_version_info = '%d:%d:0' % (
NEW_VERSION_INFO[1] + protobuf_version_offset, NEW_VERSION_INFO[2])
RewriteTextFile('src/Makefile.am',
lambda line : re.sub(
r'^PROTOBUF_VERSION = .*$',
Expand Down