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

Commit e6ddd23

Browse files
committed
Move git revision fetching
1 parent 2706c73 commit e6ddd23

File tree

7 files changed

+78
-1
lines changed

7 files changed

+78
-1
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,8 @@ app.*.symbols
142142

143143
# The gn-sdk from Chromium and managed by DEPS and gclient.
144144
/tools/fuchsia/gn-sdk
145+
146+
# Git revision files created by gclient runhooks
147+
engine.revision
148+
dart.revision
149+
skia.revision

DEPS

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,5 +1236,41 @@ hooks = [
12361236
'--as-gclient-hook',
12371237
Var('mac_sdk_min')
12381238
]
1239+
},
1240+
{
1241+
'name': 'Get Engine git revision',
1242+
'pattern': '.',
1243+
'action': [
1244+
'python3',
1245+
'src/flutter/build/git_revision.py',
1246+
'--repository',
1247+
'src/flutter',
1248+
'--output',
1249+
'src/flutter/engine.revision',
1250+
]
1251+
},
1252+
{
1253+
'name': 'Get Skia git revision',
1254+
'pattern': '.',
1255+
'action': [
1256+
'python3',
1257+
'src/flutter/build/git_revision.py',
1258+
'--repository',
1259+
'src/flutter/third_party/skia',
1260+
'--output',
1261+
'src/flutter/skia.revision',
1262+
]
1263+
},
1264+
{
1265+
'name': 'Get Dart git revision',
1266+
'pattern': '.',
1267+
'action': [
1268+
'python3',
1269+
'src/flutter/build/git_revision.py',
1270+
'--repository',
1271+
'src/third_party/dart',
1272+
'--output',
1273+
'src/flutter/dart.revision',
1274+
]
12391275
}
12401276
]

build/git_revision.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,18 @@ def main():
4242
parser.add_argument(
4343
'--repository', action='store', help='Path to the Git repository.', required=True
4444
)
45+
parser.add_argument(
46+
'--output', action='store', help='Write revision to a file at this path instead of printing.'
47+
)
4548

4649
args = parser.parse_args()
4750
repository = os.path.abspath(args.repository)
4851
version = get_repository_version(repository)
52+
53+
if args.output:
54+
with open(args.output, 'w') as file:
55+
file.write(version.strip())
56+
4957
print(version.strip())
5058

5159
return 0

ci/licenses_golden/excluded_files

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
../../../flutter/build
2929
../../../flutter/ci
3030
../../../flutter/common/README.md
31+
../../../flutter/dart.revision
3132
../../../flutter/display_list/benchmarking/dl_complexity_unittests.cc
3233
../../../flutter/display_list/display_list_unittests.cc
3334
../../../flutter/display_list/dl_color_unittests.cc
@@ -45,6 +46,7 @@
4546
../../../flutter/display_list/testing
4647
../../../flutter/display_list/utils/dl_matrix_clip_tracker_unittests.cc
4748
../../../flutter/docs
49+
../../../flutter/engine.revision
4850
../../../flutter/examples
4951
../../../flutter/flow/README.md
5052
../../../flutter/flow/diff_context_unittests.cc
@@ -401,6 +403,7 @@
401403
../../../flutter/shell/vmservice/.dart_tool
402404
../../../flutter/shell/vmservice/pubspec.lock
403405
../../../flutter/shell/vmservice/pubspec.yaml
406+
../../../flutter/skia.revision
404407
../../../flutter/sky/packages/sky_engine/.gitignore
405408
../../../flutter/sky/packages/sky_engine/LICENSE
406409
../../../flutter/sky/packages/sky_engine/README.md

ci/licenses_golden/tool_signature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Signature: 04fdc5b7c8d5b1690149c9aa20f4174d
1+
Signature: 9c3527789c4195b860c094208c53f101
22

tools/gn

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

346346

347+
def setup_git_versions():
348+
revision_args = {}
349+
350+
engine_version_file = os.path.join(SRC_ROOT, 'flutter', 'engine.revision')
351+
with open(engine_version_file, encoding='utf-8') as file:
352+
revision_args['engine_version'] = file.read().strip()
353+
354+
skia_version_file = os.path.join(SRC_ROOT, 'flutter', 'skia.revision')
355+
with open(skia_version_file, encoding='utf-8') as file:
356+
revision_args['skia_version'] = file.read().strip()
357+
358+
dart_version_file = os.path.join(SRC_ROOT, 'flutter', 'dart.revision')
359+
with open(dart_version_file, encoding='utf-8') as file:
360+
revision_args['dart_version'] = file.read().strip()
361+
362+
return revision_args
363+
364+
347365
def to_gn_args(args):
348366
if args.simulator:
349367
if args.target_os != 'ios':
@@ -355,6 +373,8 @@ def to_gn_args(args):
355373

356374
gn_args['is_debug'] = args.unoptimized
357375

376+
gn_args.update(setup_git_versions())
377+
358378
gn_args.update(setup_goma(args))
359379

360380
gn_args.update(setup_rbe(args))
@@ -697,6 +717,8 @@ def to_gn_args(args):
697717
# for a host Windows build and make GN think we will be building ANGLE.
698718
# Angle is not used on Mac hosts as there are no tests for the OpenGL backend.
699719
if is_host_build(args) or (args.target_os == 'android' and get_host_os() == 'win'):
720+
# Don't include git commit information.
721+
gn_args['angle_enable_commit_id'] = False
700722
# Do not build unnecessary parts of the ANGLE tree.
701723
gn_args['angle_build_all'] = False
702724
gn_args['angle_has_astc_encoder'] = False

tools/licenses/lib/paths.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ final Set<String> skippedPaths = <String>{
2222
r'buildtools', // only used by build
2323
r'flutter/build',
2424
r'flutter/ci',
25+
r'flutter/dart.revision', // only used by build
2526
r'flutter/docs',
27+
r'flutter/engine.revision', // only used by build
2628
r'flutter/flutter_frontend_server',
2729
r'flutter/impeller/docs',
2830
r'flutter/lib/web_ui/build', // this is compiler-generated output
2931
r'flutter/lib/web_ui/dev', // these are build tools; they do not end up in Engine artifacts
3032
r'flutter/prebuilts',
33+
r'flutter/skia.revision', // only used by build
3134
r'flutter/sky/packages/sky_engine/LICENSE',
3235
r'flutter/third_party/benchmark', // only used by tests
3336
r'flutter/third_party/boringssl/src/crypto/err/err_data_generate.go',

0 commit comments

Comments
 (0)