Skip to content

Commit 0a376fb

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[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. c7e58f8 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>
1 parent 8779faa commit 0a376fb

5 files changed

Lines changed: 13 additions & 32 deletions

File tree

runtime/BUILD.gn

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,7 @@ action("generate_version_cc_file") {
447447
"vm/symbols.cc",
448448
"vm/symbols.h",
449449
]
450-
if (dart_version_git_info) {
451-
inputs += [ "$default_git_folder/logs/HEAD" ]
452-
}
450+
deps = [ "../utils:git_version" ]
453451
output = "$target_gen_dir/version.cc"
454452
outputs = [ output ]
455453

sdk/BUILD.gn

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -781,10 +781,8 @@ group("copy_libraries") {
781781
# This rule writes the version file.
782782
action("write_version_file") {
783783
visibility = [ ":create_common_sdk" ]
784-
inputs = [
785-
"../tools/VERSION",
786-
"$default_git_folder/logs/HEAD",
787-
]
784+
inputs = [ "../tools/VERSION" ]
785+
deps = [ "../utils:git_version" ]
788786
output = "$root_out_dir/$dart_sdk_output/version"
789787
outputs = [ output ]
790788
script = "../tools/write_version_file.py"
@@ -800,7 +798,7 @@ action("write_version_file") {
800798
# This rule writes the revision file.
801799
action("write_revision_file") {
802800
visibility = [ ":create_common_sdk" ]
803-
inputs = [ "$default_git_folder/logs/HEAD" ]
801+
deps = [ "../utils:git_version" ]
804802
output = "$root_out_dir/$dart_sdk_output/revision"
805803
outputs = [ output ]
806804
script = "../tools/write_revision_file.py"
@@ -830,7 +828,7 @@ copy("copy_license") {
830828
# This rule generates a custom dartdoc_options.yaml file.
831829
action("write_dartdoc_options") {
832830
visibility = [ ":create_common_sdk" ]
833-
inputs = [ "$default_git_folder/logs/HEAD" ]
831+
deps = [ "../utils:git_version" ]
834832
output = "$root_out_dir/$dart_sdk_output/dartdoc_options.yaml"
835833
outputs = [ output ]
836834
script = "../tools/write_dartdoc_options_file.py"

sdk_args.gni

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
_dart_root = get_path_info(".", "abspath")
66

77
declare_args() {
8-
# Absolute path to the .git folder.
9-
#
10-
# This variable is potentially no longer needed as an gn arg. It was first
11-
# exposed to allow adjusting the location for `git-worktrees`, but now the
12-
# `get_dot_git_folder.py` script below properly accounts for that.
13-
default_git_folder = ""
14-
158
# Whether to enable the SDK hash check that will prevent loading a kernel
169
# into a VM which was built with a different SDK.
1710
verify_sdk_hash = true
@@ -37,28 +30,14 @@ declare_args() {
3730
include_experimental_vm_service = false
3831
}
3932

40-
if (default_git_folder == "") {
41-
default_git_folder = exec_script("$_dart_root/tools/get_dot_git_folder.py",
42-
[
43-
rebase_path("$_dart_root/.git"),
44-
"$_dart_root/.git",
45-
],
46-
"trim string")
47-
}
48-
4933
# The SDK hash to build into VM and kernels.
5034
# The value 0000000000 signifies no hash is set, which will disable the check.
5135
if (verify_sdk_hash) {
5236
sdk_hash = dart_sdk_verification_hash
5337
if (sdk_hash == "") {
5438
sdk_hash = exec_script("$_dart_root/tools/make_version.py",
5539
[ "--format={{GIT_HASH}}" ],
56-
"trim string",
57-
[
58-
"$_dart_root/tools/VERSION",
59-
"$_dart_root/tools/utils.py",
60-
"$default_git_folder/logs/HEAD",
61-
])
40+
"trim string")
6241
}
6342
} else {
6443
sdk_hash = "0000000000"

third_party/binaryen/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ source_set("binaryen_sources") {
106106
exec_script("list_sources.py",
107107
[ rebase_path(src_dir, root_build_dir) ],
108108
"list lines",
109-
[ "$default_git_folder/logs/HEAD" ])) {
109+
[ "../../DEPS" ])) {
110110
sources += [ "$src_dir/$src_file" ]
111111
}
112112
}

utils/BUILD.gn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,9 @@ aot_compile_using_prebuilt_sdk("gen_kernel.exe") {
5757
output = "$root_out_dir/gen_kernel.exe"
5858
package_config = "$_dart_root/.dart_tool/package_config.json"
5959
}
60+
61+
# Does not write to the file if the content is unchanged.
62+
generated_file("git_version") {
63+
outputs = [ "$target_gen_dir/git_version" ]
64+
contents = exec_script("../tools/make_version.py", [], "trim string")
65+
}

0 commit comments

Comments
 (0)