Commit c951878f authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

getdeps: automatically detect if a build appears to be Facebook-internal

Summary:
Automatically detect the `--facebook-internal` flag based on the current
repository project name.

Reviewed By: wez

Differential Revision: D18621358

fbshipit-source-id: f2b3018169b151811eec455863a8bfc17667d4d8
parent 352c2d8b
...@@ -729,7 +729,13 @@ def parse_args(): ...@@ -729,7 +729,13 @@ def parse_args():
"--facebook-internal", "--facebook-internal",
help="Setup the build context as an FB internal build", help="Setup the build context as an FB internal build",
action="store_true", action="store_true",
default=False, default=None,
)
add_common_arg(
"--no-facebook-internal",
help="Perform a non-FB internal build, even when in an fbsource repository",
action="store_false",
dest="facebook_internal",
) )
ap = argparse.ArgumentParser( ap = argparse.ArgumentParser(
......
...@@ -154,7 +154,7 @@ class BuildOptions(object): ...@@ -154,7 +154,7 @@ class BuildOptions(object):
def is_linux(self): def is_linux(self):
return self.host_type.is_linux() return self.host_type.is_linux()
def get_context_generator(self, host_tuple=None, facebook_internal=False): def get_context_generator(self, host_tuple=None, facebook_internal=None):
""" Create a manifest ContextGenerator for the specified target platform. """ """ Create a manifest ContextGenerator for the specified target platform. """
if host_tuple is None: if host_tuple is None:
host_type = self.host_type host_type = self.host_type
...@@ -163,6 +163,12 @@ class BuildOptions(object): ...@@ -163,6 +163,12 @@ class BuildOptions(object):
else: else:
host_type = HostType.from_tuple_string(host_tuple) host_type = HostType.from_tuple_string(host_tuple)
# facebook_internal is an Optional[bool]
# If it is None, default to assuming this is a Facebook-internal build if
# we are running in an fbsource repository.
if facebook_internal is None:
facebook_internal = self.fbsource_dir is not None
return ContextGenerator( return ContextGenerator(
{ {
"os": host_type.ostype, "os": host_type.ostype,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment