[engine] Support implicit sources in v2 engine #4294

Merged
merged 1 commit into from Mar 1, 2017

Conversation

Projects
None yet
3 participants
@peiyuwang
Contributor

peiyuwang commented Feb 28, 2017

Problem

In order to compute source files signature, v2 engine looks for sources field, it needs to support implicit sources with 5813a2d

Solution

The approach in the rb is more short term/cheap to continue to use TargetAdaptor, extends this hierarchy to have default source suffixes and excludes there. The alternative/longer term solution is #3560.

Result

See the new test in test_graph.test_implicit_sources, w/o the change it would fail:

                           except Exception as e:
                             raise TargetDefinitionException(
                                 target_adaptor.address,
                     >           'Failed to instantiate Target with type {}: {}'.format(target_cls, e))
                     E       TargetDefinitionException: Invalid target BuildFileAddress(testprojects/tests/python/pants/file_sets/BUILD, implicit_sources): Failed to instantiate Target with type <class 'pants.backend.python.targets.python_library.PythonLibrary'>: Unrecognized command line flags on global scope: --color, --confcutdir, --resultlog
                     
                     .pants.d/python-setup/chroots/a447b84a0a5e9517301fc0570a067595fbecdf2f/pants/engine/legacy/graph.py:158: TargetDefinitionException

@peiyuwang peiyuwang requested review from baroquebobcat, stuhood, kwlzn and ity Feb 28, 2017

@stuhood

Thanks Peiyu. It's ugly, but it will work until #3560!

@ity

ity approved these changes Mar 1, 2017

@peiyuwang peiyuwang merged commit 8d208cc into pantsbuild:master Mar 1, 2017

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details

lenucksi added a commit to lenucksi/pants that referenced this pull request Apr 25, 2017

[engine] Support implicit sources in v2 engine (#4294)
### Problem

In order to compute source files signature, v2 engine looks for `sources` field, now with 5813a2d , it needs to support implicit sources with `sources` field is not present.

### Solution

The approach in the rb is more short term/cheap to continue to use `TargetAdaptor`, extends this hierarchy to have default source suffixes and excludes there. The alternative/longer term solution is #3560.

### Result

See the new test in `test_graph.test_implicit_sources`, w/o the change it would fail:
```
                           except Exception as e:
                             raise TargetDefinitionException(
                                 target_adaptor.address,
                     >           'Failed to instantiate Target with type {}: {}'.format(target_cls, e))
                     E       TargetDefinitionException: Invalid target BuildFileAddress(testprojects/tests/python/pants/file_sets/BUILD, implicit_sources): Failed to instantiate Target with type <class 'pants.backend.python.targets.python_library.PythonLibrary'>: Unrecognized command line flags on global scope: --color, --confcutdir, --resultlog
                     
                     .pants.d/python-setup/chroots/a447b84a0a5e9517301fc0570a067595fbecdf2f/pants/engine/legacy/graph.py:158: TargetDefinitionException
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment