Home | History | Annotate | Download | only in build
      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 # This file is meant to be included into a target to provide a rule
     36 # to "build" .isolate files into a .isolated file.
     37 #
     38 # To use this, create a gyp target with the following form:
     39 # 'conditions': [
     40 #   ['test_isolation_mode != "noop"', {
     41 #     'targets': [
     42 #       {
     43 #         'target_name': 'foo_test_run',
     44 #         'type': 'none',
     45 #         'dependencies': [
     46 #           'foo_test',
     47 #         ],
     48 #         'includes': [
     49 #           '../build/isolate.gypi',
     50 #           'foo_test.isolate',
     51 #         ],
     52 #         'sources': [
     53 #           'foo_test.isolate',
     54 #         ],
     55 #       },
     56 #     ],
     57 #   }],
     58 # ],
     59 #
     60 # Note: foo_test.isolate is included and a source file. It is an inherent
     61 # property of the .isolate format. This permits to define GYP variables but is
     62 # a stricter format than GYP so isolate.py can read it.
     63 #
     64 # The generated .isolated file will be:
     65 #   <(PRODUCT_DIR)/foo_test.isolated
     66 
     67 {
     68   'rules': [
     69     {
     70       'rule_name': 'isolate',
     71       'extension': 'isolate',
     72       'inputs': [
     73         # Files that are known to be involved in this step.
     74         '<(DEPTH)/tools/swarming_client/isolate.py',
     75         '<(DEPTH)/tools/swarming_client/run_isolated.py',
     76         '<(DEPTH)/tools/swarming_client/googletest/run_test_cases.py',
     77 
     78         # Disable file tracking by the build driver for now. This means the
     79         # project must have the proper build-time dependency for their runtime
     80         # dependency. This improves the runtime of the build driver since it
     81         # doesn't have to stat() all these files.
     82         #
     83         # More importantly, it means that even if a isolate_dependency_tracked
     84         # file is missing, for example if a file was deleted and the .isolate
     85         # file was not updated, that won't break the build, especially in the
     86         # case where foo_tests_run is not built! This should be reenabled once
     87         # the switch-over to running tests on Swarm is completed.
     88         #'<@(isolate_dependency_tracked)',
     89       ],
     90       'outputs': [
     91         '<(PRODUCT_DIR)/<(RULE_INPUT_ROOT).isolated',
     92       ],
     93       'conditions': [
     94         ["test_isolation_outdir==''", {
     95           'action': [
     96             'python',
     97             '<(DEPTH)/tools/swarming_client/isolate.py',
     98             '<(test_isolation_mode)',
     99             # GYP will eliminate duplicate arguments so '<(PRODUCT_DIR)' cannot
    100             # be provided twice. To work around this behavior, append '/'.
    101             #
    102             # Also have a space after <(PRODUCT_DIR) or visual studio will
    103             # escape the argument wrappping " with the \ and merge it into
    104             # the following arguments.
    105             #
    106             # Other variables should use the -V FOO=<(FOO) form so frequent
    107             # values, like '0' or '1', aren't stripped out by GYP.
    108             '--outdir', '<(PRODUCT_DIR)/ ',
    109             '--variable', 'PRODUCT_DIR', '<(PRODUCT_DIR) ',
    110             '--variable', 'OS=<(OS)',
    111             '--result', '<@(_outputs)',
    112             '--isolate', '<(RULE_INPUT_PATH)',
    113           ],
    114         }, {
    115           'action': [
    116             'python',
    117             '<(DEPTH)/tools/swarming_client/isolate.py',
    118             '<(test_isolation_mode)',
    119             '--outdir', '<(test_isolation_outdir)',
    120             # See comment above.
    121             '--variable', 'PRODUCT_DIR', '<(PRODUCT_DIR) ',
    122             '--variable', 'OS=<(OS)',
    123             '--result', '<@(_outputs)',
    124             '--isolate', '<(RULE_INPUT_PATH)',
    125           ],
    126         }],
    127         ['test_isolation_fail_on_missing == 0', {
    128             'action': ['--ignore_broken_items'],
    129           },
    130         ],
    131       ],
    132 
    133       'msvs_cygwin_shell': 0,
    134     },
    135   ],
    136 }
    137