DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (52f3d1a5b791)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

project_flag('MOZ_ANDROID_EXCLUDE_FONTS',
             help='Whether to exclude font files from the build',
             default=True)

option('--without-google-play-services',
       help='Disable features that depend on non-free Google Play Services')

@depends('--with-google-play-services')
def google_play_services(value):
    return bool(value)

set_config('MOZ_ANDROID_GOOGLE_PLAY_SERVICES', depends_if(google_play_services)(lambda _: True))

option(env='MOZ_ANDROID_GCM',
       help='Enable GCM (Google Cloud Messaging) registration',
       default=google_play_services)

set_config('MOZ_ANDROID_GCM',
           depends_if('MOZ_ANDROID_GCM')(lambda _: True))
add_old_configure_assignment('MOZ_ANDROID_GCM',
                             depends_if('MOZ_ANDROID_GCM')(lambda _: True))

option(env='MOZ_NATIVE_DEVICES',
       help='Enable second screen support using native Android libraries.',
       default=google_play_services)

set_config('MOZ_NATIVE_DEVICES',
           depends_if('MOZ_NATIVE_DEVICES')(lambda _: True))
add_old_configure_assignment('MOZ_NATIVE_DEVICES',
                             depends_if('MOZ_NATIVE_DEVICES')(lambda _: True))

# Enable install tracking SDK if we have Google Play support.
@depends(milestone, google_play_services)
def install_tracking_default(milestone, google_play_services):
    return bool(milestone.is_release_or_beta and google_play_services)

option(env='MOZ_INSTALL_TRACKING',
       help='Enable install tracking (currently using the Adjust SDK).',
       default=install_tracking_default)

set_config('MOZ_INSTALL_TRACKING',
           depends_if('MOZ_INSTALL_TRACKING')(lambda _: True))
add_old_configure_assignment('MOZ_INSTALL_TRACKING',
                             depends_if('MOZ_INSTALL_TRACKING')(lambda _: True))

option(env='MOZ_ANDROID_MMA',
       help='Enable mobile marketing automation (currently using the Leanplum SDK).',
       default=False)

set_config('MOZ_ANDROID_MMA',
           depends_if('MOZ_ANDROID_MMA')(lambda _: True))

option(env='MOZ_ANDROID_POCKET',
       help='Enable Pocket Stories in Activity Stream.',
       default=False)

set_config('MOZ_ANDROID_POCKET',
           depends_if('MOZ_ANDROID_POCKET')(lambda _: True))

project_flag('MOZ_ANDROID_DOWNLOADS_INTEGRATION',
             help='Enable system download manager on Android',
             default=True)

project_flag('MOZ_ANDROID_BEAM',
             help='Enable NFC permission on Android',
             default=True)

project_flag('MOZ_ANDROID_MLS_STUMBLER',
             help='Include Mozilla Location Service Stumbler on Android',
             default=True)

project_flag('MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE',
             help='Background service for downloading additional content at runtime',
             default=True)

project_flag('MOZ_ANDROID_PWA',
             help='Enable support for Progressive Web Apps',
             default=milestone.is_nightly)

# Enable the Switchboard A/B framework code.
# Note: The framework is always included in the app. This flag controls
# usage of the framework.
project_flag('MOZ_SWITCHBOARD',
             help='Include Switchboard A/B framework on Android',
             default=True)

project_flag('MOZ_ANDROID_HLS_SUPPORT',
             help='Enable HLS (HTTP Live Streaming) support (currently using the ExoPlayer library)',
             default=True)

option(env='MOZ_ANDROID_ACTIVITY_STREAM',
       help='Enable Activity Stream on Android (replacing the default HomePager)',
       default=False)

set_config('MOZ_ANDROID_ACTIVITY_STREAM',
           depends_if('MOZ_ANDROID_ACTIVITY_STREAM')(lambda _: True))

option(env='MOZ_ANDROID_MOZILLA_ONLINE',
       help='Enable MozillaOnline (Mozilla China) specific Android code',
       default=False)

set_config('MOZ_ANDROID_MOZILLA_ONLINE',
           depends_if('MOZ_ANDROID_MOZILLA_ONLINE')(lambda _: True))

option(env='FENNEC_NIGHTLY',
       help='Enable experimental code for Fennec Nightly users. NOTE: This is *not* equivalent '
            'to the NIGHTLY_BUILD flag set during configure.',
       default=False)

set_config('FENNEC_NIGHTLY', depends_if('FENNEC_NIGHTLY')(lambda _: True))
set_define('FENNEC_NIGHTLY', depends_if('FENNEC_NIGHTLY')(lambda _: True))


@depends('FENNEC_NIGHTLY')
def fennec_nightly(nightly):
    return bool(nightly)


imply_option('MOZ_SERVICES_HEALTHREPORT', True)
imply_option('MOZ_ANDROID_HISTORY', True)
imply_option('--enable-small-chunk-size', True)

@depends(target)
def check_target(target):
    if target.os != 'Android':
        log.error('You must specify --target=arm-linux-androideabi (or some '
                  'other valid Android target) when building mobile/android.')
        die('See https://developer.mozilla.org/docs/Mozilla/Developer_guide/'
            'Build_Instructions/Simple_Firefox_for_Android_build '
            'for more information about the necessary options.')

include('../../toolkit/moz.configure')
include('../../build/moz.configure/android-sdk.configure')
include('../../build/moz.configure/java.configure')
include('gradle.configure')

# Must come after the ../../toolkit/moz.configure.
@depends('MOZ_INSTALL_TRACKING', google_play_services, '--with-adjust-sdk-keyfile')
def check_install_tracking(install_tracking,
                           google_play_services,
                           adjust_sdk_keyfile):
    if install_tracking:
        if not google_play_services:
            die('You must specify --with-google-play-services when'
                ' building with MOZ_INSTALL_TRACKING=1')
        if not adjust_sdk_keyfile:
            die('You must specify --with-adjust-sdk-keyfile=/path/to/keyfile when'
                ' building with MOZ_INSTALL_TRACKING=1')

# Must come after the ../../toolkit/moz.configure.
@depends('MOZ_ANDROID_MMA',
         google_play_services,
         'MOZ_ANDROID_GCM',
         '--with-leanplum-sdk-keyfile')
def check_android_mma(android_mma,
                      google_play_services,
                      android_gcm,
                      leanplum_sdk_keyfile):
    if android_mma:
        if not google_play_services:
            die('You must specify --with-google-play-services when'
                ' building with MOZ_ANDROID_MMA=1')
        if not android_gcm:
            die('You must specify MOZ_ANDROID_GCM=1 when'
                ' building with MOZ_ANDROID_MMA=1')
        if not leanplum_sdk_keyfile:
            die('You must specify --with-leanplum-sdk-keyfile=/path/to/keyfile when'
                ' building with MOZ_ANDROID_MMA=1')

@depends('MOZ_ANDROID_POCKET',
         '--with-pocket-api-keyfile')
def check_android_pocket(android_pocket, pocket_api_keyfile):
    if android_pocket and not pocket_api_keyfile:
        die('You must specify --with-pocket-api-keyfile=/path/to/keyfile when'
            ' building with MOZ_ANDROID_POCKET=1')

# Must come after the ../../toolkit/moz.configure.
@depends('MOZ_ANDROID_GCM', google_play_services)
def check_android_gcm(android_gcm,
                      google_play_services):
    if android_gcm:
        if not google_play_services:
            die('You must specify --with-google-play-services when'
                ' building with MOZ_ANDROID_GCM=1')

# Automation will set this via the TC environment.
option(env='MOZ_ANDROID_FAT_AAR_ARCHITECTURES',
       nargs='*', choices=('armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'),
       help='Comma-separated list of Android CPU architectures like "armeabi-v7a,arm64-v8a,x86,x86_64"')

set_config('MOZ_ANDROID_FAT_AAR_ARCHITECTURES', depends('MOZ_ANDROID_FAT_AAR_ARCHITECTURES')(lambda x: x))