mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-02 17:28:50 +02:00
Bug 1916793 - Add suggestion to add platform-tools dir to PATH r=firefox-build-system-reviewers,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D250499
This commit is contained in:
parent
b6fc1b6a64
commit
53fd00cce6
1 changed files with 37 additions and 1 deletions
|
|
@ -97,6 +97,16 @@ ac_add_options --enable-artifact-builds
|
||||||
mk_add_options MOZ_OBJDIR=./objdir-frontend
|
mk_add_options MOZ_OBJDIR=./objdir-frontend
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
SUGGEST_ADD_PLATFORM_TOOLS_PATH = """
|
||||||
|
If you plan to use adb or other platform tools directly on the command line, it may
|
||||||
|
be useful to add them to your PATH. Edit your shell initialization script to prepend
|
||||||
|
{platform_tools} to your PATH. For example:
|
||||||
|
|
||||||
|
export PATH="{platform_tools}:$PATH"
|
||||||
|
|
||||||
|
Then restart your shell.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class GetNdkVersionError(Exception):
|
class GetNdkVersionError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
@ -611,7 +621,8 @@ def ensure_android_packages(
|
||||||
if not packages:
|
if not packages:
|
||||||
packages = get_android_packages(AndroidPackageList.ALL)
|
packages = get_android_packages(AndroidPackageList.ALL)
|
||||||
|
|
||||||
sdkmanager_tool = get_sdkmanager_tool_path(sdk_path=get_sdk_path(os_name))
|
sdk_path = get_sdk_path(os_name)
|
||||||
|
sdkmanager_tool = get_sdkmanager_tool_path(sdk_path=sdk_path)
|
||||||
|
|
||||||
if avd_manifest is not None:
|
if avd_manifest is not None:
|
||||||
packages.add(avd_manifest["emulator_package"])
|
packages.add(avd_manifest["emulator_package"])
|
||||||
|
|
@ -634,6 +645,7 @@ def ensure_android_packages(
|
||||||
|
|
||||||
if not no_interactive:
|
if not no_interactive:
|
||||||
subprocess.check_call(args, env=env)
|
subprocess.check_call(args, env=env)
|
||||||
|
suggest_platform_tools_path(packages, sdk_path)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Flush outputs before running sdkmanager.
|
# Flush outputs before running sdkmanager.
|
||||||
|
|
@ -653,6 +665,30 @@ def ensure_android_packages(
|
||||||
if list_packages:
|
if list_packages:
|
||||||
subprocess.check_call([str(sdkmanager_tool), "--list"])
|
subprocess.check_call([str(sdkmanager_tool), "--list"])
|
||||||
|
|
||||||
|
suggest_platform_tools_path(packages, sdk_path)
|
||||||
|
|
||||||
|
|
||||||
|
def suggest_platform_tools_path(packages: set, sdk_path: Path):
|
||||||
|
if "platform-tools" in packages:
|
||||||
|
platform_tools_dir = (sdk_path / "platform-tools").resolve()
|
||||||
|
path_entries = os.environ.get("PATH", "").split(os.pathsep)
|
||||||
|
normalized_entries = {
|
||||||
|
os.path.normpath(
|
||||||
|
os.path.normcase(os.path.expanduser(os.path.expandvars(p)))
|
||||||
|
)
|
||||||
|
for p in path_entries
|
||||||
|
}
|
||||||
|
normalized_platform_tools_dir = os.path.normpath(
|
||||||
|
os.path.normcase(platform_tools_dir)
|
||||||
|
)
|
||||||
|
|
||||||
|
if normalized_platform_tools_dir not in normalized_entries:
|
||||||
|
print(
|
||||||
|
SUGGEST_ADD_PLATFORM_TOOLS_PATH.format(
|
||||||
|
platform_tools=normalized_platform_tools_dir
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def generate_mozconfig(os_name: str, artifact_mode=False):
|
def generate_mozconfig(os_name: str, artifact_mode=False):
|
||||||
extra_lines = []
|
extra_lines = []
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue