Primiano Tucci | ec59013 | 2020-11-16 14:16:44 +0100 | [diff] [blame] | 1 | # Copyright (C) 2020 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | # This action generates a perfetto_version.gen.h which exposes some |
| 16 | # PERFETTO_VERSION_xxx() macros that contains the git revision and release |
| 17 | # number from the CHANGELOG. |
| 18 | # This template is used only in two places: in //base (for C++ code) and in |
| 19 | # //ui. This teamplate exists only to keep the logic consistent and avoid that |
| 20 | # base's and ui's logic diverge. |
| 21 | |
| 22 | import("perfetto.gni") |
| 23 | |
| 24 | template("gen_perfetto_version_header") { |
| 25 | action(target_name) { |
| 26 | script = "${perfetto_root_path}tools/write_version_header.py" |
Primiano Tucci | f0ed1d4 | 2020-11-18 16:30:18 +0100 | [diff] [blame] | 27 | changelog = "${perfetto_root_path}CHANGELOG" |
| 28 | inputs = [ changelog ] |
Primiano Tucci | ec59013 | 2020-11-16 14:16:44 +0100 | [diff] [blame] | 29 | outputs = [] |
| 30 | args = [] |
| 31 | if (perfetto_build_standalone && !is_perfetto_build_generator) { |
| 32 | inputs += [ "${perfetto_root_path}.git/HEAD" ] |
| 33 | } |
| 34 | |
| 35 | if (defined(invoker.cpp_out)) { |
| 36 | args += [ |
Primiano Tucci | f0ed1d4 | 2020-11-18 16:30:18 +0100 | [diff] [blame] | 37 | "--changelog", |
| 38 | rebase_path(changelog, root_build_dir), |
Primiano Tucci | ec59013 | 2020-11-16 14:16:44 +0100 | [diff] [blame] | 39 | "--cpp_out", |
| 40 | rebase_path(invoker.cpp_out, root_build_dir), |
| 41 | ] |
| 42 | outputs += [ invoker.cpp_out ] |
| 43 | } |
| 44 | if (defined(invoker.ts_out)) { |
| 45 | args += [ |
| 46 | "--ts_out", |
| 47 | rebase_path(invoker.ts_out, root_build_dir), |
| 48 | ] |
| 49 | outputs += [ invoker.ts_out ] |
| 50 | } |
| 51 | } |
| 52 | } |