blob: 29e02e99c657817f196062d295e4a68e5c64fab8 [file] [log] [blame]
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This action generates a perfetto_version.gen.h which exposes some
# PERFETTO_VERSION_xxx() macros that contains the git revision and release
# number from the CHANGELOG.
# This template is used only in two places: in //base (for C++ code) and in
# //ui. This teamplate exists only to keep the logic consistent and avoid that
# base's and ui's logic diverge.
import("perfetto.gni")
template("gen_perfetto_version_header") {
action(target_name) {
script = "${perfetto_root_path}tools/write_version_header.py"
changelog = "${perfetto_root_path}CHANGELOG"
inputs = [ changelog ]
outputs = []
args = []
if (perfetto_build_standalone && !is_perfetto_build_generator) {
inputs += [ "${perfetto_root_path}.git/HEAD" ]
}
if (defined(invoker.cpp_out)) {
args += [
"--changelog",
rebase_path(changelog, root_build_dir),
"--cpp_out",
rebase_path(invoker.cpp_out, root_build_dir),
]
outputs += [ invoker.cpp_out ]
}
if (defined(invoker.ts_out)) {
args += [
"--ts_out",
rebase_path(invoker.ts_out, root_build_dir),
]
outputs += [ invoker.ts_out ]
}
}
}