Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Unified Diff: Source/build/scripts/scripts.gni

Issue 298703005: First pass on blink compiling for GN build (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/build/gn_list_to_space_separated_string.py ('k') | Source/config.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/build/scripts/scripts.gni
diff --git a/Source/build/scripts/scripts.gni b/Source/build/scripts/scripts.gni
index 6deafced50d9db33c02e379bf029e94a76987954..8fdd950dad508ca4850406c6842fabb5bfd79341 100644
--- a/Source/build/scripts/scripts.gni
+++ b/Source/build/scripts/scripts.gni
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//third_party/WebKit/Source/config.gni")
+
# All paths in this file should be absolute so targets in any directory can use
# them without worrying about the current directory.
_scripts_dir = "//third_party/WebKit/Source/build/scripts"
@@ -51,10 +53,167 @@ make_element_type_helpers_files = make_qualified_names_files + [
"$_scripts_dir/templates/ElementTypeHelpers.h.tmpl",
]
-# gperf_exe is relative to the build directory. Don't rebase it because on
-# Posix we want to run the system one on the path.
+# The executables are relative to the build directory. Don't rebase it because
+# on Posix we want to run the system one on the path.
if (is_win) {
+ perl_exe = rebase_path("//third_party/perl/perl/bin/perl.exe", root_build_dir)
gperf_exe = rebase_path("//third_party/gperf/bin/gperf.exe", root_build_dir)
+ bison_exe = rebase_path("//third_party/bison/bin/bison.exe", root_build_dir)
+ # Using cl instead of cygwin gcc cuts the processing time from
+ # 1m58s to 0m52s.
+ preprocessor = "--preprocessor \"cl.exe -nologo -EP -TP\""
} else {
+ perl_exe = "perl"
gperf_exe = "gperf"
+ bison_exe = "bison"
+ # We specify a preprocess so it happens locally and won't get
+ # distributed to goma.
+ # FIXME: /usr/bin/gcc won't exist on OSX forever. We want to
+ # use /usr/bin/clang once we require Xcode 4.x.
+ preprocessor = "--preprocessor \"/usr/bin/gcc -E -P -x c++\""
+}
+
+# Templates --------------------------------------------------------------------
+
+_blink_gen_dir = "$root_gen_dir/blink"
+_rel_blink_gen_dir = rebase_path(_blink_gen_dir, root_build_dir)
+
+# The GYP target make_core_generated has some deps and a bunch of actions on
+# it, which means that the deps will be resolved before the actions run. Here
+# we have separate targets for each action. Its not clear which actions depend
+# on these deps, so for GYP compatibility, all of the below actions should
+# depend on the following deps.
+make_core_generated_deps = [
+ "//third_party/WebKit/Source/core:generated_testing_idls",
+ "//third_party/WebKit/Source/bindings:core_bindings_generated",
+]
+
+# Template to run most of scripts that process "*.in" files.
+# script: script to run.
+# in_files: ".in" files to pass to the script
+# other_inputs: (optional) other input files the script depends on
+# defaults to "scripts_for_in_files" (if specified, we assume
+# that the contents of "scripts_for_in_files" are included in
+# this list specified since this is how these lists are filled
+# from the GYP build.
+# outputs: expected results relative to the blink_gen_dir
+# other_args: (optional) other arguements to pass to the script.
+template("process_in_files") {
+ action(target_name) {
+ script = invoker.script
+
+ source_prereqs = invoker.in_files
+ if (defined(invoker.other_inputs)) {
+ source_prereqs += invoker.other_inputs
+ } else {
+ source_prereqs += scripts_for_in_files
+ }
+ outputs = rebase_path(invoker.outputs, ".", _blink_gen_dir)
+
+ args = rebase_path(invoker.in_files, root_build_dir) + [
+ "--output_dir", _rel_blink_gen_dir,
+ ]
+ if (defined(invoker.other_args)) {
+ args += invoker.other_args
+ }
+
+ deps = make_core_generated_deps
+ }
+}
+
+# Template to run the make_names script. This is a special case of
+# process_in_files.
+# in_files: files to pass to the script
+# outputs: expected results relative to the blink_gen_dir
+template("make_names") {
+ process_in_files(target_name) {
+ script = "//third_party/WebKit/Source/build/scripts/make_names.py"
+ in_files = invoker.in_files
+ other_inputs = make_names_files
+ outputs = invoker.outputs
+ other_args = [ "--defines", feature_defines_string ]
+ }
+}
+
+# Template to run the make_qualified_names script. This is a special case of
+# process_in_files.
+# in_files: list of ".in" files to process.
+# outputs: list of output files relative to blink_gen_dir.
+template("make_qualified_names") {
+ process_in_files(target_name) {
+ script = "//third_party/WebKit/Source/build/scripts/make_qualified_names.py"
+ in_files = invoker.in_files
+ other_inputs = make_qualified_names_files
+ outputs = invoker.outputs
+ other_args = [ "--defines", feature_defines_string ]
+ }
+}
+
+# Calls the make_event_factory script. This is a special case of
+# process_in_files.
+# in_files: list of ".in" files to process.
+# outputs: list of output files relative to blink_gen_dir.
+template("make_event_factory") {
+ process_in_files(target_name) {
+ script = "//third_party/WebKit/Source/build/scripts/make_event_factory.py"
+ in_files = invoker.in_files
+ other_inputs = make_event_factory_files
+ outputs = invoker.outputs
+ }
+}
+
+# Calls the make_token_matcher script.
+# input_file: The "*-in.cpp" file
+# output_file: The output file (relative to the build_gen_dir)
+template("make_token_matcher") {
+ action(target_name) {
+ script = "//third_party/WebKit/Source/build/scripts/make_token_matcher.py"
+
+ source_prereqs = scripts_for_in_files + [ invoker.input_file ]
+ outputs = [
+ rebase_path(invoker.output_file, ".", _blink_gen_dir)
+ ]
+
+ args = [
+ rebase_path(invoker.input_file, root_build_dir),
+ rebase_path(invoker.output_file, root_build_dir, _blink_gen_dir),
+ ]
+
+ deps = make_core_generated_deps
+ }
+}
+
+# Calls generate_event_interfaces
+# sources: A list of IDL files to process.
+# output_file: The .in file to write, relative to the blink_gen_dir.
+# suffix: (Optional) String to be passed to script via --suffix
+template("generate_event_interfaces") {
+ action(target_name) {
+ # 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))
+
+ source_prereqs = [
+ "//third_party/WebKit/Source/bindings/scripts/utilities.py",
+ idl_files_list,
+ ] + invoker.sources
+
+ output_file = "$_blink_gen_dir/" + invoker.output_file
+ outputs = [ output_file ]
+
+ script = "//third_party/WebKit/Source/bindings/scripts/generate_event_interfaces.py"
+ args = [
+ "--event-idl-files-list",
+ rebase_path(idl_files_list, root_build_dir),
+ "--event-interfaces-file",
+ rebase_path(output_file, root_build_dir),
+ "--write-file-only-if-changed=1", # Always true for Ninja.
+ ]
+
+ if (defined(invoker.suffix)) {
+ args += [ "--suffix", invoker.suffix ]
+ }
+ }
}
« no previous file with comments | « Source/build/gn_list_to_space_separated_string.py ('k') | Source/config.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698