Bug 1477487 - Part 2: Make |mach bootstrap| for Android recommend toolchain clang and lld. r=agi,froydnj,#firefox-build-system-reviewers

We're seeing all sorts of problems with the NDK toolchain compilers
and the various versions of the NDK.  In automation we build with r17b
and our own toolchain clang; let's try to standardize on that.

This patch is ugly because of the evolution of mozboot.  Long ago, we
passed arguments around and interpolated strings into function names
rather than setting members with the application name and whether
we're in artifact mode.  The places I needed to modify didn't have the
right data at the right time so I added it to the bootstrap instance.
I don't have the time or energy to use the instance variables
through-out: that'll have to be future follow-up.

Differential Revision: https://phabricator.services.mozilla.com/D16138

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nick Alexander 2019-01-17 21:30:49 +00:00
Родитель 57c01fa819
Коммит aa8a7a854c
4 изменённых файлов: 26 добавлений и 4 удалений

Просмотреть файл

@ -49,12 +49,25 @@ $topsrcdir/mozconfig file, or create the file if it does not exist:
>>>
# Build GeckoView/Firefox for Android:
ac_add_options --enable-application=mobile/android
# Targeting the following architecture. Ensure exactly one --target is uncommented!
# For regular phones:
ac_add_options --target=arm-linux-androideabi
# For newer phones.
# ac_add_options --target=aarch64-linux-android
# For x86 emulators (and x86 devices, which are uncommon):
# ac_add_options --target=i686-linux-android
# For x86_64 emulators (and x86_64 devices, which are even less common):
# ac_add_options --target=x86_64-linux-android
{extra_lines}
# With the following Android SDK and NDK:
ac_add_options --with-android-sdk="{sdk_path}"
ac_add_options --with-android-ndk="{ndk_path}"
# With the following compiler toolchain:
CC="{moz_state_dir}/clang/bin/clang"
CXX="{moz_state_dir}/clang/bin/clang++"
<<<
'''
@ -291,7 +304,7 @@ def ensure_android_packages(sdkmanager_tool, packages=None, no_interactive=False
def suggest_mozconfig(os_name, artifact_mode=False, java_bin_path=None):
_mozbuild_path, sdk_path, ndk_path = get_paths(os_name)
moz_state_dir, sdk_path, ndk_path = get_paths(os_name)
extra_lines = []
if java_bin_path:
@ -310,6 +323,7 @@ def suggest_mozconfig(os_name, artifact_mode=False, java_bin_path=None):
kwargs = dict(
sdk_path=sdk_path,
ndk_path=ndk_path,
moz_state_dir=moz_state_dir,
extra_lines='\n'.join(extra_lines),
)
print(template.format(**kwargs))

Просмотреть файл

@ -380,9 +380,10 @@ class Bootstrapper(object):
sys.exit(1)
self.instance.state_dir = state_dir
self.instance.ensure_stylo_packages(state_dir, checkout_root)
self.instance.ensure_node_packages(state_dir, checkout_root)
self.instance.ensure_clang_static_analysis_package(checkout_root)
if not self.instance.artifact_mode:
self.instance.ensure_stylo_packages(state_dir, checkout_root)
self.instance.ensure_clang_static_analysis_package(checkout_root)
def check_telemetry_opt_in(self, state_dir):
# We can't prompt the user.
@ -411,6 +412,9 @@ class Bootstrapper(object):
else:
name, application = APPLICATIONS[self.choice]
self.instance.application = application
self.instance.artifact_mode = 'artifact_mode' in application
if self.instance.no_system_changes:
state_dir_available, state_dir = self.try_to_create_state_dir()
# We need to enable the loading of hgrc in case extensions are

Просмотреть файл

@ -521,7 +521,10 @@ class OSXBootstrapper(BaseBootstrapper):
def ensure_stylo_packages(self, state_dir, checkout_root):
from mozboot import stylo
# We installed clang via homebrew earlier.
# We installed clang via homebrew earlier. However, on Android, we're
# seeing many compiler errors so we use our own toolchain clang.
if 'mobile_android' in self.application:
self.install_toolchain_artifact(state_dir, checkout_root, stylo.MACOS_CLANG)
self.install_toolchain_artifact(state_dir, checkout_root, stylo.MACOS_CBINDGEN)
def ensure_node_packages(self, state_dir, checkout_root):

Просмотреть файл

@ -8,4 +8,5 @@ WINDOWS_CLANG = 'win64-clang-cl'
WINDOWS_CBINDGEN = 'win64-cbindgen'
LINUX_CLANG = 'linux64-clang'
LINUX_CBINDGEN = 'linux64-cbindgen'
MACOS_CLANG = 'macosx64-clang'
MACOS_CBINDGEN = 'macosx64-cbindgen'