Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ca347e2

Browse files
committed
Shift git version fetching to tools/gn
1 parent 8984ada commit ca347e2

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tools/gn

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,40 @@ def setup_apple_sdks():
344344
return sdks_gn_args
345345

346346

347+
def get_repository_version(repository):
348+
'Returns the Git HEAD for the supplied repository path as a string.'
349+
if not os.path.exists(repository):
350+
raise IOError('path does not exist')
351+
352+
git = 'git'
353+
if sys.platform.startswith(('cygwin', 'win')):
354+
git = 'git.bat'
355+
version = subprocess.check_output([
356+
git,
357+
'-C',
358+
repository,
359+
'rev-parse',
360+
'HEAD',
361+
])
362+
363+
return str(version.strip(), 'utf-8')
364+
365+
366+
def setup_git_versions():
367+
revision_args = {}
368+
369+
engine_path = os.path.join(SRC_ROOT, 'flutter')
370+
revision_args['engine_version'] = get_repository_version(engine_path)
371+
372+
skia_path = os.path.join(SRC_ROOT, 'flutter', 'third_party', 'skia')
373+
revision_args['skia_version'] = get_repository_version(skia_path)
374+
375+
dart_path = os.path.join(SRC_ROOT, 'third_party', 'dart')
376+
revision_args['dart_version'] = get_repository_version(dart_path)
377+
378+
return revision_args
379+
380+
347381
def to_gn_args(args):
348382
if args.simulator:
349383
if args.target_os != 'ios':
@@ -355,6 +389,8 @@ def to_gn_args(args):
355389

356390
gn_args['is_debug'] = args.unoptimized
357391

392+
gn_args.update(setup_git_versions())
393+
358394
gn_args.update(setup_goma(args))
359395

360396
gn_args.update(setup_rbe(args))
@@ -697,6 +733,8 @@ def to_gn_args(args):
697733
# for a host Windows build and make GN think we will be building ANGLE.
698734
# Angle is not used on Mac hosts as there are no tests for the OpenGL backend.
699735
if is_host_build(args) or (args.target_os == 'android' and get_host_os() == 'win'):
736+
# Don't include git commit information.
737+
gn_args['angle_enable_commit_id'] = False
700738
# Do not build unnecessary parts of the ANGLE tree.
701739
gn_args['angle_build_all'] = False
702740
gn_args['angle_has_astc_encoder'] = False

0 commit comments

Comments
 (0)