Skip to content

Commit 9c60170

Browse files
quh4gko8thestinger
authored andcommitted
Support updating versionCode without rebasing to new Chromium version
1 parent 79db8b0 commit 9c60170

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
From 2ff3f024994941abb94b813a872f84a3ad8524a0 Mon Sep 17 00:00:00 2001
2+
From: fgei <fgei@gmail.com>
3+
Date: Sun, 26 Feb 2023 10:39:38 +0100
4+
Subject: [PATCH] Support for extended version name and increments
5+
6+
---
7+
build/util/android_chrome_version.py | 2 +-
8+
build/util/version.py | 5 +++++
9+
chrome/version.gni | 27 +++++++++++++++++++++++++++
10+
3 files changed, 33 insertions(+), 1 deletion(-)
11+
12+
diff --git a/build/util/android_chrome_version.py b/build/util/android_chrome_version.py
13+
index 910e304bac436..52ebcde02f052 100755
14+
--- a/build/util/android_chrome_version.py
15+
+++ b/build/util/android_chrome_version.py
16+
@@ -281,7 +281,7 @@ def GenerateVersionCodes(version_values, arch, is_next_build):
17+
"""
18+
19+
base_version_code = int(
20+
- '%s%03d00' % (version_values['BUILD'], int(version_values['PATCH'])))
21+
+ '%s%03d00' % (version_values['BUILD'], (int(version_values['PATCH']) + int(version_values['INCREMENT']))))
22+
23+
if is_next_build:
24+
base_version_code += _NEXT_BUILD_VERSION_CODE_DIFF
25+
diff --git a/build/util/version.py b/build/util/version.py
26+
index bf7a59eabf799..40ccb48598804 100755
27+
--- a/build/util/version.py
28+
+++ b/build/util/version.py
29+
@@ -128,6 +128,10 @@ def BuildParser():
30+
help='Write substituted strings to FILE.')
31+
parser.add_argument('-t', '--template', default=None,
32+
help='Use TEMPLATE as the strings to substitute.')
33+
+ parser.add_argument(
34+
+ '--increment',
35+
+ default='0',
36+
+ help='Version increment to append at version_name, add at version_code.')
37+
parser.add_argument(
38+
'-e',
39+
'--eval',
40+
@@ -200,6 +204,7 @@ def GenerateValues(options, evals):
41+
for key, val in evals.items():
42+
values[key] = str(eval(val, globals(), values))
43+
44+
+ values['INCREMENT'] = options.increment
45+
if options.os == 'android':
46+
android_chrome_version_codes = android_chrome_version.GenerateVersionCodes(
47+
values, options.arch, options.next)
48+
diff --git a/chrome/version.gni b/chrome/version.gni
49+
index e197cbe85192b..89d1a4a08e379 100644
50+
--- a/chrome/version.gni
51+
+++ b/chrome/version.gni
52+
@@ -39,6 +39,33 @@ if (is_mac) {
53+
import("//build/config/android/config.gni")
54+
import("//build/config/chrome_build.gni")
55+
56+
+ declare_args() {
57+
+ # Allows usage for extended versionName increment for android.
58+
+ ext_version_enabled = false
59+
+ # Increment positive integer to append at versionName,
60+
+ # as well as to add on patch section of versionCode.
61+
+ # String is used for utility at build/util/version.py.
62+
+ ext_version_increment = ""
63+
+ }
64+
+
65+
+ # Disallow setting extended version increment when disabled.
66+
+ assert(ext_version_enabled || ext_version_increment == "")
67+
+
68+
+ if (ext_version_enabled) {
69+
+ _version_dictionary_template = "full = \"@MAJOR@.@MINOR@.@BUILD@" +
70+
+ ".@PATCH@.@INCREMENT@\" " +
71+
+ "major = \"@MAJOR@\" minor = \"@MINOR@\" " +
72+
+ "build = \"@BUILD@\" patch = \"@PATCH@\" " +
73+
+ "increment = \"@INCREMENT@\" "
74+
+
75+
+ if (ext_version_increment != "") {
76+
+ _script_arguments += [
77+
+ "--increment",
78+
+ ext_version_increment
79+
+ ]
80+
+ }
81+
+ }
82+
+
83+
_version_dictionary_template +=
84+
"chrome_version_code = " + "\"@CHROME_VERSION_CODE@\" " +
85+
"chrome_modern_version_code = \"@CHROME_MODERN_VERSION_CODE@\" " +

0 commit comments

Comments
 (0)