Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: services/catalog/public/tools/catalog.gni

Issue 2659523002: Generate better catalog C++ sources (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/app/mash/mash_runner.cc ('k') | services/catalog/public/tools/catalog.cc.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 import("//build/config/dcheck_always_on.gni") 5 import("//build/config/dcheck_always_on.gni")
6 6
7 # Generates a static catalog manifest to be loaded at runtime. This manifest 7 # Generates a static catalog manifest to be loaded at runtime. This manifest
8 # contains the union of all individual service manifests specified by the 8 # contains the union of all individual service manifests specified by the
9 # template parameters. 9 # template parameters.
10 # 10 #
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 # Generates a source_set target which defines a single string contstant 142 # Generates a source_set target which defines a single string contstant
143 # containing the contents of a compiled catalog manifest. 143 # containing the contents of a compiled catalog manifest.
144 # 144 #
145 # Parameters: 145 # Parameters:
146 # 146 #
147 # catalog 147 # catalog
148 # The catalog target whose output should be stringified. 148 # The catalog target whose output should be stringified.
149 # 149 #
150 # output_symbol_name 150 # generated_function_name
151 # The fully qualified symbol name of the C++ string constant to define in 151 # The fully qualified symbol name of the C++ string constant to define in
152 # the generate source_set. 152 # the generate source_set.
153 # 153 #
154 template("catalog_cpp_source") { 154 template("catalog_cpp_source") {
155 assert(defined(invoker.catalog), "catalog is required") 155 assert(defined(invoker.catalog), "catalog is required")
156 assert(defined(invoker.output_symbol_name), "output_symbol_name is required") 156 assert(defined(invoker.generated_function_name),
157 "generated_function_name is required")
157 158
158 catalog_target = invoker.catalog 159 catalog_target = invoker.catalog
159 catalog_target_dir = get_label_info(catalog_target, "target_gen_dir") 160 catalog_target_dir = get_label_info(catalog_target, "target_gen_dir")
160 catalog_target_name = get_label_info(catalog_target, "name") 161 catalog_target_name = get_label_info(catalog_target, "name")
161 catalog_filename = "$catalog_target_dir/${catalog_target_name}.json" 162 catalog_filename = "$catalog_target_dir/${catalog_target_name}.json"
162 163
163 generator_target_name = "${target_name}__generator" 164 generator_target_name = "${target_name}__generator"
164 generated_filename = "${target_gen_dir}/${target_name}.cc" 165 generated_filename_base = "${target_gen_dir}/${target_name}"
165 166
166 action(generator_target_name) { 167 action(generator_target_name) {
167 testonly = defined(invoker.testonly) && invoker.testonly 168 testonly = defined(invoker.testonly) && invoker.testonly
168 script = "//services/catalog/public/tools/sourcify_manifest.py" 169 script = "//services/catalog/public/tools/sourcify_manifest.py"
169 inputs = [ 170 inputs = [
170 catalog_filename, 171 catalog_filename,
172
173 "//services/catalog/public/tools/catalog.cc.tmpl",
174 "//services/catalog/public/tools/catalog.h.tmpl",
171 ] 175 ]
172 outputs = [ 176 outputs = [
173 generated_filename, 177 "${generated_filename_base}.cc",
178 "${generated_filename_base}.h",
174 ] 179 ]
175 args = [ 180 args = [
176 "--input=" + rebase_path(catalog_filename, root_build_dir), 181 "--input=" + rebase_path(catalog_filename, root_build_dir),
177 "--output=" + rebase_path(generated_filename, root_build_dir), 182 "--output-filename-base=" +
178 "--symbol-name=" + invoker.output_symbol_name, 183 rebase_path(generated_filename_base, root_build_dir),
184 "--output-function-name=" + invoker.generated_function_name,
185 "--module-path=" + rebase_path(generated_filename_base, root_gen_dir),
179 ] 186 ]
180 if (is_debug || dcheck_always_on) { 187 if (is_debug || dcheck_always_on) {
181 args += [ "--pretty" ] 188 args += [ "--pretty" ]
182 } 189 }
183 deps = [ 190 deps = [
184 catalog_target, 191 catalog_target,
185 ] 192 ]
186 } 193 }
187 194
188 source_set(target_name) { 195 source_set(target_name) {
189 testonly = defined(invoker.testonly) && invoker.testonly 196 testonly = defined(invoker.testonly) && invoker.testonly
190 sources = get_target_outputs(":$generator_target_name") 197 sources = get_target_outputs(":$generator_target_name")
191 deps = [ 198 deps = [
192 ":$generator_target_name", 199 ":$generator_target_name",
200 "//base",
193 ] 201 ]
194 } 202 }
195 } 203 }
OLDNEW
« no previous file with comments | « chrome/app/mash/mash_runner.cc ('k') | services/catalog/public/tools/catalog.cc.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698