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

Unified Diff: services/catalog/public/tools/catalog.gni

Issue 2653713004: Add service_test GN template (Closed)
Patch Set: . Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/mojo/services/run_all_unittests.cc ('k') | services/catalog/public/tools/sourcify_manifest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/catalog/public/tools/catalog.gni
diff --git a/services/catalog/public/tools/catalog.gni b/services/catalog/public/tools/catalog.gni
index ae112b4ad4f13857d5ff4a0ad7d7c088769ee3ac..67a5774442866e9b2c07fce063e768d2d7ba6940 100644
--- a/services/catalog/public/tools/catalog.gni
+++ b/services/catalog/public/tools/catalog.gni
@@ -138,3 +138,58 @@ template("catalog") {
}
}
}
+
+# Generates a source_set target which defines a single string contstant
+# containing the contents of a compiled catalog manifest.
+#
+# Parameters:
+#
+# catalog
+# The catalog target whose output should be stringified.
+#
+# output_symbol_name
+# The fully qualified symbol name of the C++ string constant to define in
+# the generate source_set.
+#
+template("catalog_cpp_source") {
+ assert(defined(invoker.catalog), "catalog is required")
+ assert(defined(invoker.output_symbol_name), "output_symbol_name is required")
+
+ catalog_target = invoker.catalog
+ catalog_target_dir = get_label_info(catalog_target, "target_gen_dir")
+ catalog_target_name = get_label_info(catalog_target, "name")
+ catalog_filename = "$catalog_target_dir/${catalog_target_name}.json"
+
+ generator_target_name = "${target_name}__generator"
+ generated_filename = "${target_gen_dir}/${target_name}.cc"
+
+ action(generator_target_name) {
+ testonly = defined(invoker.testonly) && invoker.testonly
+ script = "//services/catalog/public/tools/sourcify_manifest.py"
+ inputs = [
+ catalog_filename,
+ ]
+ outputs = [
+ generated_filename,
+ ]
+ args = [
+ "--input=" + rebase_path(catalog_filename, root_build_dir),
+ "--output=" + rebase_path(generated_filename, root_build_dir),
+ "--symbol-name=" + invoker.output_symbol_name,
+ ]
+ if (is_debug || dcheck_always_on) {
+ args += [ "--pretty" ]
+ }
+ deps = [
+ catalog_target,
+ ]
+ }
+
+ source_set(target_name) {
+ testonly = defined(invoker.testonly) && invoker.testonly
+ sources = get_target_outputs(":$generator_target_name")
+ deps = [
+ ":$generator_target_name",
+ ]
+ }
+}
« no previous file with comments | « media/mojo/services/run_all_unittests.cc ('k') | services/catalog/public/tools/sourcify_manifest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698