Hector Dearman | 2c650f8 | 2017-11-08 10:51:45 +0000 | [diff] [blame] | 1 | # Copyright (C) 2017 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 | |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 15 | import("../../gn/perfetto.gni") |
| 16 | import("../../protozero/protozero_library.gni") |
Hector Dearman | 37e0553 | 2017-11-14 15:35:22 +0000 | [diff] [blame] | 17 | import("all_protos.gni") |
| 18 | |
| 19 | # Create a copy of all the protos listed in all_protos.gni with the |
| 20 | # "option optimize_for = LITE_RUNTIME" bit removed so we can generate |
| 21 | # full proto .h/.cc files. |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 22 | full_protos_base_dir = "${root_gen_dir}/protos_full" |
Primiano Tucci | 2ee254a | 2017-11-15 00:38:48 +0000 | [diff] [blame] | 23 | full_protos_target_dir = |
| 24 | "$full_protos_base_dir/" + rebase_path(target_gen_dir, root_gen_dir) |
| 25 | |
Hector Dearman | 37e0553 | 2017-11-14 15:35:22 +0000 | [diff] [blame] | 26 | action_foreach("generate_full_protos") { |
| 27 | visibility = [ ":*" ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 28 | script = "../../build/generate_full_protos.py" |
Hector Dearman | 37e0553 | 2017-11-14 15:35:22 +0000 | [diff] [blame] | 29 | sources = ftrace_proto_names |
| 30 | |
| 31 | # TODO(hjd): Add support for subdirectories. |
Primiano Tucci | 2ee254a | 2017-11-15 00:38:48 +0000 | [diff] [blame] | 32 | output_directory = full_protos_target_dir |
Hector Dearman | 37e0553 | 2017-11-14 15:35:22 +0000 | [diff] [blame] | 33 | outputs = [ |
| 34 | "$output_directory/{{source_name_part}}.proto", |
| 35 | ] |
| 36 | |
| 37 | args = [ |
| 38 | "{{source}}", |
| 39 | rebase_path(output_directory, root_build_dir) + |
| 40 | "/{{source_name_part}}.proto", |
| 41 | ] |
| 42 | } |
| 43 | |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 44 | proto_library("full") { |
| 45 | testonly = true |
Hector Dearman | 37e0553 | 2017-11-14 15:35:22 +0000 | [diff] [blame] | 46 | deps = [ |
| 47 | ":generate_full_protos", |
| 48 | ] |
| 49 | sources = [] |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 50 | use_protobuf_full = true |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 51 | proto_in_dir = "$full_protos_base_dir/" + perfetto_root_path |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 52 | proto_out_dir = "protos_full" |
Hector Dearman | 37e0553 | 2017-11-14 15:35:22 +0000 | [diff] [blame] | 53 | foreach(proto, ftrace_proto_names) { |
Primiano Tucci | 2ee254a | 2017-11-15 00:38:48 +0000 | [diff] [blame] | 54 | sources += [ "$full_protos_target_dir/$proto" ] |
Hector Dearman | 37e0553 | 2017-11-14 15:35:22 +0000 | [diff] [blame] | 55 | } |
Hector Dearman | 37e0553 | 2017-11-14 15:35:22 +0000 | [diff] [blame] | 56 | } |
Hector Dearman | 2c650f8 | 2017-11-08 10:51:45 +0000 | [diff] [blame] | 57 | |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 58 | proto_library("lite") { |
Hector Dearman | 37e0553 | 2017-11-14 15:35:22 +0000 | [diff] [blame] | 59 | sources = ftrace_proto_names |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 60 | proto_in_dir = perfetto_root_path |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 61 | proto_out_dir = "protos_lite" |
| 62 | } |
| 63 | |
| 64 | protozero_library("zero") { |
| 65 | sources = ftrace_proto_names |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame^] | 66 | proto_in_dir = perfetto_root_path |
Primiano Tucci | 782374f | 2017-11-27 16:25:20 +0000 | [diff] [blame] | 67 | proto_out_dir = "protos_zero" |
Primiano Tucci | 5f48d7b | 2017-11-27 16:57:13 +0000 | [diff] [blame] | 68 | generator_plugin_options = "wrapper_namespace=pbzero" |
Hector Dearman | 2c650f8 | 2017-11-08 10:51:45 +0000 | [diff] [blame] | 69 | } |