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

getdeps: introduce build --enable-tests option

Summary:
This controls whether tests are built or not.
They are not built by default.  When `--enable-tests` is turned on,
tests are enabled for the named project only, not all of the deps.
This results in a faster build, because eg: the number of tests in
folly is very large and consumers of folly don't want to spend so
much time waiting to build tests when really all they want to do
is build their own project.

Reviewed By: strager

Differential Revision: D15246336

fbshipit-source-id: 2e22fd60c983b059f71639602712087f2a188ec6
This commit is contained in:
Wez Furlong
2019-05-08 08:15:28 -07:00
committed by Facebook Github Bot
parent 52d9e00c99
commit 9ddb1f7603
4 changed files with 31 additions and 2 deletions

View File

@@ -222,6 +222,11 @@ class BuildCmd(SubCmd):
install_dirs = [] install_dirs = []
for m in projects: for m in projects:
ctx = dict(ctx)
if args.enable_tests and m.name == manifest.name:
ctx["test"] = "on"
else:
ctx["test"] = "off"
fetcher = m.create_fetcher(opts, ctx) fetcher = m.create_fetcher(opts, ctx)
if args.clean: if args.clean:
@@ -287,6 +292,15 @@ class BuildCmd(SubCmd):
"slow up-to-date-ness checks" "slow up-to-date-ness checks"
), ),
) )
parser.add_argument(
"--enable-tests",
action="store_true",
default=False,
help=(
"For the named project, build tests so that the test command "
"is able to execute tests"
),
)
@cmd("test", "test a given project") @cmd("test", "test a given project")
@@ -296,6 +310,7 @@ class TestCmd(SubCmd):
manifest = load_project(opts, args.project) manifest = load_project(opts, args.project)
ctx = context_from_host_tuple() ctx = context_from_host_tuple()
ctx["test"] = "on"
projects = manifests_in_dependency_order(opts, manifest, ctx) projects = manifests_in_dependency_order(opts, manifest, ctx)
manifests_by_name = {m.name: m for m in projects} manifests_by_name = {m.name: m for m in projects}

View File

@@ -24,6 +24,12 @@ zstd
[dependencies.any(os=windows, os=darwin)] [dependencies.any(os=windows, os=darwin)]
bison bison
[cmake.defines.test=on]
BUILD_TESTS=ON
[cmake.defines.test=off]
BUILD_TESTS=OFF
[shipit.pathmap] [shipit.pathmap]
fbcode/thrift/public_tld = . fbcode/thrift/public_tld = .
fbcode/thrift = thrift fbcode/thrift = thrift

View File

@@ -49,4 +49,9 @@ fbcode/folly = folly
[cmake.defines] [cmake.defines]
BUILD_SHARED_LIBS=OFF BUILD_SHARED_LIBS=OFF
[cmake.defines.test=on]
BUILD_TESTS=ON BUILD_TESTS=ON
[cmake.defines.test=off]
BUILD_TESTS=OFF

View File

@@ -11,9 +11,12 @@ repo_url = https://github.com/facebook/wangle.git
builder = cmake builder = cmake
subdir = wangle subdir = wangle
[cmake.defines] [cmake.defines.test=on]
BUILD_TESTS=ON BUILD_TESTS=ON
[cmake.defines.test=off]
BUILD_TESTS=OFF
[dependencies] [dependencies]
folly folly
googletest googletest