| 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 import("//sky/engine/bindings/core/v8/generated.gni") | 5 import("//sky/engine/bindings/core/v8/generated.gni") |
| 6 import("//sky/engine/bindings/core/core.gni") | 6 import("//sky/engine/bindings/core/core.gni") |
| 7 import("//sky/engine/bindings/core/idl.gni") | 7 import("//sky/engine/bindings/core/idl.gni") |
| 8 | 8 |
| 9 bindings_scripts_dir = get_path_info(".", "abspath") | 9 bindings_scripts_dir = get_path_info(".", "abspath") |
| 10 bindings_scripts_output_dir = "$root_gen_dir/sky/bindings/scripts" | 10 bindings_scripts_output_dir = "$root_gen_dir/sky/bindings/scripts" |
| 11 | 11 |
| 12 # Replacing <(DEPTH) with "/" makes paths like "<(DEPTH)/foo" absolute. | 12 # Replacing <(DEPTH) with "/" makes paths like "<(DEPTH)/foo" absolute. |
| 13 _gypi = exec_script( | 13 _gypi = exec_script("//build/gypi_to_gn.py", |
| 14 "//build/gypi_to_gn.py", | 14 [ |
| 15 [ rebase_path("scripts.gypi"), | 15 rebase_path("scripts.gypi"), |
| 16 "--replace=<(DEPTH)=/" ], | 16 "--replace=<(DEPTH)=/", |
| 17 "scope", | 17 ], |
| 18 [ "scripts.gypi" ]) | 18 "scope", |
| 19 [ "scripts.gypi" ]) |
| 19 | 20 |
| 20 jinja_module_files = get_path_info(_gypi.jinja_module_files, "abspath") | 21 jinja_module_files = get_path_info(_gypi.jinja_module_files, "abspath") |
| 21 idl_lexer_parser_files = get_path_info(_gypi.idl_lexer_parser_files, "abspath") | 22 idl_lexer_parser_files = get_path_info(_gypi.idl_lexer_parser_files, "abspath") |
| 22 idl_compiler_files = get_path_info(_gypi.idl_compiler_files, "abspath") | 23 idl_compiler_files = get_path_info(_gypi.idl_compiler_files, "abspath") |
| 23 | 24 |
| 24 # Calls the compute_interfaces_info_individual script. | 25 # Calls the compute_interfaces_info_individual script. |
| 25 # | 26 # |
| 26 # Parameters: | 27 # Parameters: |
| 27 # sources_static = list of IDL files to pass as inputs | 28 # sources_static = list of IDL files to pass as inputs |
| 28 # sources_generated = list of generated IDL files to pass as inputs | 29 # sources_generated = list of generated IDL files to pass as inputs |
| 29 # component_dir = name if subdirectory (one word, no slashes) of component. | 30 # component_dir = name if subdirectory (one word, no slashes) of component. |
| 30 # output_file = pickle file to write | 31 # output_file = pickle file to write |
| 31 # | 32 # |
| 32 # FIXME: Note the static/generated split is for consistency with GYP. This | 33 # FIXME: Note the static/generated split is for consistency with GYP. This |
| 33 # split is not necessary in the GN build and could be combined into a single | 34 # split is not necessary in the GN build and could be combined into a single |
| 34 # "sources". | 35 # "sources". |
| 35 template("compute_interfaces_info_individual") { | 36 template("compute_interfaces_info_individual") { |
| 36 action(target_name) { | 37 action(target_name) { |
| 37 script = "$bindings_scripts_dir/compute_interfaces_info_individual.py" | 38 script = "$bindings_scripts_dir/compute_interfaces_info_individual.py" |
| 38 if (defined(invoker.visibility)) { | 39 if (defined(invoker.visibility)) { |
| 39 visibility = invoker.visibility | 40 visibility = invoker.visibility |
| 40 } | 41 } |
| 41 | 42 |
| 42 # Save static list to temp file to avoid blowing out command-line length | 43 # Save static list to temp file to avoid blowing out command-line length |
| 43 # limit. | 44 # limit. |
| 44 file_list = "$target_gen_dir/${target_name}_file_list.txt" | 45 file_list = "$target_gen_dir/${target_name}_file_list.txt" |
| 45 write_file(file_list, rebase_path(invoker.sources_static, root_build_dir)) | 46 write_file(file_list, rebase_path(invoker.sources_static, root_build_dir)) |
| 46 | 47 |
| 47 inputs = [ | 48 inputs = [ "$bindings_scripts_dir/utilities.py" ] + invoker.sources_static + |
| 48 "$bindings_scripts_dir/utilities.py", | 49 invoker.sources_generated |
| 49 ] + invoker.sources_static + invoker.sources_generated | |
| 50 | 50 |
| 51 outputs = [ | 51 outputs = [ |
| 52 file_list, | 52 file_list, |
| 53 invoker.output_file | 53 invoker.output_file, |
| 54 ] | 54 ] |
| 55 | 55 |
| 56 args = [ | 56 args = [ |
| 57 "--component-dir", invoker.component_dir, | 57 "--component-dir", |
| 58 "--idl-files-list", rebase_path(file_list, root_build_dir), | 58 invoker.component_dir, |
| 59 "--interfaces-info-file", | 59 "--idl-files-list", |
| 60 rebase_path(invoker.output_file, root_build_dir), | 60 rebase_path(file_list, root_build_dir), |
| 61 "--write-file-only-if-changed=1", | 61 "--interfaces-info-file", |
| 62 "--", | 62 rebase_path(invoker.output_file, root_build_dir), |
| 63 ] + rebase_path(invoker.sources_generated, root_build_dir) | 63 "--write-file-only-if-changed=1", |
| 64 "--", |
| 65 ] + rebase_path(invoker.sources_generated, root_build_dir) |
| 64 | 66 |
| 65 deps = [ | 67 deps = [ |
| 66 # FIXME: should be {modules|core}_generated_idls | 68 # FIXME: should be {modules|core}_generated_idls |
| 67 # http://crbug.com/358074 | 69 # http://crbug.com/358074 |
| 68 "//sky/engine/bindings:generated_idls", | 70 "//sky/engine/bindings:generated_idls", |
| 69 ] | 71 ] |
| 70 } | 72 } |
| 71 } | 73 } |
| 72 | 74 |
| 73 # Calls generate_event_interfaces | 75 # Calls generate_event_interfaces |
| 74 # | 76 # |
| 75 # Parameters: | 77 # Parameters: |
| 76 # sources = A list of IDL files to process. | 78 # sources = A list of IDL files to process. |
| 77 # output_file = The .in file to write, relative to the sky_gen_dir. | 79 # output_file = The .in file to write, relative to the sky_gen_dir. |
| 78 # suffix = (Optional) String to be passed to script via --suffix | 80 # suffix = (Optional) String to be passed to script via --suffix |
| 79 template("generate_event_interfaces") { | 81 template("generate_event_interfaces") { |
| 80 action(target_name) { | 82 action(target_name) { |
| 81 # Write the file list to a unique temp file to avoid blowing out the | 83 # Write the file list to a unique temp file to avoid blowing out the |
| 82 # command line length limit. | 84 # command line length limit. |
| 83 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" | 85 idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp" |
| 84 write_file(idl_files_list, | 86 write_file(idl_files_list, rebase_path(invoker.sources, root_build_dir)) |
| 85 rebase_path(invoker.sources, root_build_dir)) | |
| 86 | 87 |
| 87 inputs = [ | 88 inputs = [ |
| 88 "//sky/engine/bindings/scripts/utilities.py", | 89 "//sky/engine/bindings/scripts/utilities.py", |
| 89 idl_files_list, | 90 idl_files_list, |
| 90 ] + invoker.sources | 91 ] + invoker.sources |
| 91 | 92 |
| 92 output_file = "$root_gen_dir/sky/" + invoker.output_file | 93 output_file = "$root_gen_dir/sky/" + invoker.output_file |
| 93 outputs = [ output_file ] | 94 outputs = [ |
| 95 output_file, |
| 96 ] |
| 94 | 97 |
| 95 script = "//sky/engine/bindings/scripts/generate_event_interfaces.py" | 98 script = "//sky/engine/bindings/scripts/generate_event_interfaces.py" |
| 96 args = [ | 99 args = [ |
| 97 "--event-idl-files-list", | 100 "--event-idl-files-list", |
| 98 rebase_path(idl_files_list, root_build_dir), | 101 rebase_path(idl_files_list, root_build_dir), |
| 99 "--event-interfaces-file", | 102 "--event-interfaces-file", |
| 100 rebase_path(output_file, root_build_dir), | 103 rebase_path(output_file, root_build_dir), |
| 101 "--write-file-only-if-changed=1", # Always true for Ninja. | 104 "--write-file-only-if-changed=1", # Always true for Ninja. |
| 102 ] | 105 ] |
| 103 | 106 |
| 104 if (defined(invoker.suffix)) { | 107 if (defined(invoker.suffix)) { |
| 105 args += [ "--suffix", invoker.suffix ] | 108 args += [ |
| 109 "--suffix", |
| 110 invoker.suffix, |
| 111 ] |
| 106 } | 112 } |
| 107 } | 113 } |
| 108 } | 114 } |
| 109 | 115 |
| 110 # Runs the idl_compiler script over a list of sources. | 116 # Runs the idl_compiler script over a list of sources. |
| 111 # | 117 # |
| 112 # Parameters: | 118 # Parameters: |
| 113 # sources = list of IDL files to compile | 119 # sources = list of IDL files to compile |
| 114 # output_dir = string containing the directory to put the output files. | 120 # output_dir = string containing the directory to put the output files. |
| 115 template("idl_compiler") { | 121 template("idl_compiler") { |
| 116 output_dir = invoker.output_dir | 122 output_dir = invoker.output_dir |
| 117 | 123 |
| 118 action_foreach(target_name) { | 124 action_foreach(target_name) { |
| 119 # TODO(brettw) GYP adds a "-S before the script name to skip "import site" t
o | 125 # TODO(brettw) GYP adds a "-S before the script name to skip "import site" t
o |
| 120 # speed up startup. Figure out if we need this and do something similar (not | 126 # speed up startup. Figure out if we need this and do something similar (not |
| 121 # really expressible in GN now). | 127 # really expressible in GN now). |
| 122 script = "//sky/engine/bindings/scripts/idl_compiler.py" | 128 script = "//sky/engine/bindings/scripts/idl_compiler.py" |
| 123 | 129 |
| 124 inputs = | 130 inputs = idl_lexer_parser_files + idl_compiler_files # to be explicit (cove
red by parsetab) |
| 125 idl_lexer_parser_files + # to be explicit (covered by parsetab) | |
| 126 idl_compiler_files | |
| 127 inputs += [ | 131 inputs += [ |
| 128 "$bindings_scripts_output_dir/lextab.py", | 132 "$bindings_scripts_output_dir/lextab.py", |
| 129 "$bindings_scripts_output_dir/parsetab.pickle", | 133 "$bindings_scripts_output_dir/parsetab.pickle", |
| 130 "$bindings_scripts_output_dir/cached_jinja_templates.stamp", | 134 "$bindings_scripts_output_dir/cached_jinja_templates.stamp", |
| 131 "$bindings_dir/IDLExtendedAttributes.txt", | 135 "$bindings_dir/IDLExtendedAttributes.txt", |
| 136 |
| 132 # If the dependency structure or public interface info (e.g., | 137 # If the dependency structure or public interface info (e.g., |
| 133 # [ImplementedAs]) changes, we rebuild all files, since we're not | 138 # [ImplementedAs]) changes, we rebuild all files, since we're not |
| 134 # computing dependencies file-by-file in the build. | 139 # computing dependencies file-by-file in the build. |
| 135 # This data is generally stable. | 140 # This data is generally stable. |
| 136 "$bindings_core_output_dir/InterfacesInfoAll.pickle", | 141 "$bindings_core_output_dir/InterfacesInfoAll.pickle", |
| 137 ] | 142 ] |
| 143 |
| 138 # Further, if any dependency (partial interface or implemented | 144 # Further, if any dependency (partial interface or implemented |
| 139 # interface) changes, rebuild everything, since every IDL potentially | 145 # interface) changes, rebuild everything, since every IDL potentially |
| 140 # depends on them, because we're not computing dependencies | 146 # depends on them, because we're not computing dependencies |
| 141 # file-by-file. | 147 # file-by-file. |
| 142 # FIXME: This is too conservative, and causes excess rebuilds: | 148 # FIXME: This is too conservative, and causes excess rebuilds: |
| 143 # compute this file-by-file. http://crbug.com/341748 | 149 # compute this file-by-file. http://crbug.com/341748 |
| 144 # This should theoretically just be the IDL files passed in. | 150 # This should theoretically just be the IDL files passed in. |
| 145 inputs += core_all_dependency_idl_files | 151 inputs += core_all_dependency_idl_files |
| 146 | 152 |
| 147 sources = invoker.sources | 153 sources = invoker.sources |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 outputs = invoker.outputs | 233 outputs = invoker.outputs |
| 228 | 234 |
| 229 args = [ | 235 args = [ |
| 230 invoker.component_dir, | 236 invoker.component_dir, |
| 231 rebase_path(idl_files_list, root_build_dir), | 237 rebase_path(idl_files_list, root_build_dir), |
| 232 "--", | 238 "--", |
| 233 ] | 239 ] |
| 234 args += rebase_path(invoker.outputs, root_build_dir) | 240 args += rebase_path(invoker.outputs, root_build_dir) |
| 235 } | 241 } |
| 236 } | 242 } |
| OLD | NEW |