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
3 # found in the LICENSE file.
5 import("//third_party/WebKit/Source/config.gni")
7 # All paths in this file should be absolute so targets in any directory can use
8 # them without worrying about the current directory.
9 _scripts_dir = "//third_party/WebKit/Source/build/scripts"
11 scripts_for_in_files = [
12 # jinja2/__init__.py contains version string, so sufficient as
13 # dependency for whole jinja2 package
14 "//third_party/jinja2/__init__.py",
15 "//third_party/markupsafe/__init__.py", # jinja2 dep
16 "$_scripts_dir/hasher.py",
17 "$_scripts_dir/in_file.py",
18 "$_scripts_dir/in_generator.py",
19 "$_scripts_dir/license.py",
20 "$_scripts_dir/name_utilities.py",
21 "$_scripts_dir/template_expander.py",
22 "$_scripts_dir/templates/macros.tmpl",
25 css_properties_files = scripts_for_in_files + [
26 "$_scripts_dir/css_properties.py",
29 make_event_factory_files = scripts_for_in_files + [
30 "$_scripts_dir/make_event_factory.py",
31 "$_scripts_dir/templates/EventFactory.cpp.tmpl",
34 make_names_files = scripts_for_in_files + [
35 "$_scripts_dir/make_names.py",
36 "$_scripts_dir/templates/MakeNames.cpp.tmpl",
37 "$_scripts_dir/templates/MakeNames.h.tmpl",
40 make_qualified_names_files = scripts_for_in_files + [
41 "$_scripts_dir/make_qualified_names.py",
42 "$_scripts_dir/templates/MakeQualifiedNames.cpp.tmpl",
43 "$_scripts_dir/templates/MakeQualifiedNames.h.tmpl",
46 make_element_factory_files = make_qualified_names_files + [
47 "$_scripts_dir/make_element_factory.py",
48 "$_scripts_dir/templates/ElementFactory.cpp.tmpl",
49 "$_scripts_dir/templates/ElementFactory.h.tmpl",
52 make_element_type_helpers_files = make_qualified_names_files + [
53 "$_scripts_dir/make_element_type_helpers.py",
54 "$_scripts_dir/templates/ElementTypeHelpers.h.tmpl",
57 # The executables are relative to the build directory. Don't rebase it because
58 # on Posix we want to run the system one on the path.
60 gperf_exe = rebase_path("//third_party/gperf/bin/gperf.exe", root_build_dir)
61 bison_exe = rebase_path("//third_party/bison/bin/bison.exe", root_build_dir)
67 # Templates --------------------------------------------------------------------
69 _blink_gen_dir = "$root_gen_dir/blink"
71 # The GYP target make_core_generated has some deps and a bunch of actions on
72 # it, which means that the deps will be resolved before the actions run. Here
73 # we have separate targets for each action. Its not clear which actions depend
74 # on these deps, so for GYP compatibility, all of the below actions should
75 # depend on the following deps.
76 make_core_generated_deps = [
77 "//third_party/WebKit/Source/core:generated_testing_idls",
78 "//third_party/WebKit/Source/core:core_event_interfaces",
81 # Template to run most of scripts that process "*.in" files.
82 # script: script to run.
83 # in_files: ".in" files to pass to the script
84 # other_inputs: (optional) other input files the script depends on
85 # defaults to "scripts_for_in_files" (if specified, we assume
86 # that the contents of "scripts_for_in_files" are included in
87 # this list specified since this is how these lists are filled
89 # outputs: expected results. Note that the directory of the 0th item in this
90 # list will be taken to be the output path.
91 # other_args: (optional) other arguments to pass to the script.
92 template("process_in_files") {
94 script = invoker.script
96 inputs = invoker.in_files
97 if (defined(invoker.other_inputs)) {
98 inputs += invoker.other_inputs
100 inputs += scripts_for_in_files
102 outputs = invoker.outputs
104 # Extract the directory to write files to.
105 output_dir = get_path_info(outputs[0], "dir")
107 args = rebase_path(invoker.in_files, root_build_dir) + [
108 "--output_dir", rebase_path(output_dir, root_build_dir),
110 if (defined(invoker.other_args)) {
111 args += invoker.other_args
114 deps = make_core_generated_deps
118 # Template for scripts using css_properties.py. This is a special case of
120 # outputs: expected results
121 template("css_properties") {
122 process_in_files(target_name) {
123 script = invoker.script
124 in_files = ["css/CSSProperties.in"]
125 other_inputs = css_properties_files
126 if (defined(invoker.other_inputs)) {
127 other_inputs += invoker.other_inputs
130 "--gperf", gperf_exe,
132 outputs = invoker.outputs
136 # Template to run the make_names script. This is a special case of
138 # in_files: files to pass to the script
139 # outputs: expected results
140 template("make_names") {
141 process_in_files(target_name) {
142 script = "//third_party/WebKit/Source/build/scripts/make_names.py"
143 in_files = invoker.in_files
144 other_inputs = make_names_files
145 outputs = invoker.outputs
149 # Template to run the make_qualified_names script. This is a special case of
151 # in_files: list of ".in" files to process.
152 # outputs: list of output files
153 template("make_qualified_names") {
154 process_in_files(target_name) {
155 script = "//third_party/WebKit/Source/build/scripts/make_qualified_names.py"
156 in_files = invoker.in_files
157 other_inputs = make_qualified_names_files
158 outputs = invoker.outputs
162 # Calls the make_event_factory script. This is a special case of
164 # in_files: list of ".in" files to process.
165 # outputs: list of output files
166 template("make_event_factory") {
167 process_in_files(target_name) {
168 script = "//third_party/WebKit/Source/build/scripts/make_event_factory.py"
169 in_files = invoker.in_files
170 other_inputs = make_event_factory_files
171 outputs = invoker.outputs
175 # Calls the make_token_matcher script.
176 # input_file: The "*-in.cpp" file
177 # output_file: The output file
178 template("make_token_matcher") {
179 action(target_name) {
180 script = "//third_party/WebKit/Source/build/scripts/make_token_matcher.py"
182 inputs = scripts_for_in_files + [ invoker.input_file ]
183 outputs = [ invoker.output_file ]
186 rebase_path(invoker.input_file, root_build_dir),
187 rebase_path(invoker.output_file, root_build_dir),
190 deps = make_core_generated_deps