| # Copyright 2018 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/package.gni") |
| |
| group("garnet") { |
| testonly = true |
| |
| deps = [ |
| ":build-info", |
| "bin", |
| "examples", |
| |
| # TODO: Add more. |
| ] |
| } |
| |
| declare_args() { |
| # Product configuration of the current build |
| build_info_product = "" |
| |
| # Board configuration of the current build |
| build_info_board = board_name |
| |
| # Logical version of the current build. If not set, defaults to the timestamp |
| # of the most recent update. |
| build_info_version = "" |
| } |
| |
| build_info_files = { |
| product = "$target_gen_dir/product.txt" |
| board = "$target_gen_dir/board.txt" |
| version = "$target_gen_dir/version.txt" |
| jiri_snapshot = "//.jiri_root/update_history/latest" |
| latest_commit_date = "$target_gen_dir/latest-commit-date.txt" |
| } |
| |
| write_file(build_info_files.product, build_info_product) |
| write_file(build_info_files.board, build_info_board) |
| |
| if (build_info_version != "") { |
| write_file(build_info_files.version, build_info_version) |
| } else { |
| build_info_files.version = build_info_files.latest_commit_date |
| } |
| |
| package("build-info") { |
| deps = [ |
| ":latest-commit-date.txt", |
| ] |
| resources = [ |
| { |
| dest = "product" |
| path = build_info_files.product |
| }, |
| { |
| dest = "board" |
| path = build_info_files.board |
| }, |
| { |
| dest = "version" |
| path = build_info_files.version |
| }, |
| { |
| dest = "snapshot" |
| path = build_info_files.jiri_snapshot |
| }, |
| { |
| dest = "latest-commit-date" |
| path = build_info_files.latest_commit_date |
| } |
| ] |
| } |
| |
| action("latest-commit-date.txt") { |
| visibility = [ ":*" ] |
| |
| # 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, |
| ] |
| script = "tools/gen-latest-commit-date.sh" |
| args = rebase_path([ "//integration/" ] + outputs, root_build_dir) |
| } |