important-librarian-62877
06/06/2020, 12:39 AMexample_task(
name='compile',
sources=['./**/*'],
output='output.cpython-36m-x86_64-linux-gnu.so',
dependencies=[
'3rdparty:numpy
]
)
In another BUILD file:
python_library(
name='impl',
sources=['cli/*.py'],
dependencies=[
'submodules/plugins/plugins:example_task',
]
)
python_binary(
name='cli',
zip_safe=False,
sources=['cli/cli.py'],
dependencies=[':impl'],
tags={'default-build', 'docker-build'}
)
aloof-angle-91616
06/06/2020, 12:41 AMimportant-librarian-62877
06/06/2020, 12:50 AMaloof-angle-91616
06/06/2020, 12:57 AM.so
file supposed to be at the top level of the zip file (the pex file)?important-librarian-62877
06/06/2020, 12:58 AMaloof-angle-91616
06/06/2020, 12:58 AM'./*'
to my globssources
example_task()
targetexample_task(
name='compile',
sources=['./*', './**/*'],
output='output.cpython-36m-x86_64-linux-gnu.so',
dependencies=[
'3rdparty:numpy
]
)
important-librarian-62877
06/06/2020, 1:00 AM**
would include the top level.aloof-angle-91616
06/06/2020, 1:00 AM**/*
to include the current directory. cc @witty-crayon-22786['*', '**/*']
, without the leading ./
?important-librarian-62877
06/06/2020, 1:02 AMaloof-angle-91616
06/06/2020, 1:02 AM'**/*'
would be ideal. but it's possible they all may fail, no rushimportant-librarian-62877
06/06/2020, 1:03 AMaloof-angle-91616
06/06/2020, 1:03 AMI do see the output file being created in the pants cache or temp directory (can't remember the exact file path), it just isn't making it into the pexsee it how?
.pants.d/gen/
? ok i get thatPexBuilderWrapper
all the source files are individually added to the pex, for sources and resources separately. if a file is left off, it won't get included just because it's in the same directory if it's not specified in the sources
kwarg of your generated resources()
targetimportant-librarian-62877
06/06/2020, 1:13 AMaloof-angle-91616
06/06/2020, 1:13 AM_copy_target_attributes
["output"]
I had assumed the output field would be treated as a sourcethis is super super reasonable! i think it might be possible to create more than one "sources" field, if you check the docstring and usages of
self.create_sources_field()
in src/python/pants/build_graph/target.py
important-librarian-62877
06/06/2020, 1:16 AMaloof-angle-91616
06/06/2020, 1:16 AM'output.cpython-36m-x86_64-linux-gnu.so'
as a glob, that would be helpful to make an issueimportant-librarian-62877
06/06/2020, 1:22 AMpath/***/**.py
works as I have run into that previously where a library was not pulling in all the modules. I suppose the .
could be throwing it off.aloof-angle-91616
06/06/2020, 1:22 AMimportant-librarian-62877
06/06/2020, 1:27 AM./.pants.d/pyprep
aloof-angle-91616
06/06/2020, 1:27 AM.so
and the contents of the containing directory?important-librarian-62877
06/06/2020, 1:29 AM./.pants.d/pyprep/compile-cython/9c44cc2743fa/submodules.plugins.plugins.compile-plugins/85f16c5ba5a9/output.cpython-36m-x86_64-linux-gnu.so
aloof-angle-91616
06/06/2020, 1:31 AMpyprep
goal, which makes sense. the SimpleCodegenTask
will copy over sources.important-librarian-62877
06/06/2020, 1:34 AM./pants binary cli/cli::
is the command I am running. Yepp, I can certainly do that 😄aloof-angle-91616
06/06/2020, 1:35 AM.pants.d/binary/py/current/submodules.plugins.plugins.compile-plugins/current/
?important-librarian-62877
06/06/2020, 1:37 AMcli.cli.cli
path. There isn't a submodules one.aloof-angle-91616
06/06/2020, 1:37 AMimportant-librarian-62877
06/08/2020, 3:48 AMfind_sources()
function in our plugin that was deprecated in favor of the sources_globs
attribute of the SimpleCodegenTask. Setting that attribute to the target.output
fixed the problem. Thanks for the assistance on this one 😄aloof-angle-91616
06/08/2020, 4:06 AMimportant-librarian-62877
06/08/2020, 4:53 AM[target.output]
in the find_sources()
function, so I simulated the "Upgrade one step at a time" by just looking at the relevant files in sequence in git. Thankfully the function was deprecated in 1.10 so I didn't have to look too far 😂.aloof-angle-91616
06/08/2020, 4:54 AMimportant-librarian-62877
06/08/2020, 5:12 AMaloof-angle-91616
06/08/2020, 5:13 AM