blob: c396910841dd2aa859d20217befa8e3274a62ca6 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/assembly/bootfs_files_for_assembly.gni")
import("//build/bazel/bazel_inputs.gni")
import("//build/info/info.gni")
declare_args() {
# Truncate the date in the build_info to midnight UTC, and replace the commit
# hash with one that's synthesized from that date.
# LINT.IfChange
truncate_build_info_commit_date = false
# LINT.ThenChange(//build/bazel/gn_build_args.txt)
}
if (current_toolchain == default_toolchain) {
group("build_info_files") {
public_deps = [
":latest-commit-date-and-hash",
":version",
]
}
# LINT.IfChange
action("latest-commit-date-and-hash") {
visibility = [
":*",
"bootfs/*",
]
# Ensure this action is invoked if integration HEAD moves
inputs = [ "//integration/.git/HEAD" ]
outputs = [
build_info_files.latest_commit_date,
build_info_files.minimum_utc_stamp,
build_info_files.latest_commit_hash,
]
script = "gen_latest_commit_date.py"
args = [
"--repo",
rebase_path("//integration/", root_build_dir),
"--timestamp-file",
rebase_path(build_info_files.minimum_utc_stamp, root_build_dir),
"--date-file",
rebase_path(build_info_files.latest_commit_date, root_build_dir),
"--commit-hash-file",
rebase_path(build_info_files.latest_commit_hash, root_build_dir),
]
if (truncate_build_info_commit_date) {
args += [ "--truncate" ]
}
}
if (build_info_version != "") {
generated_file("version") {
outputs = [ build_info_files.version ]
contents = build_info_version
}
} else {
copy("version") {
sources = [ build_info_files.latest_commit_date ]
outputs = [ build_info_files.version ]
deps = [ ":latest-commit-date-and-hash" ]
}
}
# LINT.ThenChange(//build/info/info.bzl)
}