@@ -344,6 +344,40 @@ def setup_apple_sdks():
344
344
return sdks_gn_args
345
345
346
346
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
+
347
381
def to_gn_args(args):
348
382
if args.simulator:
349
383
if args.target_os != 'ios':
@@ -355,6 +389,8 @@ def to_gn_args(args):
355
389
356
390
gn_args['is_debug'] = args.unoptimized
357
391
392
+ gn_args.update(setup_git_versions())
393
+
358
394
gn_args.update(setup_goma(args))
359
395
360
396
gn_args.update(setup_rbe(args))
@@ -697,6 +733,8 @@ def to_gn_args(args):
697
733
# for a host Windows build and make GN think we will be building ANGLE.
698
734
# Angle is not used on Mac hosts as there are no tests for the OpenGL backend.
699
735
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
700
738
# Do not build unnecessary parts of the ANGLE tree.
701
739
gn_args['angle_build_all'] = False
702
740
gn_args['angle_has_astc_encoder'] = False
0 commit comments