chromium 03 修改chromium 编译版本号

chromium 版本号定义在 src\chrome\VERSION 中。单纯的修改这里的版本号,一般是不能顺利编译通过的。比如68.0.3440.105要修改为主版本号大于 10的,比如:10.0.0.1,才能编译通过。
一般自己发布新版,都是从0.x.x.x或者1.x.x.x开始的。这就需要修改chromium的兼容说明文件。

chromium 为了版本兼容性,单独定义了一直json格式的版本支持说明文件。
src\components\policy\resources\policy_templates.json

大致格式如下

#   Currently supported product names:
#       'chrome_frame', 'chrome_os', 'android', 'webview_android',
#       'chrome.win', 'chrome.linux', 'chrome.mac', 'chrome.*'
#     For example if 'chrome.*:5-10' is specified for a policy, then it should
#     be read as:
#       'chrome.linux:5-10', 'chrome.mac:5-10', 'chrome.win:5-10'
#
#   The product name also affects in which templates the policy is included:
#     chrome.*, chrome.win, chrome_frame -> ADM, ADMX, ADML, doc
#     chrome.*, chrome.linux -> JSON, doc
#     chrome.*, chrome.mac -> plist, plist_strings, doc
#     everything else -> doc
#
#   The default list of policies supported by Chrome is also generated based
#   on the product names:
#     chrome.* -> Chrome policy definition list
#     chrome_os -> Chrome policy definition list, when building OS_CHROMEOS
#

比如编译windows版本,需要修改chrome.*chrome.win对应的版本值
比如:68.0.3440.105版本。要把版本号修改位1.0.0.1。
就需要把policy_templates.json文件中所有chrome.*chrome.win相关的值修改为:
A: 关闭类型的,位版本号小于编译代码的版本号,不需要处理,如下:65 < 68,所以不需要修改

'supported_on': ['chrome.*:58-65', 'chrome_os:58-65', 'android:58-65'],

B:起始版本号大约编译版本号的,不需要修改,如下: 69 > 68,不需要修改。

'supported_on': ['chrome.*:69-', 'chrome_os:69-'],

C:只有起始版本号,没有结束版本号的,且起始版本号小于编译版本号。如下:54 < 68。需要修改为1-或者0-.

'supported_on': ['chrome.*:1-', 'chrome_os:54-', 'android:54-'],

记得同时需要修改chrome.*chrome.win对应的版本号兼容值。

chromium版本兼容性信息

修改后效果:
chromium 版本号修改

编译错误提示

[528/32355] ACTION //chrome/browser/metrics:expired_histograms_array(//build/toolchain/win:win_clang_x86)
FAILED: gen/chrome/browser/metrics/expired_histograms_array.h
D:/git/chromium/depot_tools/win_tools-2_7_6_bin/python/bin/python.exe ../../tools/metrics/histograms/generate_expired_histograms_array.py -nchrome_metrics -ogen -Hchrome/browser/metrics/expired_histograms_array.h -d../../chrome/MAJOR_BRANCH_DATE -mD:/git/chromium/src/chrome/VERSION ../../tools/metrics/histograms/histograms.xml ../../tools/metrics/histograms/enums.xml
Traceback (most recent call last):
  File "../../tools/metrics/histograms/generate_expired_histograms_array.py", line 262, in <module>
    sys.exit(main())
  File "../../tools/metrics/histograms/generate_expired_histograms_array.py", line 258, in main
    _GenerateFile(arguments)
  File "../../tools/metrics/histograms/generate_expired_histograms_array.py", line 206, in _GenerateFile
    current_milestone = _GetCurrentMilestone(file_content, _CURRENT_MILESTONE_RE)
  File "../../tools/metrics/histograms/generate_expired_histograms_array.py", line 136, in _GetCurrentMilestone
    return int(_FindMatch(content, regex, 1))
  File "../../tools/metrics/histograms/generate_expired_histograms_array.py", line 93, in _FindMatch
    format(pattern=regex.pattern, content=content))
__main__.Error: Unable to match MAJOR=([0-9]{2,3})\n with provided content: MAJOR=1
MINOR=0
BUILD=0
PATCH=7

需要修改匹配位置:

_CURRENT_MILESTONE_RE = re.compile(r"MAJOR=([0-9]{2,3})\n")
_MILESTONE_EXPIRY_RE = re.compile(r"\AM([0-9]{2,3})")

改为:

扫描二维码关注公众号,回复: 2889548 查看本文章
_CURRENT_MILESTONE_RE = re.compile(r"MAJOR=([0-9]{1,3})\n")
_MILESTONE_EXPIRY_RE = re.compile(r"\AM([0-9]{1,3})")

猜你喜欢

转载自blog.csdn.net/longji/article/details/81807299