diff --git a/.gitignore b/.gitignore index aa52914644cac..e0a6d2d6941b9 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/DEPS b/DEPS index c19652df4f388..75d55986c2ac3 100644 --- a/DEPS +++ b/DEPS @@ -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', + ] } ] diff --git a/build/git_revision.py b/build/git_revision.py index 8f7759e51f0fa..73fdca6b12e0a 100755 --- a/build/git_revision.py +++ b/build/git_revision.py @@ -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 diff --git a/ci/licenses_golden/excluded_files b/ci/licenses_golden/excluded_files index d2b44db10e2a6..ef2d28528334a 100644 --- a/ci/licenses_golden/excluded_files +++ b/ci/licenses_golden/excluded_files @@ -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 @@ -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 @@ -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 diff --git a/ci/licenses_golden/tool_signature b/ci/licenses_golden/tool_signature index 2178fa581da37..eaef080de940d 100644 --- a/ci/licenses_golden/tool_signature +++ b/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: 04fdc5b7c8d5b1690149c9aa20f4174d +Signature: 9c3527789c4195b860c094208c53f101 diff --git a/tools/gn b/tools/gn index 67916000bc813..45cd53042b3f6 100755 --- a/tools/gn +++ b/tools/gn @@ -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': @@ -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)) @@ -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 diff --git a/tools/licenses/lib/paths.dart b/tools/licenses/lib/paths.dart index 6fb05be72f844..b0c117154f03e 100644 --- a/tools/licenses/lib/paths.dart +++ b/tools/licenses/lib/paths.dart @@ -22,12 +22,15 @@ final Set skippedPaths = { 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',