Commit 540810f7 authored by nbarth@chromium.org's avatar nbarth@chromium.org

IDL build: factor out global objects action into a GYP template

First (simple) step in factoring out redundant GYP actions into templates.
Also moves the 'write_file_only_if_changed' flag to scripts, as that's where
it's used, which allows more simplification.

R=haraken

Review URL: https://codereview.chromium.org/316173008

git-svn-id: svn://svn.chromium.org/blink/trunk@175848 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f088564e
...@@ -11,19 +11,5 @@ ...@@ -11,19 +11,5 @@
'bindings_unittest_files': [ 'bindings_unittest_files': [
'<@(bindings_v8_unittest_files)', '<@(bindings_v8_unittest_files)',
], ],
'conditions': [
# The bindings generator can skip writing generated files if they
# are identical to the already existing file, which avoids
# recompilation. However, a dependency (earlier build step) having
# a newer timestamp than an output (later build step) confuses some
# build systems, so only use this on ninja, which explicitly
# supports this use case (gyp turns all actions into ninja restat
# rules).
['"<(GENERATOR)"=="ninja"', {
'write_file_only_if_changed': '1',
}, {
'write_file_only_if_changed': '0',
}],
],
}, },
} }
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
{ {
'includes': [ 'includes': [
'../bindings.gypi',
'../modules/v8/generated.gypi', # FIXME: remove once core scripts generate qualified includes correctly: http://crbug.com/358074 '../modules/v8/generated.gypi', # FIXME: remove once core scripts generate qualified includes correctly: http://crbug.com/358074
'../v8/v8.gypi', # FIXME: should be v8/v8.gypi: http://crbug.com/358074 '../v8/v8.gypi', # FIXME: should be v8/v8.gypi: http://crbug.com/358074
'v8/generated.gypi', 'v8/generated.gypi',
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
{ {
'includes': [ 'includes': [
# ../.. == Source # ../.. == Source
'../../bindings/bindings.gypi',
'../../bindings/scripts/scripts.gypi', '../../bindings/scripts/scripts.gypi',
'../../core/core.gypi', '../../core/core.gypi',
'core.gypi', 'core.gypi',
...@@ -21,32 +20,11 @@ ...@@ -21,32 +20,11 @@
################################################################################ ################################################################################
{ {
'target_name': 'core_global_objects', 'target_name': 'core_global_objects',
'type': 'none', 'variables': {
'actions': [{ 'idl_files': '<(core_idl_files)',
'action_name': 'compute_core_global_objects', 'output_file': '<(bindings_core_output_dir)/GlobalObjectsCore.pickle',
'inputs': [ },
'<(bindings_scripts_dir)/compute_global_objects.py', 'includes': ['../../bindings/scripts/global_objects.gypi'],
'<(bindings_scripts_dir)/utilities.py',
# Only look in main IDL files (exclude dependencies and testing,
# which should not define global objects).
'<(core_idl_files_list)',
'<@(core_idl_files)',
],
'outputs': [
'<(bindings_core_output_dir)/GlobalObjectsCore.pickle',
],
'action': [
'python',
'<(bindings_scripts_dir)/compute_global_objects.py',
'--idl-files-list',
'<(core_idl_files_list)',
'--write-file-only-if-changed',
'<(write_file_only_if_changed)',
'--',
'<(bindings_core_output_dir)/GlobalObjectsCore.pickle',
],
'message': 'Computing global objects in core',
}]
}, },
################################################################################ ################################################################################
{ {
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
{ {
'includes': [ 'includes': [
# ../.. == Source # ../.. == Source
'../../bindings/bindings.gypi',
'../../bindings/core/core.gypi', '../../bindings/core/core.gypi',
'../../bindings/scripts/scripts.gypi', '../../bindings/scripts/scripts.gypi',
'../../build/scripts/scripts.gypi', # FIXME: Needed for event files, should be in modules, not bindings_modules http://crbug.com/358074 '../../build/scripts/scripts.gypi', # FIXME: Needed for event files, should be in modules, not bindings_modules http://crbug.com/358074
...@@ -135,36 +134,18 @@ ...@@ -135,36 +134,18 @@
################################################################################ ################################################################################
{ {
'target_name': 'modules_global_objects', 'target_name': 'modules_global_objects',
'type': 'none',
'dependencies': [ 'dependencies': [
'../core/generated.gyp:core_global_objects', '../core/generated.gyp:core_global_objects',
], ],
'actions': [{ 'variables': {
'action_name': 'compute_modules_global_objects', 'idl_files': '<(modules_idl_files)',
'inputs': [ 'input_files': [
'<(bindings_scripts_dir)/compute_global_objects.py',
'<(bindings_scripts_dir)/utilities.py',
# Only look in main IDL files (exclude dependencies and testing,
# which should not define global objects).
'<(modules_idl_files_list)',
'<@(modules_idl_files)',
],
'outputs': [
'<(bindings_modules_output_dir)/GlobalObjectsModules.pickle',
],
'action': [
'python',
'<(bindings_scripts_dir)/compute_global_objects.py',
'--idl-files-list',
'<(modules_idl_files_list)',
'--write-file-only-if-changed',
'<(write_file_only_if_changed)',
'--',
'<(bindings_core_output_dir)/GlobalObjectsCore.pickle', '<(bindings_core_output_dir)/GlobalObjectsCore.pickle',
],
'output_file':
'<(bindings_modules_output_dir)/GlobalObjectsModules.pickle', '<(bindings_modules_output_dir)/GlobalObjectsModules.pickle',
], },
'message': 'Computing global objects in modules', 'includes': ['../../bindings/scripts/global_objects.gypi'],
}]
}, },
################################################################################ ################################################################################
{ {
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
{ {
'includes': [ 'includes': [
'../bindings.gypi',
'v8/generated.gypi', 'v8/generated.gypi',
], ],
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This file is meant to be included into a target to provide an action
# to compute global objects in a component.
#
# To use this, create a gyp target with the following form:
# {
# 'target_name': 'component_global_objects',
# 'variables': {
# 'idl_files': '<(list_of_idl_files)',
# 'input_files': ['<(some_dir)/GlobalObjectBaseComponent.pickle'],
# 'output_file': '<(some_dir)/GlobalObjectsComponent.pickle',
# },
# 'includes': ['path/to/this/gypi/file'],
# },
#
# Required variables:
# idl_files - List of .idl files that will be searched in.
# This should *only* contain main IDL files, excluding dependencies and
# testing, which should not define global objects).
# output_file - Pickle file of output.
#
# Optional variables:
# input_files - List of input pickle files of global objects in base
# components. In this case make sure to include a dependencies section
# in the target to ensure this is generated.
#
# Spec: http://heycam.github.io/webidl/#Global
# Design document: http://www.chromium.org/developers/design-documents/idl-build
{
'type': 'none',
'actions': [{
'action_name': 'compute_<(_target_name)',
'message': 'Computing global objects for <(_target_name)',
'variables': {
'input_files%': [],
'idl_files_list': '<|(idl_files_list.tmp <@(idl_files))',
},
'includes': ['scripts.gypi'],
'inputs': [
'<(bindings_scripts_dir)/compute_global_objects.py',
'<(bindings_scripts_dir)/utilities.py',
'<(idl_files_list)',
'<@(idl_files)',
],
'outputs': [
'<(output_file)',
],
'action': [
'python',
'<(bindings_scripts_dir)/compute_global_objects.py',
'--idl-files-list',
'<(idl_files_list)',
'--write-file-only-if-changed',
'<(write_file_only_if_changed)',
'--',
'<@(input_files)',
'<(output_file)',
],
}],
}
...@@ -41,5 +41,19 @@ ...@@ -41,5 +41,19 @@
'v8_types.py', 'v8_types.py',
'v8_utilities.py', 'v8_utilities.py',
], ],
'conditions': [
# These scripts can skip writing generated files if they are identical
# to the already existing files, which avoids further build steps, like
# recompilation. However, a dependency (earlier build step) having a
# newer timestamp than an output (later build step) confuses some build
# systems, so only use this on ninja, which explicitly supports this use
# case (gyp turns all actions into ninja restat rules).
['"<(GENERATOR)"=="ninja"', {
'write_file_only_if_changed': '1',
}, {
'write_file_only_if_changed': '0',
}],
],
}, },
} }
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
{ {
'includes': [ 'includes': [
'core.gypi', 'core.gypi',
'../bindings/bindings.gypi', '../bindings/scripts/scripts.gypi',
'../build/features.gypi', '../build/features.gypi',
'../build/scripts/scripts.gypi', '../build/scripts/scripts.gypi',
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment