[build] Don't depend on the Git repo using --ref-format=files.

With the newer --ref-format=reftable, .git/logs/HEAD does not exist, so the version generation steps would always be considered dirty.

Cf. c7e58f832a

Change-Id: Id8735a739b751e4a54c2e4beecbef1eb23771c53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/488600
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2026-03-24 15:36:36 -07:00
committed by Commit Queue
parent 8779faa131
commit 0a376fb28d
5 changed files with 13 additions and 32 deletions
+1 -3
View File
@@ -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 ]
+4 -6
View File
@@ -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"
+1 -22
View File
@@ -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"
+1 -1
View File
@@ -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" ]
}
}
+6
View File
@@ -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")
}