Skip to content

Commit

Permalink
Add intrinsic to download a file
Browse files Browse the repository at this point in the history
  • Loading branch information
illicitonion committed Oct 19, 2018
1 parent 6ecb9e7 commit d5c9e01
Show file tree
Hide file tree
Showing 11 changed files with 693 additions and 119 deletions.
5 changes: 5 additions & 0 deletions src/python/pants/engine/fs.py
Expand Up @@ -125,6 +125,11 @@ class DirectoryToMaterialize(datatype([('path', text_type), ('directory_digest',
"""A request to materialize the contents of a directory digest at the provided path."""
pass


class UrlToFetch(datatype([('url', text_type)])):
pass


FilesContent = Collection.of(FileContent)


Expand Down
5 changes: 4 additions & 1 deletion src/python/pants/engine/native.py
Expand Up @@ -197,6 +197,7 @@
TypeConstraint,
TypeConstraint,
TypeConstraint,
TypeConstraint,
TypeId,
TypeId,
Buffer,
Expand Down Expand Up @@ -821,7 +822,8 @@ def new_scheduler(self,
constraint_link,
constraint_process_request,
constraint_process_result,
constraint_generator):
constraint_generator,
constraint_url_to_fetch):
"""Create and return an ExternContext and native Scheduler."""

def func(constraint):
Expand Down Expand Up @@ -854,6 +856,7 @@ def tc(constraint):
tc(constraint_process_request),
tc(constraint_process_result),
tc(constraint_generator),
tc(constraint_url_to_fetch),
# Types.
TypeId(self.context.to_id(text_type)),
TypeId(self.context.to_id(binary_type)),
Expand Down
4 changes: 3 additions & 1 deletion src/python/pants/engine/scheduler.py
Expand Up @@ -15,7 +15,8 @@
from pants.base.project_tree import Dir, File, Link
from pants.build_graph.address import Address
from pants.engine.fs import (DirectoryDigest, DirectoryToMaterialize, FileContent, FilesContent,
MergedDirectories, Path, PathGlobs, PathGlobsAndRoot, Snapshot)
MergedDirectories, Path, PathGlobs, PathGlobsAndRoot, Snapshot,
UrlToFetch)
from pants.engine.isolated_process import ExecuteProcessRequest, FallibleExecuteProcessResult
from pants.engine.native import Function, TypeConstraint, TypeId
from pants.engine.nodes import Return, State, Throw
Expand Down Expand Up @@ -141,6 +142,7 @@ def __init__(
constraint_process_request=constraint_for(ExecuteProcessRequest),
constraint_process_result=constraint_for(FallibleExecuteProcessResult),
constraint_generator=constraint_for(GeneratorType),
constraint_url_to_fetch=constraint_for(UrlToFetch),
)

# If configured, visualize the rule graph before asserting that it is valid.
Expand Down

0 comments on commit d5c9e01

Please sign in to comment.