OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Defines a static library corresponding to the output of schema compiler tools | 5 # Defines a static library corresponding to the output of schema compiler tools |
6 # over a set of extensions API schemas (IDL or JSON format.) The library target | 6 # over a set of extensions API schemas (IDL or JSON format.) The library target |
7 # has implicit hard dependencies on all schema files listed by the invoker and | 7 # has implicit hard dependencies on all schema files listed by the invoker and |
8 # is itself a hard dependency. | 8 # is itself a hard dependency. |
9 # | 9 # |
10 # Invocations of this template may use the following variables: | 10 # Invocations of this template may use the following variables: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 "$compiler_root/compiler.py", | 63 "$compiler_root/compiler.py", |
64 "$compiler_root/cpp_generator.py", | 64 "$compiler_root/cpp_generator.py", |
65 "$compiler_root/cpp_type_generator.py", | 65 "$compiler_root/cpp_type_generator.py", |
66 "$compiler_root/cpp_util.py", | 66 "$compiler_root/cpp_util.py", |
67 "$compiler_root/h_generator.py", | 67 "$compiler_root/h_generator.py", |
68 "$compiler_root/idl_schema.py", | 68 "$compiler_root/idl_schema.py", |
69 "$compiler_root/model.py", | 69 "$compiler_root/model.py", |
70 "$compiler_root/util_cc_helper.py", | 70 "$compiler_root/util_cc_helper.py", |
71 ] | 71 ] |
72 | 72 |
73 # This list mirrors the outputs that will be generated by the following | |
74 # action_foreach. It's used by the static_library target. | |
75 compiled_schema_outputs = process_file_template( | |
76 schemas, | |
77 [ "$target_gen_dir/{{source_name_part}}.cc", | |
78 "$target_gen_dir/{{source_name_part}}.h", | |
79 ]) | |
80 | |
81 schema_generator_name = target_name + "_schema_generator" | 73 schema_generator_name = target_name + "_schema_generator" |
82 action_foreach(schema_generator_name) { | 74 action_foreach(schema_generator_name) { |
83 script = compiler_script | 75 script = compiler_script |
84 hard_dep = true | |
85 source_prereqs = compiler_sources | 76 source_prereqs = compiler_sources |
86 sources = schemas | 77 sources = schemas |
87 outputs = [ | 78 outputs = [ |
88 "$target_gen_dir/{{source_name_part}}.cc", | 79 "$target_gen_dir/{{source_name_part}}.cc", |
89 "$target_gen_dir/{{source_name_part}}.h", | 80 "$target_gen_dir/{{source_name_part}}.h", |
90 ] | 81 ] |
91 args = [ | 82 args = [ |
92 "{{source}}", | 83 "{{source}}", |
93 "--root=" + rebase_path("//", root_build_dir), | 84 "--root=" + rebase_path("//", root_build_dir), |
94 "--destdir=" + rebase_path(root_gen_dir, root_build_dir), | 85 "--destdir=" + rebase_path(root_gen_dir, root_build_dir), |
95 "--namespace=$root_namespace", | 86 "--namespace=$root_namespace", |
96 "--generator=cpp" ] | 87 "--generator=cpp" ] |
97 visibility = target_visibility | 88 visibility = target_visibility |
98 } | 89 } |
99 | 90 |
100 bundle_generator_name = target_name + "_bundle_generator" | 91 bundle_generator_name = target_name + "_bundle_generator" |
101 bundle_outputs = [ | |
102 "$target_gen_dir/generated_api.cc", | |
103 "$target_gen_dir/generated_api.h", | |
104 "$target_gen_dir/generated_schemas.cc", | |
105 "$target_gen_dir/generated_schemas.h", | |
106 ] | |
107 action(bundle_generator_name) { | 92 action(bundle_generator_name) { |
108 script = compiler_script | 93 script = compiler_script |
109 hard_dep = true | |
110 source_prereqs = compiler_sources + schemas + uncompiled_schemas | 94 source_prereqs = compiler_sources + schemas + uncompiled_schemas |
111 outputs = bundle_outputs | 95 outputs = [ |
| 96 "$target_gen_dir/generated_api.cc", |
| 97 "$target_gen_dir/generated_api.h", |
| 98 "$target_gen_dir/generated_schemas.cc", |
| 99 "$target_gen_dir/generated_schemas.h", |
| 100 ] |
112 args = [ | 101 args = [ |
113 "--root=" + rebase_path("//", root_build_dir), | 102 "--root=" + rebase_path("//", root_build_dir), |
114 "--destdir=" + rebase_path(root_gen_dir, root_build_dir), | 103 "--destdir=" + rebase_path(root_gen_dir, root_build_dir), |
115 "--namespace=$root_namespace", | 104 "--namespace=$root_namespace", |
116 "--generator=cpp-bundle", | 105 "--generator=cpp-bundle", |
117 "--impl-dir=" + rebase_path(impl_dir, "//"), | 106 "--impl-dir=" + rebase_path(impl_dir, "//"), |
118 ] + | 107 ] + |
119 rebase_path(schemas, root_build_dir) + | 108 rebase_path(schemas, root_build_dir) + |
120 rebase_path(uncompiled_schemas, root_build_dir) | 109 rebase_path(uncompiled_schemas, root_build_dir) |
121 } | 110 } |
122 | 111 |
123 source_set(target_name) { | 112 source_set(target_name) { |
124 hard_dep = true | 113 sources = |
125 sources = compiled_schema_outputs + bundle_outputs | 114 get_target_outputs(":$schema_generator_name") + |
| 115 get_target_outputs(":$bundle_generator_name") |
| 116 |
126 deps = [ | 117 deps = [ |
127 ":$schema_generator_name", | 118 ":$schema_generator_name", |
128 ":$bundle_generator_name", | 119 ":$bundle_generator_name", |
129 "//tools/json_schema_compiler:generated_api_util", | 120 "//tools/json_schema_compiler:generated_api_util", |
130 ] | 121 ] |
131 | 122 |
132 if (defined(invoker.deps)) { | 123 if (defined(invoker.deps)) { |
133 deps += invoker.deps | 124 deps += invoker.deps |
134 } | 125 } |
135 direct_dependent_configs = [ ":$generated_config_name" ] | 126 direct_dependent_configs = [ ":$generated_config_name" ] |
136 | 127 |
137 if (defined(invoker.visibility)) { | 128 if (defined(invoker.visibility)) { |
138 visibility = invoker.visibility | 129 visibility = invoker.visibility |
139 } | 130 } |
140 if (defined(invoker.output_name)) { | 131 if (defined(invoker.output_name)) { |
141 output_name = invoker.output_name | 132 output_name = invoker.output_name |
142 } | 133 } |
143 } | 134 } |
144 } | 135 } |
OLD | NEW |