mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 18:49:37 +00:00
[vm] Tweak version.cc generation
Actuallly generate null SDK hash in version.cc when verify_sdk_hash is set to false. Previously it also required setting dart_version_git_info to false. R=cskau@google.com Change-Id: Ib81757c898507029c499c7c3fa17a86b3375d25b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161701 Reviewed-by: Clement Skau <cskau@google.com> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
parent
a0f67bc9ed
commit
566fd8af36
|
@ -284,4 +284,7 @@ action("generate_version_cc_file") {
|
||||||
if (!dart_version_git_info) {
|
if (!dart_version_git_info) {
|
||||||
args += [ "--no_git_hash" ]
|
args += [ "--no_git_hash" ]
|
||||||
}
|
}
|
||||||
|
if (!verify_sdk_hash) {
|
||||||
|
args += [ "--no_sdk_hash" ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,9 @@ def GetSemanticVersionFormat(no_git_hash):
|
||||||
|
|
||||||
def FormatVersionString(version,
|
def FormatVersionString(version,
|
||||||
no_git_hash,
|
no_git_hash,
|
||||||
|
no_sdk_hash,
|
||||||
version_file=None,
|
version_file=None,
|
||||||
git_revision_file=None):
|
git_revision_file=None):
|
||||||
use_git_hash = not no_git_hash
|
|
||||||
|
|
||||||
semantic_sdk_version = utils.GetSemanticSDKVersion(no_git_hash,
|
semantic_sdk_version = utils.GetSemanticSDKVersion(no_git_hash,
|
||||||
version_file,
|
version_file,
|
||||||
git_revision_file)
|
git_revision_file)
|
||||||
|
@ -71,7 +70,8 @@ def FormatVersionString(version,
|
||||||
version = version.replace('{{SEMANTIC_SDK_VERSION}}', semantic_sdk_version)
|
version = version.replace('{{SEMANTIC_SDK_VERSION}}', semantic_sdk_version)
|
||||||
|
|
||||||
git_hash = None
|
git_hash = None
|
||||||
if use_git_hash:
|
# If we need SDK hash and git usage is not suppressed then try to get it.
|
||||||
|
if not no_sdk_hash and not no_git_hash:
|
||||||
git_hash = utils.GetShortGitHash()
|
git_hash = utils.GetShortGitHash()
|
||||||
if git_hash is None or len(git_hash) != 10:
|
if git_hash is None or len(git_hash) != 10:
|
||||||
git_hash = '0000000000'
|
git_hash = '0000000000'
|
||||||
|
@ -81,7 +81,7 @@ def FormatVersionString(version,
|
||||||
version = version.replace('{{CHANNEL}}', channel)
|
version = version.replace('{{CHANNEL}}', channel)
|
||||||
|
|
||||||
version_time = None
|
version_time = None
|
||||||
if use_git_hash:
|
if not no_git_hash:
|
||||||
version_time = utils.GetGitTimestamp()
|
version_time = utils.GetGitTimestamp()
|
||||||
if version_time == None:
|
if version_time == None:
|
||||||
version_time = 'Unknown timestamp'
|
version_time = 'Unknown timestamp'
|
||||||
|
@ -104,6 +104,11 @@ def main():
|
||||||
default=False,
|
default=False,
|
||||||
help=('Don\'t try to call git to derive things like '
|
help=('Don\'t try to call git to derive things like '
|
||||||
'git revision hash.'))
|
'git revision hash.'))
|
||||||
|
parser.add_argument(
|
||||||
|
'--no_sdk_hash',
|
||||||
|
action='store_true',
|
||||||
|
default=False,
|
||||||
|
help='Use null SDK hash to disable SDK verification in the VM')
|
||||||
parser.add_argument('--output', help='output file name')
|
parser.add_argument('--output', help='output file name')
|
||||||
parser.add_argument('-q',
|
parser.add_argument('-q',
|
||||||
'--quiet',
|
'--quiet',
|
||||||
|
@ -133,7 +138,8 @@ def main():
|
||||||
raise 'No version template given! Set either --input or --format.'
|
raise 'No version template given! Set either --input or --format.'
|
||||||
|
|
||||||
version = FormatVersionString(version_template, args.no_git_hash,
|
version = FormatVersionString(version_template, args.no_git_hash,
|
||||||
args.version_file, args.git_revision_file)
|
args.no_sdk_hash, args.version_file,
|
||||||
|
args.git_revision_file)
|
||||||
|
|
||||||
if args.output:
|
if args.output:
|
||||||
with open(args.output, 'w') as fh:
|
with open(args.output, 'w') as fh:
|
||||||
|
|
Loading…
Reference in a new issue