1#
2# libjingle
3# Copyright 2013, Google Inc.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are met:
7#
8#  1. Redistributions of source code must retain the above copyright notice,
9#     this list of conditions and the following disclaimer.
10#  2. Redistributions in binary form must reproduce the above copyright notice,
11#     this list of conditions and the following disclaimer in the documentation
12#     and/or other materials provided with the distribution.
13#  3. The name of the author may not be used to endorse or promote products
14#     derived from this software without specific prior written permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27
28# Copied from Chromium's src/build/isolate.gypi
29#
30# It was necessary to copy this file to libjingle , because the path to
31# build/common.gypi is different for the standalone and Chromium builds. Gyp
32# doesn't permit conditional inclusion or variable expansion in include paths.
33# http://code.google.com/p/gyp/wiki/InputFormatReference#Including_Other_Files
34#
35# Local modifications:
36# * Removed include of '../chrome/version.gypi'.
37# * Removal passing of version_full variable created in version.gypi:
38#   '--extra-variable', 'version_full=<(version_full)',
39
40# This file is meant to be included into a target to provide a rule
41# to "build" .isolate files into a .isolated file.
42#
43# To use this, create a gyp target with the following form:
44# 'conditions': [
45#   ['test_isolation_mode != "noop"', {
46#     'targets': [
47#       {
48#         'target_name': 'foo_test_run',
49#         'type': 'none',
50#         'dependencies': [
51#           'foo_test',
52#         ],
53#         'includes': [
54#           '../build/isolate.gypi',
55#           'foo_test.isolate',
56#         ],
57#         'sources': [
58#           'foo_test.isolate',
59#         ],
60#       },
61#     ],
62#   }],
63# ],
64#
65# Note: foo_test.isolate is included and a source file. It is an inherent
66# property of the .isolate format. This permits to define GYP variables but is
67# a stricter format than GYP so isolate.py can read it.
68#
69# The generated .isolated file will be:
70#   <(PRODUCT_DIR)/foo_test.isolated
71#
72# See http://dev.chromium.org/developers/testing/isolated-testing/for-swes
73# for more information.
74
75{
76  'rules': [
77    {
78      'rule_name': 'isolate',
79      'extension': 'isolate',
80      'inputs': [
81        # Files that are known to be involved in this step.
82        '<(DEPTH)/tools/swarming_client/isolate.py',
83        '<(DEPTH)/tools/swarming_client/run_isolated.py',
84
85        # Disable file tracking by the build driver for now. This means the
86        # project must have the proper build-time dependency for their runtime
87        # dependency. This improves the runtime of the build driver since it
88        # doesn't have to stat() all these files.
89        #
90        # More importantly, it means that even if a isolate_dependency_tracked
91        # file is missing, for example if a file was deleted and the .isolate
92        # file was not updated, that won't break the build, especially in the
93        # case where foo_tests_run is not built! This should be reenabled once
94        # the switch-over to running tests on Swarm is completed.
95        #'<@(isolate_dependency_tracked)',
96      ],
97      'outputs': [
98        '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated',
99      ],
100      'action': [
101        'python',
102        '<(DEPTH)/tools/swarming_client/isolate.py',
103        '<(test_isolation_mode)',
104        '--result', '<@(_outputs)',
105        '--isolate', '<(RULE_INPUT_PATH)',
106
107        # Variables should use the -V FOO=<(FOO) form so frequent values,
108        # like '0' or '1', aren't stripped out by GYP. Run 'isolate.py help' for
109        # more details.
110        #
111        # This list needs to be kept in sync with the cmd line options
112        # in src/build/android/pylib/gtest/setup.py.
113
114        # Path variables are used to replace file paths when loading a .isolate
115        # file
116        '--path-variable', 'DEPTH', '<(DEPTH)',
117        '--path-variable', 'PRODUCT_DIR', '<(PRODUCT_DIR) ',
118
119        '--config-variable', 'OS=<(OS)',
120        '--config-variable', 'chromeos=<(chromeos)',
121        '--config-variable', 'component=<(component)',
122        # TODO(kbr): move this to chrome_tests.gypi:gles2_conform_tests_run
123        # once support for user-defined config variables is added.
124        '--config-variable',
125          'internal_gles2_conform_tests=<(internal_gles2_conform_tests)',
126        '--config-variable', 'icu_use_data_file_flag=<(icu_use_data_file_flag)',
127        '--config-variable', 'use_openssl=<(use_openssl)',
128      ],
129      'conditions': [
130        # Note: When gyp merges lists, it appends them to the old value.
131        ['OS=="mac"', {
132          # <(mac_product_name) can contain a space, so don't use FOO=<(FOO)
133          # form.
134          'action': [
135            '--extra-variable', 'mac_product_name', '<(mac_product_name)',
136          ],
137        }],
138        ["test_isolation_outdir!=''", {
139          'action': [ '--isolate-server', '<(test_isolation_outdir)' ],
140        }],
141        ['test_isolation_fail_on_missing == 0', {
142          'action': ['--ignore_broken_items'],
143        }],
144      ],
145    },
146  ],
147}
148