diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index ea85616ceef..8cd05ff445c 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -447,9 +447,7 @@ action("generate_version_cc_file") { "vm/symbols.cc", "vm/symbols.h", ] - if (dart_version_git_info) { - inputs += [ "$default_git_folder/logs/HEAD" ] - } + deps = [ "../utils:git_version" ] output = "$target_gen_dir/version.cc" outputs = [ output ] diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index b4305224cc1..82be584fc4e 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -781,10 +781,8 @@ group("copy_libraries") { # This rule writes the version file. action("write_version_file") { visibility = [ ":create_common_sdk" ] - inputs = [ - "../tools/VERSION", - "$default_git_folder/logs/HEAD", - ] + inputs = [ "../tools/VERSION" ] + deps = [ "../utils:git_version" ] output = "$root_out_dir/$dart_sdk_output/version" outputs = [ output ] script = "../tools/write_version_file.py" @@ -800,7 +798,7 @@ action("write_version_file") { # This rule writes the revision file. action("write_revision_file") { visibility = [ ":create_common_sdk" ] - inputs = [ "$default_git_folder/logs/HEAD" ] + deps = [ "../utils:git_version" ] output = "$root_out_dir/$dart_sdk_output/revision" outputs = [ output ] script = "../tools/write_revision_file.py" @@ -830,7 +828,7 @@ copy("copy_license") { # This rule generates a custom dartdoc_options.yaml file. action("write_dartdoc_options") { visibility = [ ":create_common_sdk" ] - inputs = [ "$default_git_folder/logs/HEAD" ] + deps = [ "../utils:git_version" ] output = "$root_out_dir/$dart_sdk_output/dartdoc_options.yaml" outputs = [ output ] script = "../tools/write_dartdoc_options_file.py" diff --git a/sdk_args.gni b/sdk_args.gni index ba5d04f0bac..84e8983fb29 100644 --- a/sdk_args.gni +++ b/sdk_args.gni @@ -5,13 +5,6 @@ _dart_root = get_path_info(".", "abspath") declare_args() { - # Absolute path to the .git folder. - # - # This variable is potentially no longer needed as an gn arg. It was first - # exposed to allow adjusting the location for `git-worktrees`, but now the - # `get_dot_git_folder.py` script below properly accounts for that. - default_git_folder = "" - # Whether to enable the SDK hash check that will prevent loading a kernel # into a VM which was built with a different SDK. verify_sdk_hash = true @@ -37,15 +30,6 @@ declare_args() { include_experimental_vm_service = false } -if (default_git_folder == "") { - default_git_folder = exec_script("$_dart_root/tools/get_dot_git_folder.py", - [ - rebase_path("$_dart_root/.git"), - "$_dart_root/.git", - ], - "trim string") -} - # 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) { @@ -53,12 +37,7 @@ if (verify_sdk_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", - ]) + "trim string") } } else { sdk_hash = "0000000000" diff --git a/third_party/binaryen/BUILD.gn b/third_party/binaryen/BUILD.gn index 80344e4f857..ebdfa32ccb3 100644 --- a/third_party/binaryen/BUILD.gn +++ b/third_party/binaryen/BUILD.gn @@ -106,7 +106,7 @@ source_set("binaryen_sources") { exec_script("list_sources.py", [ rebase_path(src_dir, root_build_dir) ], "list lines", - [ "$default_git_folder/logs/HEAD" ])) { + [ "../../DEPS" ])) { sources += [ "$src_dir/$src_file" ] } } diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 15fc3c1cd77..c0e36c09559 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -57,3 +57,9 @@ aot_compile_using_prebuilt_sdk("gen_kernel.exe") { output = "$root_out_dir/gen_kernel.exe" package_config = "$_dart_root/.dart_tool/package_config.json" } + +# Does not write to the file if the content is unchanged. +generated_file("git_version") { + outputs = [ "$target_gen_dir/git_version" ] + contents = exec_script("../tools/make_version.py", [], "trim string") +}