ambitious-actor-36781
05/25/2022, 1:26 AMhundreds-father-404
05/25/2022, 1:40 AMtgt.get(SourcesField)hundreds-father-404
05/25/2022, 1:41 AMambitious-actor-36781
05/25/2022, 1:41 AMhundreds-father-404
05/25/2022, 1:42 AMSecondaryOwnerMixin so that you get file-like benefits, like that a file argument still works on the target
This is how pex_binary works. It does not "own" the file entry_point=main.py, yet you can still do ./pants run project/main.py
That one is safe to use on as many targets as you'd likehundreds-father-404
05/25/2022, 1:42 AMand PythonI wonder if that Python should be "owned" by
python_source target, and then your new target links up to it. Similar to pex_binaryambitious-actor-36781
05/25/2022, 1:43 AMambitious-actor-36781
05/25/2022, 1:46 AMhundreds-father-404
05/25/2022, 1:47 AMpex_binary, the gist is:
1. ensure the python_source target is in the dependencies (e.g. via dep inference rule)
2. in your rule to build stuff, use SourceFiles or PythonSourceFiles to get the Python file + all its deps present
3. Also use SecondaryOwnerMixin for nice semanticsambitious-actor-36781
05/25/2022, 2:17 AMhundreds-father-404
05/25/2022, 3:47 AMambitious-actor-36781
05/25/2022, 4:18 AMyou must define sources on the targetambitious-actor-36781
05/25/2022, 4:18 AMambitious-actor-36781
05/25/2022, 4:19 AMhundreds-father-404
05/25/2022, 4:44 AMStrippedSourceFiles