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

Move git revision fetching #51107

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,8 @@ app.*.symbols

# The gn-sdk from Chromium and managed by DEPS and gclient.
/tools/fuchsia/gn-sdk

# Git revision files created by gclient runhooks
engine.revision
dart.revision
skia.revision
36 changes: 36 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -1236,5 +1236,41 @@ hooks = [
'--as-gclient-hook',
Var('mac_sdk_min')
]
},
{
'name': 'Get Engine git revision',
'pattern': '.',
'action': [
'python3',
'src/flutter/build/git_revision.py',
'--repository',
'src/flutter',
'--output',
'src/flutter/engine.revision',
]
},
{
'name': 'Get Skia git revision',
'pattern': '.',
'action': [
'python3',
'src/flutter/build/git_revision.py',
'--repository',
'src/flutter/third_party/skia',
'--output',
'src/flutter/skia.revision',
]
},
{
'name': 'Get Dart git revision',
'pattern': '.',
'action': [
'python3',
'src/flutter/build/git_revision.py',
'--repository',
'src/third_party/dart',
'--output',
'src/flutter/dart.revision',
]
}
]
8 changes: 8 additions & 0 deletions build/git_revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,18 @@ def main():
parser.add_argument(
'--repository', action='store', help='Path to the Git repository.', required=True
)
parser.add_argument(
'--output', action='store', help='Write revision to a file at this path instead of printing.'
)

args = parser.parse_args()
repository = os.path.abspath(args.repository)
version = get_repository_version(repository)

if args.output:
with open(args.output, 'w') as file:
file.write(version.strip())

print(version.strip())

return 0
Expand Down
3 changes: 3 additions & 0 deletions ci/licenses_golden/excluded_files
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
../../../flutter/build
../../../flutter/ci
../../../flutter/common/README.md
../../../flutter/dart.revision
../../../flutter/display_list/benchmarking/dl_complexity_unittests.cc
../../../flutter/display_list/display_list_unittests.cc
../../../flutter/display_list/dl_color_unittests.cc
Expand All @@ -45,6 +46,7 @@
../../../flutter/display_list/testing
../../../flutter/display_list/utils/dl_matrix_clip_tracker_unittests.cc
../../../flutter/docs
../../../flutter/engine.revision
../../../flutter/examples
../../../flutter/flow/README.md
../../../flutter/flow/diff_context_unittests.cc
Expand Down Expand Up @@ -401,6 +403,7 @@
../../../flutter/shell/vmservice/.dart_tool
../../../flutter/shell/vmservice/pubspec.lock
../../../flutter/shell/vmservice/pubspec.yaml
../../../flutter/skia.revision
../../../flutter/sky/packages/sky_engine/.gitignore
../../../flutter/sky/packages/sky_engine/LICENSE
../../../flutter/sky/packages/sky_engine/README.md
Expand Down
2 changes: 1 addition & 1 deletion ci/licenses_golden/tool_signature
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Signature: 04fdc5b7c8d5b1690149c9aa20f4174d
Signature: 9c3527789c4195b860c094208c53f101

22 changes: 22 additions & 0 deletions tools/gn
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,24 @@ def setup_apple_sdks():
return sdks_gn_args


def setup_git_versions():
revision_args = {}

engine_version_file = os.path.join(SRC_ROOT, 'flutter', 'engine.revision')
with open(engine_version_file, encoding='utf-8') as file:
revision_args['engine_version'] = file.read().strip()

skia_version_file = os.path.join(SRC_ROOT, 'flutter', 'skia.revision')
with open(skia_version_file, encoding='utf-8') as file:
revision_args['skia_version'] = file.read().strip()

dart_version_file = os.path.join(SRC_ROOT, 'flutter', 'dart.revision')
with open(dart_version_file, encoding='utf-8') as file:
revision_args['dart_version'] = file.read().strip()

return revision_args


def to_gn_args(args):
if args.simulator:
if args.target_os != 'ios':
Expand All @@ -355,6 +373,8 @@ def to_gn_args(args):

gn_args['is_debug'] = args.unoptimized

gn_args.update(setup_git_versions())

gn_args.update(setup_goma(args))

gn_args.update(setup_rbe(args))
Expand Down Expand Up @@ -697,6 +717,8 @@ def to_gn_args(args):
# for a host Windows build and make GN think we will be building ANGLE.
# Angle is not used on Mac hosts as there are no tests for the OpenGL backend.
if is_host_build(args) or (args.target_os == 'android' and get_host_os() == 'win'):
# Don't include git commit information.
gn_args['angle_enable_commit_id'] = False
# Do not build unnecessary parts of the ANGLE tree.
gn_args['angle_build_all'] = False
gn_args['angle_has_astc_encoder'] = False
Expand Down
3 changes: 3 additions & 0 deletions tools/licenses/lib/paths.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ final Set<String> skippedPaths = <String>{
r'buildtools', // only used by build
r'flutter/build',
r'flutter/ci',
r'flutter/dart.revision', // only used by build
r'flutter/docs',
r'flutter/engine.revision', // only used by build
r'flutter/flutter_frontend_server',
r'flutter/impeller/docs',
r'flutter/lib/web_ui/build', // this is compiler-generated output
r'flutter/lib/web_ui/dev', // these are build tools; they do not end up in Engine artifacts
r'flutter/prebuilts',
r'flutter/skia.revision', // only used by build
r'flutter/sky/packages/sky_engine/LICENSE',
r'flutter/third_party/benchmark', // only used by tests
r'flutter/third_party/boringssl/src/crypto/err/err_data_generate.go',
Expand Down