diff options
author | blundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-29 21:36:35 +0000 |
---|---|---|
committer | blundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-29 21:36:35 +0000 |
commit | 5b6413f7eaf2c41cded749e442d12bb9aa24bf84 (patch) | |
tree | 5f0a1ea0844e23bec2bd57ba8fc7e57dd3489add | |
parent | fea0b9617466710b4961623de0e7a34846e88cbe (diff) | |
download | chromium_src-5b6413f7eaf2c41cded749e442d12bb9aa24bf84.zip chromium_src-5b6413f7eaf2c41cded749e442d12bb9aa24bf84.tar.gz chromium_src-5b6413f7eaf2c41cded749e442d12bb9aa24bf84.tar.bz2 |
Specify dependences correctly when building mac tools for iOS.
Several auxiliary tools used when building Chrome for iOS are generated via the
following two-step pattern: (1) compiling the executable with ninja, and (2)
copying the executable into a location that is shared with other projects.
Previously, these two steps were specified as actions in the same target.
However, as the ordering of multiple actions in one target is defined only by
inputs and outputs and the compilation action had no inputs/outputs set, the
copying action wasn't properly depending on the compilation action.
As it's challenging to set correct inputs for the ninja build, this CL
separates these actions into two targets in order to be able to specify that
the second action should not run until the first action finishes.
Review URL: https://chromiumcodereview.appspot.com/11301003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164743 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | breakpad/breakpad.gyp | 25 | ||||
-rw-r--r-- | build/ios/mac_build.gypi | 8 | ||||
-rw-r--r-- | testing/iossim/iossim.gyp | 189 | ||||
-rw-r--r-- | third_party/protobuf/protobuf.gyp | 63 |
4 files changed, 179 insertions, 106 deletions
diff --git a/breakpad/breakpad.gyp b/breakpad/breakpad.gyp index b121ced..e8114f4 100644 --- a/breakpad/breakpad.gyp +++ b/breakpad/breakpad.gyp @@ -718,12 +718,24 @@ ], }], [ 'OS=="ios"', { + 'variables': { + 'ninja_output_dir': 'ninja-breakpad', + 'ninja_product_dir': + '<(DEPTH)/xcodebuild/<(ninja_output_dir)/<(CONFIGURATION_NAME)', + }, + # Generation is done via two actions: (1) compiling the executable with + # ninja, and (2) copying the executable into a location that is shared + # with other projects. These actions are separated into two targets in + # order to be able to specify that the second action should not run until + # the first action finishes (since the ordering of multiple actions in + # one target is defined only by inputs and outputs, and it's impossible + # to set correct inputs for the ninja build, so setting all the inputs + # and outputs isn't an option). 'targets': [ { - 'target_name': 'breakpad_utilities', + 'target_name': 'compile_breakpad_utilities', 'type': 'none', 'variables': { - 'ninja_output_dir': 'ninja-breakpad', # Gyp to rerun 're_run_targets': [ 'breakpad/breakpad.gyp', @@ -742,6 +754,15 @@ ], 'message': 'Generating the breakpad executables', }, + ], + }, + { + 'target_name': 'breakpad_utilities', + 'type': 'none', + 'dependencies': [ + 'compile_breakpad_utilities', + ], + 'actions': [ { 'action_name': 'copy dump_syms', 'inputs': [ diff --git a/build/ios/mac_build.gypi b/build/ios/mac_build.gypi index 9a73918..775ff26 100644 --- a/build/ios/mac_build.gypi +++ b/build/ios/mac_build.gypi @@ -13,6 +13,10 @@ # # The name of a directory used for ninja. This cannot be shared with # # another mac build. # 'ninja_output_dir': 'ninja-foo', +# # The full path to the location in which the ninja executable should be +# # placed. This cannot be shared with another mac build. +# 'ninja_product_dir': +# '<(DEPTH)/xcodebuild/<(ninja_output_dir)/<(CONFIGURATION_NAME)', # # The list of all the gyp files that contain the targets to run. # 're_run_targets': [ # 'foo.gyp', @@ -35,10 +39,6 @@ # } { 'variables': { - # Convenience variable pointing to the ninja product directory. - 'ninja_product_dir': - '<(DEPTH)/xcodebuild/<(ninja_output_dir)/<(CONFIGURATION_NAME)', - # Common ninja command line flags. 'ninja_cmd': [ # Bounce through clean_env to clean up the environment so things diff --git a/testing/iossim/iossim.gyp b/testing/iossim/iossim.gyp index 2894be0..45601f4 100644 --- a/testing/iossim/iossim.gyp +++ b/testing/iossim/iossim.gyp @@ -3,91 +3,118 @@ # found in the LICENSE file. { - 'targets': [ - { - 'target_name': 'iossim', - 'conditions': [ - ['OS != "ios"', { - 'type': 'executable', - 'variables': { - 'developer_dir': '<!(xcode-select -print-path)', - 'iphone_sim_path': '<(developer_dir)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks', - 'other_frameworks_path': '<(developer_dir)/../OtherFrameworks' - }, - 'dependencies': [ - 'third_party/class-dump/class-dump.gyp:class-dump', - ], - 'include_dirs': [ - '<(INTERMEDIATE_DIR)/iossim', - ], - 'sources': [ - 'iossim.mm', - '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h', - ], - 'libraries': [ - '$(SDKROOT)/System/Library/Frameworks/Foundation.framework', - ], - 'actions': [ - { - 'action_name': 'generate_iphone_sim_header', - 'inputs': [ - '<(iphone_sim_path)/iPhoneSimulatorRemoteClient.framework/Versions/Current/iPhoneSimulatorRemoteClient', - '<(PRODUCT_DIR)/class-dump', - ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h' - ], - 'action': [ - # Actions don't provide a way to redirect stdout, so a custom - # script is invoked that will execute the first argument and write - # the output to the file specified as the second argument. - './redirect-stdout.sh', - '<(PRODUCT_DIR)/class-dump -CiPhoneSimulator <(iphone_sim_path)/iPhoneSimulatorRemoteClient.framework', - '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h', - ], - 'message': 'Generating header', + 'conditions': [ + ['OS != "ios"', { + 'targets': [ + { + 'target_name': 'iossim', + 'type': 'executable', + 'variables': { + 'developer_dir': '<!(xcode-select -print-path)', + 'iphone_sim_path': '<(developer_dir)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks', + 'other_frameworks_path': '<(developer_dir)/../OtherFrameworks' }, - ], - }, { # else, OS == "ios" - 'type': 'none', - 'variables': { - 'ninja_output_dir': 'ninja-iossim', - # Gyp to rerun - 're_run_targets': [ - 'testing/iossim/iossim.gyp', + 'dependencies': [ + 'third_party/class-dump/class-dump.gyp:class-dump', + ], + 'include_dirs': [ + '<(INTERMEDIATE_DIR)/iossim', + ], + 'sources': [ + 'iossim.mm', + '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h', + ], + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Foundation.framework', + ], + 'actions': [ + { + 'action_name': 'generate_iphone_sim_header', + 'inputs': [ + '<(iphone_sim_path)/iPhoneSimulatorRemoteClient.framework/Versions/Current/iPhoneSimulatorRemoteClient', + '<(PRODUCT_DIR)/class-dump', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h' + ], + 'action': [ + # Actions don't provide a way to redirect stdout, so a custom + # script is invoked that will execute the first argument and write + # the output to the file specified as the second argument. + './redirect-stdout.sh', + '<(PRODUCT_DIR)/class-dump -CiPhoneSimulator <(iphone_sim_path)/iPhoneSimulatorRemoteClient.framework', + '<(INTERMEDIATE_DIR)/iossim/iPhoneSimulatorRemoteClient.h', + ], + 'message': 'Generating header', + }, ], }, - 'includes': ['../../build/ios/mac_build.gypi'], - 'actions': [ - { - 'action_name': 'compile iossim', - 'inputs': [], - 'outputs': [], - 'action': [ - '<@(ninja_cmd)', - 'iossim', + ], + }, { # else, OS == "ios" + 'variables': { + 'ninja_output_dir': 'ninja-iossim', + 'ninja_product_dir': + '<(DEPTH)/xcodebuild/<(ninja_output_dir)/<(CONFIGURATION_NAME)', + }, + # Generation is done via two actions: (1) compiling the executable with + # ninja, and (2) copying the executable into a location that is shared + # with other projects. These actions are separated into two targets in + # order to be able to specify that the second action should not run + # until the first action finishes (since the ordering of multiple + # actions in one target is defined only by inputs and outputs, and it's + # impossible to set correct inputs for the ninja build, so setting all + # the inputs and outputs isn't an option). + 'targets': [ + { + 'target_name': 'compile_iossim', + 'type': 'none', + 'variables': { + # Gyp to rerun + 're_run_targets': [ + 'testing/iossim/iossim.gyp', ], - 'message': 'Generating the iossim executable', }, - { - 'action_name': 'copy iossim', - 'inputs': [ - # TODO(ios): It should be possible to define the input, but - # adding it causes gyp to complain about duplicate id. - # '<(ninja_product_dir)/iossim', - ], - 'outputs': [ - '<(DEPTH)/xcodebuild/<(CONFIGURATION_NAME)/iossim', - ], - 'action': [ - 'cp', - '<(ninja_product_dir)/iossim', - '<(DEPTH)/xcodebuild/<(CONFIGURATION_NAME)/iossim', - ], - }, - ], - }], - ], - }, + 'includes': ['../../build/ios/mac_build.gypi'], + 'actions': [ + { + 'action_name': 'compile iossim', + 'inputs': [], + 'outputs': [], + 'action': [ + '<@(ninja_cmd)', + 'iossim', + ], + 'message': 'Generating the iossim executable', + }, + ], + }, + { + 'target_name': 'iossim', + 'type': 'none', + 'dependencies': [ + 'compile_iossim', + ], + 'actions': [ + { + 'action_name': 'copy iossim', + 'inputs': [ + # TODO(ios): It should be possible to define the input, but + # adding it causes gyp to complain about duplicate id. + # '<(ninja_product_dir)/iossim', + ], + 'outputs': [ + '<(DEPTH)/xcodebuild/<(CONFIGURATION_NAME)/iossim', + ], + 'action': [ + 'cp', + '<(ninja_product_dir)/iossim', + '<(DEPTH)/xcodebuild/<(CONFIGURATION_NAME)/iossim', + ], + }, + ], + }, + ], + }, + ], ], } diff --git a/third_party/protobuf/protobuf.gyp b/third_party/protobuf/protobuf.gyp index 6b060f2..5aa2b4f 100644 --- a/third_party/protobuf/protobuf.gyp +++ b/third_party/protobuf/protobuf.gyp @@ -24,7 +24,47 @@ 'WIN32_LEAN_AND_MEAN', # Protobuf defines this itself. ], }, - }] + }], + ['OS=="ios"', { + 'variables': { + 'ninja_output_dir': 'ninja-protoc', + 'ninja_product_dir': + '<(DEPTH)/xcodebuild/<(ninja_output_dir)/<(CONFIGURATION_NAME)', + # Gyp to rerun + 're_run_targets': [ + 'third_party/protobuf/protobuf.gyp', + ], + }, + 'targets': [ + { + # On iOS, generating protoc is done via two actions: (1) compiling + # the executable with ninja, and (2) copying the executable into a + # location that is shared with other projects. These actions are + # separated into two targets in order to be able to specify that the + # second action should not run until the first action finishes (since + # the ordering of multiple actions in one target is defined only by + # inputs and outputs, and it's impossible to set correct inputs for + # the ninja build, so setting all the inputs and outputs isn't an + # option). The first target is given here; the second target is the + # normal protoc target under the condition that "OS==iOS". + 'target_name': 'compile_protoc', + 'type': 'none', + 'includes': ['../../build/ios/mac_build.gypi'], + 'actions': [ + { + 'action_name': 'compile protoc', + 'inputs': [], + 'outputs': [], + 'action': [ + '<@(ninja_cmd)', + 'protoc', + ], + 'message': 'Generating the C++ protocol buffers compiler', + }, + ], + }, + ], + }], ], 'targets': [ # The "lite" lib is about 1/7th the size of the heavy lib, @@ -236,26 +276,11 @@ ], }, { # else, OS=="ios" 'type': 'none', - 'variables': { - 'ninja_output_dir': 'ninja-protoc', - # Gyp to rerun - 're_run_targets': [ - 'third_party/protobuf/protobuf.gyp', - ], - }, - 'includes': ['../../build/ios/mac_build.gypi'], + 'dependencies': [ + 'compile_protoc', + ], 'actions': [ { - 'action_name': 'compile protoc', - 'inputs': [], - 'outputs': [], - 'action': [ - '<@(ninja_cmd)', - 'protoc', - ], - 'message': 'Generating the C++ protocol buffers compiler', - }, - { 'action_name': 'copy protoc', 'inputs': [ '<(ninja_product_dir)/protoc', |