| # 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", |
| ] |
| } |
| |
| # Ensure this action is invoked if integration HEAD moves |
| _inputs = [ |
| # LINT.IfChange |
| "//build/info/jiri_generated/integration_commit_hash.txt", |
| "//build/info/jiri_generated/integration_commit_stamp.txt", |
| |
| # LINT.ThenChange(//build/info/create_jiri_hook_files.sh) |
| ] |
| |
| # LINT.IfChange |
| action("latest-commit-date-and-hash") { |
| visibility = [ |
| ":*", |
| "bootfs/*", |
| ] |
| |
| inputs = _inputs |
| 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 = [ |
| "--input-hash-file", |
| rebase_path(inputs[0], root_build_dir), |
| "--input-stamp-file", |
| rebase_path(inputs[1], 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" ] |
| } |
| |
| # LINT.ThenChange(//build/info/info.bzl) |
| } |
| |
| 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" ] |
| } |
| } |
| } |