| Index: extensions/generated_extensions_api.gni
|
| diff --git a/extensions/generated_extensions_api.gni b/extensions/generated_extensions_api.gni
|
| index 98ddc774f78ab86cece0295bd59d910221fc6a51..5360711eecec1559ddca9136518ccbd5beed649b 100644
|
| --- a/extensions/generated_extensions_api.gni
|
| +++ b/extensions/generated_extensions_api.gni
|
| @@ -16,23 +16,16 @@
|
| # namespace for each API. Use %(namespace)s to replace with the API
|
| # namespace, like "toplevel::%(namespace)s_api".
|
| #
|
| -# schemas [optional, default = false]
|
| -# Boolean indicating if the schema files should be generated.
|
| -#
|
| # bundle [optional, default = false]
|
| -# Boolean indicating if the schema bundle files should be generated.
|
| -#
|
| -# bundle_registration [optional, default = false]
|
| -# Boolean indicating if the API registration bundle files should be generated.
|
| +# Boolean indicating if the schema files should be bundled or not.
|
| #
|
| -# impl_dir [required if bundle_registration = true, otherwise unused]
|
| +# impl_dir [required if bundle = true, otherwise unused]
|
| # The path containing C++ implementations of API functions. This path is
|
| # used as the root path when looking for {schema}/{schema}_api.h headers
|
| -# when generating API registration bundles. Such headers, if found, are
|
| +# during the API bundle generation phase. Such headers, if found, are
|
| # automatically included by the generated code.
|
| #
|
| -# uncompiled_sources [optional, only used when bundle = true or
|
| -# bundle_registration = true]
|
| +# uncompiled_sources [optional, only used when bundle = true]
|
| # A list of schema files which should not be compiled, but which should still
|
| # be processed for API bundle generation.
|
| #
|
| @@ -40,7 +33,7 @@
|
| # If any deps are specified they will be inherited by the static library
|
| # target.
|
| #
|
| -# The static library target also inherits the visibility and output_name
|
| +# The static libarary target also inherits the visibility and output_name
|
| # of its invoker.
|
|
|
| template("generated_extensions_api") {
|
| @@ -49,10 +42,7 @@ template("generated_extensions_api") {
|
| assert(defined(invoker.root_namespace),
|
| "\"root_namespace\" must be defined for the $target_name template.")
|
|
|
| - schemas = defined(invoker.schemas) && invoker.schemas
|
| bundle = defined(invoker.bundle) && invoker.bundle
|
| - bundle_registration = defined(invoker.bundle_registration) &&
|
| - invoker.bundle_registration
|
|
|
| # Keep a copy of the target_name here since it will be trampled
|
| # in nested targets.
|
| @@ -64,7 +54,7 @@ template("generated_extensions_api") {
|
| visibility = target_visibility
|
| }
|
|
|
| - sources = invoker.sources
|
| + schemas = invoker.sources
|
| root_namespace = invoker.root_namespace
|
|
|
| compiler_root = "//tools/json_schema_compiler"
|
| @@ -82,36 +72,41 @@ template("generated_extensions_api") {
|
| "$compiler_root/util_cc_helper.py",
|
| ]
|
|
|
| - if (schemas) {
|
| - schema_generator_name = target_name + "_schema_generator"
|
| - action_foreach(schema_generator_name) {
|
| - script = compiler_script
|
| - inputs = compiler_sources
|
| - outputs = [
|
| - "$target_gen_dir/{{source_name_part}}.cc",
|
| - "$target_gen_dir/{{source_name_part}}.h",
|
| - ]
|
| - args = [
|
| - "{{source}}",
|
| - "--root=" + rebase_path("//", root_build_dir),
|
| - "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
|
| - "--namespace=$root_namespace",
|
| - "--generator=cpp" ]
|
| - visibility = target_visibility
|
| - }
|
| + schema_generator_name = target_name + "_schema_generator"
|
| + action_foreach(schema_generator_name) {
|
| + script = compiler_script
|
| + inputs = compiler_sources
|
| + sources = schemas
|
| + outputs = [
|
| + "$target_gen_dir/{{source_name_part}}.cc",
|
| + "$target_gen_dir/{{source_name_part}}.h",
|
| + ]
|
| + args = [
|
| + "{{source}}",
|
| + "--root=" + rebase_path("//", root_build_dir),
|
| + "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
|
| + "--namespace=$root_namespace",
|
| + "--generator=cpp" ]
|
| + visibility = target_visibility
|
| }
|
|
|
| if (bundle) {
|
| - uncompiled_sources = []
|
| + assert(defined(invoker.impl_dir),
|
| + "\"impl_dir\" must be defined for the $target_name template.")
|
| + impl_dir = invoker.impl_dir
|
| +
|
| + uncompiled_schemas = []
|
| if (defined(invoker.uncompiled_sources)) {
|
| - uncompiled_sources = invoker.uncompiled_sources
|
| + uncompiled_schemas = invoker.uncompiled_sources
|
| }
|
|
|
| - bundle_generator_schema_name = target_name + "_bundle_generator_schema"
|
| - action(bundle_generator_schema_name) {
|
| + bundle_generator_name = target_name + "_bundle_generator"
|
| + action(bundle_generator_name) {
|
| script = compiler_script
|
| - inputs = compiler_sources + sources + uncompiled_sources
|
| + inputs = compiler_sources + schemas + uncompiled_schemas
|
| outputs = [
|
| + "$target_gen_dir/generated_api.cc",
|
| + "$target_gen_dir/generated_api.h",
|
| "$target_gen_dir/generated_schemas.cc",
|
| "$target_gen_dir/generated_schemas.h",
|
| ]
|
| @@ -119,64 +114,25 @@ template("generated_extensions_api") {
|
| "--root=" + rebase_path("//", root_build_dir),
|
| "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
|
| "--namespace=$root_namespace",
|
| - "--generator=cpp-bundle-schema",
|
| - ] +
|
| - rebase_path(sources, root_build_dir) +
|
| - rebase_path(uncompiled_sources, root_build_dir)
|
| - }
|
| - }
|
| -
|
| - if (bundle_registration) {
|
| - uncompiled_sources = []
|
| - if (defined(invoker.uncompiled_sources)) {
|
| - uncompiled_sources = invoker.uncompiled_sources
|
| - }
|
| -
|
| - assert(defined(invoker.impl_dir),
|
| - "\"impl_dir\" must be defined for the $target_name template.")
|
| - impl_dir = invoker.impl_dir
|
| -
|
| - bundle_generator_registration_name = target_name +
|
| - "_bundle_generator_registration"
|
| - action(bundle_generator_registration_name) {
|
| - script = compiler_script
|
| - inputs = compiler_sources + sources + uncompiled_sources
|
| - outputs = [
|
| - "$root_gen_dir/$impl_dir/generated_api_registration.cc",
|
| - "$root_gen_dir/$impl_dir/generated_api_registration.h",
|
| - ]
|
| - args = [
|
| - "--root=" + rebase_path("//", root_build_dir),
|
| - "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
|
| - "--namespace=$root_namespace",
|
| - "--generator=cpp-bundle-registration",
|
| + "--generator=cpp-bundle",
|
| "--impl-dir=" + rebase_path(impl_dir, "//"),
|
| ] +
|
| - rebase_path(sources, root_build_dir) +
|
| - rebase_path(uncompiled_sources, root_build_dir)
|
| + rebase_path(schemas, root_build_dir) +
|
| + rebase_path(uncompiled_schemas, root_build_dir)
|
| }
|
| }
|
|
|
| source_set(target_name) {
|
| - sources = []
|
| - deps = []
|
| -
|
| - if (schemas) {
|
| - sources += get_target_outputs(":$schema_generator_name")
|
| - deps += [
|
| - ":$schema_generator_name",
|
| - "//tools/json_schema_compiler:generated_api_util",
|
| - ]
|
| - }
|
| + sources = get_target_outputs(":$schema_generator_name")
|
|
|
| - if (bundle) {
|
| - sources += get_target_outputs(":$bundle_generator_schema_name")
|
| - deps += [ ":$bundle_generator_schema_name" ]
|
| - }
|
| + deps = [
|
| + ":$schema_generator_name",
|
| + "//tools/json_schema_compiler:generated_api_util",
|
| + ]
|
|
|
| - if (bundle_registration) {
|
| - sources += get_target_outputs(":$bundle_generator_registration_name")
|
| - deps += [ ":$bundle_generator_registration_name" ]
|
| + if (bundle) {
|
| + sources += get_target_outputs(":$bundle_generator_name")
|
| + deps += [ ":$bundle_generator_name" ]
|
| }
|
|
|
| if (defined(invoker.deps)) {
|
|
|