From 170e014e67dc508f2311f3bb405410550302aaa1 Mon Sep 17 00:00:00 2001 From: Zach Anderson Date: Thu, 7 Mar 2024 04:11:48 +0000 Subject: [PATCH] [gn] Add an option to specify the sdk_hash For https://github.com/flutter/flutter/issues/144430 Would it work for the flutter engine build to just use a prefix of the dart-lang/sdk git hash for this? Change-Id: I086d5484652ef7486cbe052519d3a0fd3159ce44 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356122 Reviewed-by: Siva Annamalai Commit-Queue: Zach Anderson --- sdk_args.gni | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sdk_args.gni b/sdk_args.gni index 0d6bc7a569d..b511f76d3e9 100644 --- a/sdk_args.gni +++ b/sdk_args.gni @@ -25,6 +25,11 @@ declare_args() { # into a VM which was built with a different SDK. verify_sdk_hash = true + # When verify_sdk_hash is true, this string is used as the verification hash + # instead of calculating one from the contents of the tree using the + # make_version.py script. + dart_sdk_verification_hash = "" + # The location in the build output directory of the built Dart SDK. dart_sdk_output = "dart-sdk" } @@ -41,14 +46,17 @@ if (default_git_folder == "") { # The SDK hash to build into VM and kernels. # The value 0000000000 signifies no hash is set, which will disable the check. if (verify_sdk_hash) { - sdk_hash = exec_script("$_dart_root/tools/make_version.py", - [ "--format={{GIT_HASH}}" ], - "trim string", - [ - "$_dart_root/tools/VERSION", - "$_dart_root/tools/utils.py", - "$default_git_folder/logs/HEAD", - ]) + sdk_hash = dart_sdk_verification_hash + if (sdk_hash == "") { + sdk_hash = exec_script("$_dart_root/tools/make_version.py", + [ "--format={{GIT_HASH}}" ], + "trim string", + [ + "$_dart_root/tools/VERSION", + "$_dart_root/tools/utils.py", + "$default_git_folder/logs/HEAD", + ]) + } } else { sdk_hash = "0000000000" }