xref: /aosp_15_r20/external/angle/build/timestamp.gni (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker# Copyright 2018 The Chromium Authors
2*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
3*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file.
4*8975f5c5SAndroid Build Coastguard Worker#
5*8975f5c5SAndroid Build Coastguard Worker# Defines the build_timestamp variable.
6*8975f5c5SAndroid Build Coastguard Worker
7*8975f5c5SAndroid Build Coastguard Workerimport("//build/util/lastchange.gni")
8*8975f5c5SAndroid Build Coastguard Worker
9*8975f5c5SAndroid Build Coastguard Workerdeclare_args() {
10*8975f5c5SAndroid Build Coastguard Worker  # This should be the filename of a script that prints a single line
11*8975f5c5SAndroid Build Coastguard Worker  # containing an integer that's a unix timestamp in UTC.
12*8975f5c5SAndroid Build Coastguard Worker  # This timestamp is used as build time and will be compiled into
13*8975f5c5SAndroid Build Coastguard Worker  # other code.
14*8975f5c5SAndroid Build Coastguard Worker  #
15*8975f5c5SAndroid Build Coastguard Worker  # This argument may look unused. Before removing please check with the
16*8975f5c5SAndroid Build Coastguard Worker  # chromecast team to see if they still use it internally.
17*8975f5c5SAndroid Build Coastguard Worker  compute_build_timestamp = "compute_build_timestamp.py"
18*8975f5c5SAndroid Build Coastguard Worker}
19*8975f5c5SAndroid Build Coastguard Worker
20*8975f5c5SAndroid Build Coastguard Workerif (is_official_build) {
21*8975f5c5SAndroid Build Coastguard Worker  official_name = "official"
22*8975f5c5SAndroid Build Coastguard Worker} else {
23*8975f5c5SAndroid Build Coastguard Worker  official_name = "default"
24*8975f5c5SAndroid Build Coastguard Worker}
25*8975f5c5SAndroid Build Coastguard Worker
26*8975f5c5SAndroid Build Coastguard Worker# This will return a timestamp that's different each day (official builds)
27*8975f5c5SAndroid Build Coastguard Worker# or each month (regular builds).  Just rely on gn rerunning due to other
28*8975f5c5SAndroid Build Coastguard Worker# changes to keep this up to date.  (Bots run gn on each build, and for devs
29*8975f5c5SAndroid Build Coastguard Worker# the timestamp being 100% accurate doesn't matter.)
30*8975f5c5SAndroid Build Coastguard Worker# See compute_build_timestamp.py for tradeoffs for picking the timestamp.
31*8975f5c5SAndroid Build Coastguard Workerbuild_timestamp = exec_script(compute_build_timestamp,
32*8975f5c5SAndroid Build Coastguard Worker                              [ official_name ],
33*8975f5c5SAndroid Build Coastguard Worker                              "trim string",
34*8975f5c5SAndroid Build Coastguard Worker                              [ lastchange_file ])
35