blob: 4cbb7c4ae10948da996f9c5872df75973c6c8651 [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/board.gni")
import("//build/dist/resource.gni")
import("//build/info/info.gni")
import("//src/sys/build/fuchsia_package.gni")
if (current_toolchain == default_toolchain) {
write_file(build_info_files.product, build_info_product)
write_file(build_info_files.board, board_name)
if (build_info_files.version != build_info_files.latest_commit_date) {
write_file(build_info_files.version, build_info_version)
}
action("latest-commit-date") {
# The script at tools/gen-latest-commit-date.sh script runs the following
# command to compute the latest commit date:
#
# GIT_CONFIG_NOSYSTEM=1 TZ=UTC git --git-dir="$INTEGRATION"/.git log --date=iso-strict-local --format=%cd -n 1 > "$OUTPUT"
#
# That command uses the following files, which means we need to depend on them
# in order to ensure that this GN target will be considered dirty if the
# output of that command would change.
sources = [
"//integration/.git/HEAD",
"//integration/.git/index",
]
outputs = [
build_info_files.latest_commit_date,
build_info_files.minimum_utc_stamp,
]
script = "gen-latest-commit-date.sh"
args = rebase_path([ "//integration/" ] + outputs, root_build_dir)
}
} else {
group("latest-commit-date") {
public_deps = [ ":latest-commit-date($default_toolchain)" ]
}
}
if (is_fuchsia) {
resource_group("build-info-resources") {
files = [
{
source = build_info_files.product
dest = "data/product"
},
{
source = build_info_files.board
dest = "data/board"
},
{
source = build_info_files.version
dest = "data/version"
},
{
source = build_info_files.jiri_snapshot
dest = "data/snapshot"
},
{
source = build_info_files.latest_commit_date
dest = "data/latest-commit-date"
},
{
source = build_info_files.minimum_utc_stamp
dest = "data/minimum-utc-stamp"
},
]
}
fuchsia_package("build-info") {
deps = [ ":build-info-resources" ]
}
resource("bootfs") {
sources = [ build_info_files.minimum_utc_stamp ]
outputs = [ "config/build_info/minimum_utc_stamp" ]
deps = [ ":latest-commit-date" ]
}
}