wide-midnight-78598
01/13/2022, 1:56 PMoutput_directories doesn't appear to visibly do anything
https://github.com/sureshjoshi/pants-pyoxidizer-plugin/blob/33be0f2e2d03b0a487d9e0[…]1062b3bb28afa85e/pants-plugins/experimental/pyoxidizer/rules.pywide-midnight-78598
01/13/2022, 2:27 PMsnapshot = await Get(Snapshot, Digest, result.output_digest)
But I'm not sure of the mechanism which actually pulls them into the dist folder - that part is mildly magical.
I see the BuildPackage takes in the output_digest, which contains everything - so does this mean each file I want to extract needs to be it's own BuiltPackageArtifact? So like, I'd pull 20-30 artifacts? Or have I missed an API that handles that?
return BuiltPackage(
result.output_digest,
artifacts=(
BuiltPackageArtifact(
f"./build/x86_64-apple-darwin/debug/install/{output_filename}"
),
),
)
Something like this appears to work, but I don't know that it's canonical:
snapshot = await Get(Snapshot, Digest, result.output_digest)
artifacts = [BuiltPackageArtifact(file) for file in snapshot.files]
return BuiltPackage(
result.output_digest,
artifacts=tuple(artifacts),
)hundreds-father-404
01/13/2022, 5:55 PM./pants package goal, per my read of core/goals/package.py.
What matters is the BuiltPackage having the correct output_digest, which it sounds like is working how you want?
For better logging, perhaps you want two BuiltPackageArtifacts? One for the binary file, and another where relpath= the directory?wide-midnight-78598
01/13/2022, 6:05 PMhundreds-father-404
01/13/2022, 6:08 PMpackages = await MultiGet(
Get(BuiltPackage, PackageFieldSet, field_set)
for field_set in target_roots_to_field_sets.field_sets
)
merged_snapshot = await Get(Snapshot, MergeDigests(pkg.digest for pkg in packages))
workspace.write_digest(merged_snapshot.digest, path_prefix=str(dist_dir.relpath))
for pkg in packages:
for artifact in pkg.artifacts:
msg = []
if artifact.relpath:
msg.append(f"Wrote {dist_dir.relpath / artifact.relpath}")
msg.extend(str(line) for line in artifact.extra_log_lines)
if msg:
<http://logger.info|logger.info>("\n".join(msg))
It's only those first few lines before the for loop that matter for writing things to disk. The for loop is purely for loggingwide-midnight-78598
01/13/2022, 6:11 PMwide-midnight-78598
01/13/2022, 6:12 PMhundreds-father-404
01/13/2022, 6:14 PMPexProcess to have output_dirs and/or output_files set appropriatelywide-midnight-78598
01/13/2022, 6:21 PMwide-midnight-78598
01/13/2022, 6:21 PMhundreds-father-404
01/13/2022, 6:25 PM