Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / scripts / scripts.gni
index 41a80c6..ae89f3a 100644 (file)
@@ -27,7 +27,9 @@ idl_compiler_files = get_path_info(_gypi.idl_compiler_files, "abspath")
 #   sources_static = list of IDL files to pass as inputs
 #   sources_generated = list of generated IDL files to pass as inputs
 #   component_dir = name if subdirectory (one word, no slashes) of component.
-#   output_file = pickle file to write
+#   interfaces_info_file = output pickle file for interfaces info.
+#   component_wide_info_file = output pickle file for component wide info.
+#   deps = dependencies
 #
 # FIXME: Note the static/generated split is for consistency with GYP. This
 # split is not necessary in the GN build and could be combined into a single
@@ -50,22 +52,25 @@ template("compute_interfaces_info_individual") {
     ] + invoker.sources_static + invoker.sources_generated
 
     outputs = [
-      invoker.output_file
+      invoker.interfaces_info_file,
+      invoker.component_wide_info_file,
     ]
 
     args = [
+      "--cache-directory",
+      rebase_path(bindings_scripts_output_dir, root_build_dir),
       "--idl-files-list", rebase_path(file_list, root_build_dir),
       "--interfaces-info-file",
-      rebase_path(invoker.output_file, root_build_dir),
+      rebase_path(invoker.interfaces_info_file, root_build_dir),
+      "--component-info-file",
+      rebase_path(invoker.component_wide_info_file, root_build_dir),
       "--write-file-only-if-changed=1",
       "--",
     ] + rebase_path(invoker.sources_generated, root_build_dir)
 
     deps = [
-      # FIXME: should be {modules|core}_generated_idls
-      # http://crbug.com/358074
-      "//third_party/WebKit/Source/bindings:generated_idls",
-    ]
+      "//third_party/WebKit/Source/bindings/scripts:cached_lex_yacc_tables",
+    ] + invoker.deps
   }
 }
 
@@ -111,8 +116,11 @@ template("generate_event_interfaces") {
 # Parameters:
 #   sources = list of IDL files to compile
 #   output_dir = string containing the directory to put the output files.
+#   output_name_suffix = a suffix after the basename of the output file names.
+#   target_component = component to generate code for.
 template("idl_compiler") {
   output_dir = invoker.output_dir
+  output_name_suffix = invoker.output_name_suffix
 
   action_foreach(target_name) {
     # TODO(brettw) GYP adds a "-S before the script name to skip "import site" to
@@ -132,7 +140,7 @@ template("idl_compiler") {
       # [ImplementedAs]) changes, we rebuild all files, since we're not
       # computing dependencies file-by-file in the build.
       # This data is generally stable.
-      "$bindings_modules_output_dir/InterfacesInfoModules.pickle",
+      "$bindings_modules_output_dir/InterfacesInfoOverall.pickle",
     ]
     # Further, if any dependency (partial interface or implemented
     # interface) changes, rebuild everything, since every IDL potentially
@@ -145,8 +153,8 @@ template("idl_compiler") {
 
     sources = invoker.sources
     outputs = [
-      "$output_dir/V8{{source_name_part}}.cpp",
-      "$output_dir/V8{{source_name_part}}.h",
+      "$output_dir/V8{{source_name_part}}${output_name_suffix}.cpp",
+      "$output_dir/V8{{source_name_part}}${output_name_suffix}.h",
     ]
 
     args = [
@@ -155,9 +163,11 @@ template("idl_compiler") {
       "--output-dir",
       rebase_path(output_dir, root_build_dir),
       "--interfaces-info",
-      rebase_path("$bindings_modules_output_dir/InterfacesInfoModules.pickle",
+      rebase_path("$bindings_modules_output_dir/InterfacesInfoOverall.pickle",
                   root_build_dir),
       "--write-file-only-if-changed=1",  # Always true for Ninja.
+      "--target-component",
+      invoker.target_component,
       "{{source}}",
     ]
 
@@ -173,13 +183,17 @@ template("idl_compiler") {
   }
 }
 
-# Runs the idl_compiler to generate IDL dictionary impl files.
+# Runs the idl_compiler to generate IDL dictionary and union impl files.
 #
 # Parameters:
 #   sources = a list of IDL files to process
 #   outputs = a list of files to write to
-template("idl_dictionary") {
-  output_dir = "$root_gen_dir/blink/"
+#   output_dir = the directory to put the output files
+#   component_wide_info = a filename of pickle file which contains component
+#     wide information
+#   target_component = component to generate code for
+template("idl_impl") {
+  dictionary_impl_output_dir = "$root_gen_dir/blink/"
 
   action(target_name) {
     script = "//third_party/WebKit/Source/bindings/scripts/idl_compiler.py"
@@ -193,19 +207,27 @@ template("idl_dictionary") {
       "--cache-dir",
       rebase_path(bindings_scripts_output_dir, root_build_dir),
       "--output-dir",
-      rebase_path(output_dir, root_build_dir),
+      rebase_path(invoker.output_dir, root_build_dir),
+      "--impl-output-dir",
+      rebase_path(dictionary_impl_output_dir, root_build_dir),
       "--interfaces-info",
-      rebase_path("$bindings_modules_output_dir/InterfacesInfoModules.pickle",
+      rebase_path("$bindings_modules_output_dir/InterfacesInfoOverall.pickle",
                   root_build_dir),
+      "--component-info",
+      rebase_path(invoker.component_wide_info, root_build_dir),
+      "--target-component",
+      invoker.target_component,
       "--write-file-only-if-changed=1",
-      "--generate-dictionary-impl",
+      "--generate-impl",
       rebase_path(idl_files_list, root_build_dir),
     ]
 
     deps = [
       # FIXME: should be interfaces_info_core (w/o modules)
       # http://crbug.com/358074
+      "//third_party/WebKit/Source/bindings/core:interfaces_info_individual_core",
       "//third_party/WebKit/Source/bindings/modules:interfaces_info",
+      "//third_party/WebKit/Source/bindings/modules:interfaces_info_individual_modules",
       "//third_party/WebKit/Source/bindings/scripts:cached_lex_yacc_tables",
       "//third_party/WebKit/Source/bindings/scripts:cached_jinja_templates",
     ]
@@ -238,3 +260,97 @@ template("aggregate_generated_bindings") {
     args += rebase_path(invoker.outputs, root_build_dir)
   }
 }
+
+# Calls the compute_global_objects script.
+#
+# Parameters:
+#   sources = a list of source IDL files.
+#   sources_generated = a list of generated pickle sources.
+#   output_file = a pickle file to write to (need to specify directory)
+#
+template("compute_global_objects") {
+  action(target_name) {
+    script = "//third_party/WebKit/Source/bindings/scripts/compute_global_objects.py"
+
+    # Write the file list to a unique temp file to avoid blowing out the
+    # command line length limit.
+    idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp"
+    write_file(idl_files_list,
+               rebase_path(invoker.sources, root_build_dir))
+
+    inputs = [
+      "//third_party/WebKit/Source/bindings/scripts/utilities.py",
+      idl_files_list,
+    ] + invoker.sources_generated + invoker.sources
+
+    outputs = [ invoker.output_file ]
+
+    args = [
+      "--idl-files-list",
+      rebase_path(idl_files_list, root_build_dir),
+      "--write-file-only-if-changed=1",  # Always true for Ninja.
+      "--",
+    ]
+    args += rebase_path(invoker.sources_generated, root_build_dir)
+    args += [ rebase_path(invoker.output_file, root_build_dir) ]
+
+    deps = invoker.deps
+  }
+}
+
+# Calls the generate_global_constructors script.
+#
+# Parameters:
+#   sources = a list of source IDL files.
+#   global_objects_file = a global objects file generated by compute_global_objects
+#   interfaces = interfaces to generate global constructors for.
+#   component = component to generate global constructors for.
+#   output_dir = output directory to generate idl files and header files.
+#   deps = dependencies
+#
+template("generate_global_constructors") {
+  action(target_name) {
+    script = "//third_party/WebKit/Source/bindings/scripts/generate_global_constructors.py"
+
+    # Write the file list to a unique temp file to avoid blowing out the
+    # command line length limit.
+    idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp"
+    write_file(idl_files_list,
+               rebase_path(invoker.sources, root_build_dir))
+
+    inputs = [
+      "//third_party/WebKit/Source/bindings/scripts/utilities.py",
+      idl_files_list,
+      invoker.global_objects_file,
+    ] + invoker.sources
+
+    args = [
+      "--idl-files-list",
+      rebase_path(idl_files_list, root_build_dir),
+      "--global-objects-file",
+      rebase_path(invoker.global_objects_file, root_build_dir),
+      "--write-file-only-if-changed=1",  # Always true for Ninja.
+      "--",
+    ]
+
+    output_dir = invoker.output_dir
+    component = invoker.component
+
+    # generate outputs from invoker.interfaces.
+    output_idl_files = []
+    output_header_files = []
+    foreach(interface, invoker.interfaces) {
+      args += [ interface ]
+      output_idl_file = "$output_dir/${interface}${component}Constructors.idl"
+      args += [ rebase_path(output_idl_file, root_build_dir) ]
+      output_idl_files += [ output_idl_file ]
+      output_header_files += [
+        "$output_dir/${interface}${component}Constructors.h"
+      ]
+    }
+
+    outputs = output_idl_files + output_header_files
+    deps = invoker.deps
+  }
+}
+