blob: 91b92a66eba9548a2a98ebb280269c63e9e8c205 [file] [log] [blame]
kjellander@webrtc.org2a973172013-10-02 19:31:16 +00001# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9# Copied from Chromium's src/build/isolate.gypi
10#
11# It was necessary to copy this file to WebRTC, because the path to
12# build/common.gypi is different for the standalone and Chromium builds. Gyp
13# doesn't permit conditional inclusion or variable expansion in include paths.
14# http://code.google.com/p/gyp/wiki/InputFormatReference#Including_Other_Files
15
16# This file is meant to be included into a target to provide a rule
17# to "build" .isolate files into a .isolated file.
18#
19# To use this, create a gyp target with the following form:
20# 'conditions': [
21# ['test_isolation_mode != "noop"', {
22# 'targets': [
23# {
24# 'target_name': 'foo_test_run',
25# 'type': 'none',
26# 'dependencies': [
27# 'foo_test',
28# ],
29# 'includes': [
30# '../build/isolate.gypi',
31# 'foo_test.isolate',
32# ],
33# 'sources': [
34# 'foo_test.isolate',
35# ],
36# },
37# ],
38# }],
39# ],
40#
41# Note: foo_test.isolate is included and a source file. It is an inherent
42# property of the .isolate format. This permits to define GYP variables but is
43# a stricter format than GYP so isolate.py can read it.
44#
45# The generated .isolated file will be:
46# <(PRODUCT_DIR)/foo_test.isolated
47
48{
49 'rules': [
50 {
51 'rule_name': 'isolate',
52 'extension': 'isolate',
53 'inputs': [
54 # Files that are known to be involved in this step.
55 '<(DEPTH)/tools/swarm_client/isolate.py',
56 '<(DEPTH)/tools/swarm_client/run_isolated.py',
57 '<(DEPTH)/tools/swarm_client/googletest/run_test_cases.py',
58
59 # Disable file tracking by the build driver for now. This means the
60 # project must have the proper build-time dependency for their runtime
61 # dependency. This improves the runtime of the build driver since it
62 # doesn't have to stat() all these files.
63 #
64 # More importantly, it means that even if a isolate_dependency_tracked
65 # file is missing, for example if a file was deleted and the .isolate
66 # file was not updated, that won't break the build, especially in the
67 # case where foo_tests_run is not built! This should be reenabled once
68 # the switch-over to running tests on Swarm is completed.
69 #'<@(isolate_dependency_tracked)',
70 ],
71 'outputs': [
72 '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated',
73 ],
74 'conditions': [
75 ["test_isolation_outdir==''", {
76 'action': [
77 'python',
78 '<(DEPTH)/tools/swarm_client/isolate.py',
79 '<(test_isolation_mode)',
80 # GYP will eliminate duplicate arguments so '<(PRODUCT_DIR)' cannot
81 # be provided twice. To work around this behavior, append '/'.
82 #
83 # Also have a space after <(PRODUCT_DIR) or visual studio will
84 # escape the argument wrappping " with the \ and merge it into
85 # the following arguments.
86 #
87 # Other variables should use the -V FOO=<(FOO) form so frequent
88 # values, like '0' or '1', aren't stripped out by GYP.
89 '--outdir', '<(PRODUCT_DIR)/ ',
90 '--variable', 'PRODUCT_DIR', '<(PRODUCT_DIR) ',
91 '--variable', 'OS=<(OS)',
92 '--result', '<@(_outputs)',
93 '--isolate', '<(RULE_INPUT_PATH)',
94 ],
95 }, {
96 'action': [
97 'python',
98 '<(DEPTH)/tools/swarm_client/isolate.py',
99 '<(test_isolation_mode)',
100 '--outdir', '<(test_isolation_outdir)',
101 # See comment above.
102 '--variable', 'PRODUCT_DIR', '<(PRODUCT_DIR) ',
103 '--variable', 'OS=<(OS)',
104 '--result', '<@(_outputs)',
105 '--isolate', '<(RULE_INPUT_PATH)',
106 ],
107 }],
108 ['test_isolation_fail_on_missing == 0', {
109 'action': ['--ignore_broken_items'],
110 },
111 ],
112 ],
113
114 'msvs_cygwin_shell': 0,
115 },
116 ],
117}