1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-07 07:02:53 +03:00

fbcode_builder: getdeps: add list-deps subcommand

Summary:
While the command isn't necessarily super useful
on its own, it does show that the plumbing for walking the
deps is functioning, and that is important when it comes
to building.

The output lists the projects in the order that they
would be built.

The `fetch` command has been augmented to add a `--recursive`
flag that uses the same mechanism to recursively fetch
the dependencies.

Reviewed By: simpkins

Differential Revision: D14691004

fbshipit-source-id: b00bf6ad4742f8bb0a70698f71a5fe03d6a1f453
This commit is contained in:
Wez Furlong
2019-05-03 15:52:39 -07:00
committed by Facebook Github Bot
parent 1c49eff9ca
commit d0c4fccca9
3 changed files with 144 additions and 6 deletions

View File

@@ -15,9 +15,9 @@ import subprocess
import sys
from getdeps.buildopts import setup_build_options
from getdeps.load import resolve_manifest_path
from getdeps.load import load_project, manifests_in_dependency_order
from getdeps.manifest import ManifestParser
from getdeps.platform import HostType
from getdeps.platform import HostType, context_from_host_tuple
from getdeps.subcmd import SubCmd, add_subcommands, cmd
@@ -57,13 +57,58 @@ class FetchCmd(SubCmd):
"file describing the project"
),
)
parser.add_argument(
"--recursive",
help="fetch the transitive deps also",
action="store_true",
default=False,
)
parser.add_argument(
"--host-type",
help=(
"When recursively fetching, fetch deps for "
"this host type rather than the current system"
),
)
def run(self, args):
opts = setup_build_options(args)
manifest_path = resolve_manifest_path(opts, args.project)
manifest = ManifestParser(manifest_path)
fetcher = manifest.create_fetcher(opts, ctx={})
fetcher.update()
manifest = load_project(opts, args.project)
ctx = context_from_host_tuple(args.host_type)
if args.recursive:
projects = manifests_in_dependency_order(opts, manifest, ctx)
else:
projects = [manifest]
for m in projects:
fetcher = m.create_fetcher(opts, ctx)
fetcher.update()
@cmd("list-deps", "lists the transitive deps for a given project")
class ListDepsCmd(SubCmd):
def run(self, args):
opts = setup_build_options(args)
manifest = load_project(opts, args.project)
ctx = context_from_host_tuple(args.host_type)
for m in manifests_in_dependency_order(opts, manifest, ctx):
print(m.name)
return 0
def setup_parser(self, parser):
parser.add_argument(
"--host-type",
help=(
"Produce the list for the specified host type, "
"rather than that of the current system"
),
)
parser.add_argument(
"project",
help=(
"name of the project or path to a manifest "
"file describing the project"
),
)
def build_argparser():