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