| OLD | NEW |
| 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("//mojo/public/mojo_constants.gni") | 5 import("//services/shell/public/constants.gni") |
| 6 | 6 |
| 7 # Used to produce a Mojo Application Manifest for an application. | 7 # Used to produce a Service Manifest for a Service. |
| 8 # | 8 # |
| 9 # Parameters: | 9 # Parameters: |
| 10 # | 10 # |
| 11 # source | 11 # source |
| 12 # The manifest file template for this application, must be valid JSON with | 12 # The manifest file template for this service, must be valid JSON with |
| 13 # a valid 'url' key matching application_name. | 13 # a valid 'url' key matching name. |
| 14 # | 14 # |
| 15 # base_manifest (optional) | 15 # base_manifest (optional) |
| 16 # A manifest file template to use as a base for |source|. Any properties | 16 # A manifest file template to use as a base for |source|. Any properties |
| 17 # defined in |source| will overwrite or be merged with properties defined | 17 # defined in |source| will overwrite or be merged with properties defined |
| 18 # in |base_manifest|. | 18 # in |base_manifest|. |
| 19 # | 19 # |
| 20 # application_name | 20 # name |
| 21 # The host portion of the mojo: URL of the application. The script | 21 # The host portion of the mojo: URL of the service. A script validates |
| 22 # validates that the value of this parameter matches the host name portion | 22 # that the value of this parameter matches the host name portion of the |
| 23 # of the 'url' property set in the manifest and throws a ValueError if | 23 # 'url' property set in the manifest and throws a ValueError if they do |
| 24 # they do not. | 24 # not. |
| 25 # | 25 # |
| 26 # base_deps (optional) | 26 # base_deps (optional) |
| 27 # Dependencies required to generate |base_manifest| if applicable. | 27 # Dependencies required to generate |base_manifest| if applicable. |
| 28 # | 28 # |
| 29 # deps (optional) | 29 # deps (optional) |
| 30 # An array of dependent instances of this template. This template enforces | 30 # An array of dependent instances of this template. This template enforces |
| 31 # that dependencies can only be instances of this template. | 31 # that dependencies can only be instances of this template. |
| 32 # | 32 # |
| 33 # packaged_applications (optional) | 33 # packaged_services (optional) |
| 34 # An array of application_names of the dependent applications. | 34 # An array of names of the dependent services. |
| 35 # | 35 # |
| 36 # type (default is mojo) | 36 # type (default is mojo) |
| 37 # Possible values are 'mojo' and 'exe'. Default is 'mojo'. | 37 # Possible values are 'mojo' and 'exe'. Default is 'mojo'. |
| 38 # | 38 # |
| 39 # Outputs: | 39 # Outputs: |
| 40 # | 40 # |
| 41 # An instantiation of this template produces in | 41 # An instantiation of this template produces in |
| 42 # $outdir/<application_name>/manifest.json | 42 # $outdir/<name>/manifest.json |
| 43 # a meta manifest from the source template and the output manifest of all | 43 # a meta manifest from the source template and the output manifest of all |
| 44 # dependent children. | 44 # dependent children. |
| 45 # | 45 # |
| 46 template("mojo_application_manifest") { | 46 template("service_manifest") { |
| 47 assert(defined(invoker.source), | 47 assert(defined(invoker.source), |
| 48 "\"source\" must be defined for the $target_name template") | 48 "\"source\" must be defined for the $target_name template") |
| 49 assert(defined(invoker.application_name), | 49 assert(defined(invoker.name), |
| 50 "\"application_name\" must be defined for the $target_name template") | 50 "\"name\" must be defined for the $target_name template") |
| 51 if (defined(invoker.deps)) { | 51 if (defined(invoker.deps)) { |
| 52 assert(defined(invoker.packaged_applications), | 52 assert(defined(invoker.packaged_services), |
| 53 "\"packaged_applications\" listing the directory containing the " + | 53 "\"packaged_services\" listing the directory containing the " + |
| 54 "manifest.json of dependent applications must be provided.") | 54 "manifest.json of dependent services must be provided.") |
| 55 } | 55 } |
| 56 if (defined(invoker.packaged_applications)) { | 56 if (defined(invoker.packaged_services)) { |
| 57 assert(defined(invoker.deps), | 57 assert(defined(invoker.deps), |
| 58 "\"deps\" building the dependent packaged applications must be " + | 58 "\"deps\" building the dependent packaged services must be " + |
| 59 "provided.") | 59 "provided.") |
| 60 } | 60 } |
| 61 if (defined(invoker.type)) { | 61 if (defined(invoker.type)) { |
| 62 assert(invoker.type == "mojo" || invoker.type == "exe", | 62 assert(invoker.type == "mojo" || invoker.type == "exe", |
| 63 "\"type\" must be one of \"mojo\" or \"exe\".") | 63 "\"type\" must be one of \"mojo\" or \"exe\".") |
| 64 } | 64 } |
| 65 | 65 |
| 66 action(target_name) { | 66 action(target_name) { |
| 67 script = "//mojo/public/tools/manifest/manifest_collator.py" | 67 script = "//services/shell/public/tools/manifest/manifest_collator.py" |
| 68 | 68 |
| 69 type = "mojo" | 69 type = "mojo" |
| 70 if (defined(invoker.type)) { | 70 if (defined(invoker.type)) { |
| 71 type = invoker.type | 71 type = invoker.type |
| 72 } | 72 } |
| 73 | 73 |
| 74 application_name = invoker.application_name | 74 name = invoker.name |
| 75 inputs = [ | 75 inputs = [ |
| 76 invoker.source, | 76 invoker.source, |
| 77 ] | 77 ] |
| 78 | 78 |
| 79 if (type == "mojo") { | 79 if (type == "mojo") { |
| 80 output = "$root_out_dir/$mojo_application_subdir/$application_name/manifes
t.json" | 80 output = "$root_out_dir/$packages_directory/$name/manifest.json" |
| 81 } else { | 81 } else { |
| 82 output = "$root_out_dir/${application_name}_manifest.json" | 82 output = "$root_out_dir/${name}_manifest.json" |
| 83 } | 83 } |
| 84 outputs = [ | 84 outputs = [ |
| 85 output, | 85 output, |
| 86 ] | 86 ] |
| 87 | 87 |
| 88 rebase_parent = rebase_path(invoker.source, root_build_dir) | 88 rebase_parent = rebase_path(invoker.source, root_build_dir) |
| 89 rebase_output = rebase_path(output, root_build_dir) | 89 rebase_output = rebase_path(output, root_build_dir) |
| 90 | 90 |
| 91 args = [ | 91 args = [ |
| 92 "--application-name=$application_name", | 92 "--name=$name", |
| 93 "--parent=$rebase_parent", | 93 "--parent=$rebase_parent", |
| 94 "--output=$rebase_output", | 94 "--output=$rebase_output", |
| 95 ] | 95 ] |
| 96 | 96 |
| 97 if (defined(invoker.base_manifest)) { | 97 if (defined(invoker.base_manifest)) { |
| 98 rebase_base = rebase_path(invoker.base_manifest, root_build_dir) | 98 rebase_base = rebase_path(invoker.base_manifest, root_build_dir) |
| 99 args += [ "--base-manifest=$rebase_base" ] | 99 args += [ "--base-manifest=$rebase_base" ] |
| 100 } | 100 } |
| 101 | 101 |
| 102 if (defined(invoker.packaged_applications)) { | 102 if (defined(invoker.packaged_services)) { |
| 103 foreach(application_name, invoker.packaged_applications) { | 103 foreach(name, invoker.packaged_services) { |
| 104 input = "$root_out_dir/$mojo_application_subdir/$application_name/manife
st.json" | 104 input = "$root_out_dir/$packages_directory/$name/manifest.json" |
| 105 inputs += [ input ] | 105 inputs += [ input ] |
| 106 args += [ rebase_path(input, root_build_dir) ] | 106 args += [ rebase_path(input, root_build_dir) ] |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 deps = [] | 109 deps = [] |
| 110 data_deps = [] | 110 data_deps = [] |
| 111 if (defined(invoker.deps)) { | 111 if (defined(invoker.deps)) { |
| 112 deps += invoker.deps | 112 deps += invoker.deps |
| 113 data_deps += invoker.deps | 113 data_deps += invoker.deps |
| 114 } | 114 } |
| 115 if (defined(invoker.base_deps)) { | 115 if (defined(invoker.base_deps)) { |
| 116 deps += invoker.base_deps | 116 deps += invoker.base_deps |
| 117 data_deps += invoker.base_deps | 117 data_deps += invoker.base_deps |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 all_deps = [] | 121 all_deps = [] |
| 122 if (defined(invoker.deps)) { | 122 if (defined(invoker.deps)) { |
| 123 all_deps += invoker.deps | 123 all_deps += invoker.deps |
| 124 } | 124 } |
| 125 | 125 |
| 126 group("${target_name}__is_mojo_application_manifest") { | 126 group("${target_name}__is_service_manifest") { |
| 127 } | 127 } |
| 128 | 128 |
| 129 # Explicitly ensure that all dependencies are mojo_application_manifest | 129 # Explicitly ensure that all dependencies are service_manifest |
| 130 # targets themselves. | 130 # targets themselves. |
| 131 group("${target_name}__check_deps_are_all_mojo_application_manifest") { | 131 group("${target_name}__check_deps_are_all_service_manifest") { |
| 132 deps = [] | 132 deps = [] |
| 133 foreach(d, all_deps) { | 133 foreach(d, all_deps) { |
| 134 name = get_label_info(d, "label_no_toolchain") | 134 name = get_label_info(d, "label_no_toolchain") |
| 135 toolchain = get_label_info(d, "toolchain") | 135 toolchain = get_label_info(d, "toolchain") |
| 136 deps += [ "${name}__is_mojo_application_manifest(${toolchain})" ] | 136 deps += [ "${name}__is_service_manifest(${toolchain})" ] |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 } | 139 } |
| OLD | NEW |