github.phpd.cn/thought-machine/please@v12.2.0+incompatible/test/parse_test/BUILD (about)

     1  # Simulates a code generating rule to test the require / provide mechanism.
     2  genrule(
     3      name = 'test_require_py',
     4      outs = ['test_require.py'],
     5      cmd = 'touch $OUT',
     6      test_only = True,
     7  )
     8  
     9  genrule(
    10      name = 'test_require_go',
    11      outs = ['test_require.go'],
    12      cmd = 'touch $OUT',
    13      test_only = True,
    14  )
    15  
    16  filegroup(
    17      name = 'test_require',
    18      srcs = [
    19          ':test_require_go',
    20          ':test_require_py',
    21      ],
    22      provides = {
    23          'py': ':test_require_py',
    24          'go': ':test_require_go',
    25      },
    26      test_only = True,
    27      deps = [
    28          ':test_require_go',
    29          ':test_require_py',
    30      ],
    31  )
    32  
    33  python_test(
    34      name = 'require_provide_test',
    35      srcs = ['require_provide_test.py'],
    36      deps = [
    37          ':test_require',
    38      ],
    39  )
    40  
    41  # Test for adding additional outputs to a target.
    42  genrule(
    43      name = '_gen_output_name',
    44      cmd = 'echo test_additional_output.txt',
    45      post_build = lambda _, output: add_out(
    46          '_gen_output',
    47          ''.join(output).strip(),
    48      ),
    49  )
    50  
    51  genrule(
    52      name = '_gen_output',
    53      cmd = 'echo -n "kittens" > $OUT',
    54      deps = [
    55          ':_gen_output_name',
    56      ],
    57  )
    58  
    59  go_test(
    60      name = 'additional_output_test',
    61      srcs = ['additional_output_test.go'],
    62      data = [':_gen_output'],
    63  )
    64  
    65  # Test for a target with a missing tool; we should still be able to parse the package.
    66  genrule(
    67      name = 'missing_tool',
    68      cmd = '$TOOL --version',
    69      labels = ['manual'],
    70      tools = ['python4.7'],
    71  )