--- a/mobile/android/base/generate_build_config.py
+++ b/mobile/android/base/generate_build_config.py
@@ -87,17 +87,18 @@ def _defines():
'MOZ_MOZILLA_API_KEY',
'MOZ_UPDATE_CHANNEL',
'OMNIJAR_NAME',
'OS_TARGET',
'TARGET_XPCOM_ABI'):
DEFINES[var] = CONFIG[var]
# Mangle our package name to avoid Bug 750548.
- DEFINES['MANGLED_ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME'].replace('fennec', 'f3nn3c')
+ DEFINES['MANGLED_ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME'].replace(
+ 'fennec', 'f3nn3c')
DEFINES['MOZ_APP_ABI'] = CONFIG['TARGET_XPCOM_ABI']
if not CONFIG['COMPILE_ENVIRONMENT']:
# These should really come from the included binaries, but that's not easy.
DEFINES['MOZ_APP_ABI'] = 'arm-eabi-gcc3'
DEFINES['TARGET_XPCOM_ABI'] = 'arm-eabi-gcc3'
# It's okay to use MOZ_ADJUST_SDK_KEY here because this doesn't
# leak the value to build logs.
@@ -106,17 +107,18 @@ def _defines():
if CONFIG['MOZ_ANDROID_MMA']:
DEFINES['MOZ_LEANPLUM_SDK_KEY'] = CONFIG['MOZ_LEANPLUM_SDK_KEY']
DEFINES['MOZ_LEANPLUM_SDK_CLIENTID'] = CONFIG['MOZ_LEANPLUM_SDK_CLIENTID']
if CONFIG['MOZ_ANDROID_POCKET']:
DEFINES['MOZ_POCKET_API_KEY'] = CONFIG['MOZ_POCKET_API_KEY']
- DEFINES['MOZ_BUILDID'] = open(os.path.join(buildconfig.topobjdir, 'buildid.h')).readline().split()[2]
+ DEFINES['MOZ_BUILDID'] = open(os.path.join(
+ buildconfig.topobjdir, 'buildid.h')).readline().split()[2]
# Set the appropriate version code if not set by MOZ_APP_ANDROID_VERSION_CODE.
if CONFIG.get('MOZ_APP_ANDROID_VERSION_CODE'):
DEFINES['ANDROID_VERSION_CODE'] = \
CONFIG.get('MOZ_APP_ANDROID_VERSION_CODE')
else:
min_sdk = int(CONFIG.get('MOZ_ANDROID_MIN_SDK_VERSION') or '0') or None
max_sdk = int(CONFIG.get('MOZ_ANDROID_MAX_SDK_VERSION') or '0') or None
@@ -126,19 +128,19 @@ def _defines():
min_sdk=min_sdk,
max_sdk=max_sdk)
return DEFINES
def generate_java(output_file, input_filename):
includes = preprocessor.preprocess(includes=[input_filename],
- defines=_defines(),
- output=output_file,
- marker='//#')
+ defines=_defines(),
+ output=output_file,
+ marker='//#')
includes.add(os.path.join(buildconfig.topobjdir, 'buildid.h'))
return includes
def generate_android_manifest(output_file, input_filename):
includes = preprocessor.preprocess(includes=[input_filename],
defines=_defines(),
output=output_file,
--- a/mobile/android/debug_sign_tool.py
+++ b/mobile/android/debug_sign_tool.py
@@ -29,16 +29,17 @@ sh = logging.StreamHandler(stream=sys.st
sh.setFormatter(logging.Formatter('%(name)s: %(message)s'))
log.addHandler(sh)
class DebugKeystore:
"""
A thin abstraction on top of an Android debug key store.
"""
+
def __init__(self, keystore):
self._keystore = os.path.abspath(os.path.expanduser(keystore))
self._alias = 'androiddebugkey'
self.verbose = False
self.keytool = 'keytool'
self.jarsigner = 'jarsigner'
@property
@@ -56,22 +57,22 @@ class DebugKeystore:
else:
subprocess.check_output(args)
except OSError as ex:
if ex.errno != errno.ENOENT:
raise
raise Exception("Could not find executable '%s'" % args[0])
def keystore_contains_alias(self):
- args = [ self.keytool,
- '-list',
- '-keystore', self.keystore,
- '-storepass', 'android',
- '-alias', self.alias,
- ]
+ args = [self.keytool,
+ '-list',
+ '-keystore', self.keystore,
+ '-storepass', 'android',
+ '-alias', self.alias,
+ ]
if self.verbose:
args.append('-v')
contains = True
try:
self._check(args)
except subprocess.CalledProcessError as e:
contains = False
if self.verbose:
@@ -84,45 +85,45 @@ class DebugKeystore:
def create_alias_in_keystore(self):
try:
path = os.path.dirname(self.keystore)
os.makedirs(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
- args = [ self.keytool,
- '-genkeypair',
- '-keystore', self.keystore,
- '-storepass', 'android',
- '-alias', self.alias,
- '-keypass', 'android',
- '-dname', 'CN=Android Debug,O=Android,C=US',
- '-keyalg', 'RSA',
- '-validity', '365',
- ]
+ args = [self.keytool,
+ '-genkeypair',
+ '-keystore', self.keystore,
+ '-storepass', 'android',
+ '-alias', self.alias,
+ '-keypass', 'android',
+ '-dname', 'CN=Android Debug,O=Android,C=US',
+ '-keyalg', 'RSA',
+ '-validity', '365',
+ ]
if self.verbose:
args.append('-v')
self._check(args)
if self.verbose:
log.info('Created alias %s in keystore %s' %
(self.alias, self.keystore))
def sign(self, apk):
if not self.keystore_contains_alias():
self.create_alias_in_keystore()
- args = [ self.jarsigner,
- '-digestalg', 'SHA1',
- '-sigalg', 'MD5withRSA',
- '-keystore', self.keystore,
- '-storepass', 'android',
- apk,
- self.alias,
- ]
+ args = [self.jarsigner,
+ '-digestalg', 'SHA1',
+ '-sigalg', 'MD5withRSA',
+ '-keystore', self.keystore,
+ '-storepass', 'android',
+ apk,
+ self.alias,
+ ]
if self.verbose:
args.append('-verbose')
self._check(args)
if self.verbose:
log.info('Signed %s with alias %s from keystore %s' %
(apk, self.alias, self.keystore))
@@ -178,10 +179,11 @@ def main():
keystore.sign(apk)
except subprocess.CalledProcessError as e:
log.error('Failed to sign %s', apk)
log.error(e)
return 1
return 0
+
if __name__ == '__main__':
sys.exit(main())
--- a/mobile/android/docs/conf.py
+++ b/mobile/android/docs/conf.py
@@ -177,24 +177,24 @@ html_static_path = ['_static']
# Output file base name for HTML help builder.
htmlhelp_basename = 'FirefoxforAndroiddoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
-# The paper size ('letterpaper' or 'a4paper').
-#'papersize': 'letterpaper',
+ # The paper size ('letterpaper' or 'a4paper').
+ # 'papersize': 'letterpaper',
-# The font size ('10pt', '11pt' or '12pt').
-#'pointsize': '10pt',
+ # The font size ('10pt', '11pt' or '12pt').
+ # 'pointsize': '10pt',
-# Additional stuff for the LaTeX preamble.
-#'preamble': '',
+ # Additional stuff for the LaTeX preamble.
+ # 'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'FirefoxforAndroid.tex', u'Firefox for Android Documentation',
u'mobile team', 'manual'),
--- a/mobile/android/locales/filter.py
+++ b/mobile/android/locales/filter.py
@@ -2,73 +2,74 @@
# 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/.
"""This routine controls which localizable files and entries are
reported and l10n-merged.
This needs to stay in sync with the copy in mobile/locales.
"""
-def test(mod, path, entity = None):
- import re
- # ignore anything but mobile, which is our local repo checkout name
- if mod not in ("dom", "toolkit", "mobile",
- "mobile/android/base", "mobile/android"):
- return "ignore"
+
+def test(mod, path, entity=None):
+ import re
+ # ignore anything but mobile, which is our local repo checkout name
+ if mod not in ("dom", "toolkit", "mobile",
+ "mobile/android/base", "mobile/android"):
+ return "ignore"
- if mod == "toolkit":
- # keep this file list in sync with jar.mn
- if path in (
- "chrome/global/aboutAbout.dtd",
- "chrome/global/aboutReader.properties",
- "chrome/global/aboutRights.dtd",
- "chrome/global/charsetMenu.properties",
- "chrome/global/commonDialogs.properties",
- "chrome/global/intl.properties",
- "chrome/global/intl.css",
- "chrome/search/search.properties",
- "chrome/pluginproblem/pluginproblem.dtd",
- "chrome/global/aboutSupport.dtd",
- "chrome/global/aboutSupport.properties",
- "crashreporter/crashes.dtd",
- "crashreporter/crashes.properties",
- "chrome/global/mozilla.dtd",
- "chrome/global/aboutTelemetry.dtd",
- "chrome/global/aboutTelemetry.properties",
- "chrome/global/aboutWebrtc.properties"):
- return "error"
- return "ignore"
+ if mod == "toolkit":
+ # keep this file list in sync with jar.mn
+ if path in (
+ "chrome/global/aboutAbout.dtd",
+ "chrome/global/aboutReader.properties",
+ "chrome/global/aboutRights.dtd",
+ "chrome/global/charsetMenu.properties",
+ "chrome/global/commonDialogs.properties",
+ "chrome/global/intl.properties",
+ "chrome/global/intl.css",
+ "chrome/search/search.properties",
+ "chrome/pluginproblem/pluginproblem.dtd",
+ "chrome/global/aboutSupport.dtd",
+ "chrome/global/aboutSupport.properties",
+ "crashreporter/crashes.dtd",
+ "crashreporter/crashes.properties",
+ "chrome/global/mozilla.dtd",
+ "chrome/global/aboutTelemetry.dtd",
+ "chrome/global/aboutTelemetry.properties",
+ "chrome/global/aboutWebrtc.properties"):
+ return "error"
+ return "ignore"
- if mod == "dom":
- # keep this file list in sync with jar.mn
- if path in (
- "chrome/global.dtd",
- "chrome/accessibility/AccessFu.properties",
- "chrome/dom/dom.properties",
- "chrome/plugins.properties"):
- return "error"
- return "ignore"
-
- if mod not in ("mobile", "mobile/android"):
- # we only have exceptions for mobile*
- return "error"
- if mod == "mobile/android":
- if entity is None:
- if (re.match(r"mobile-l10n.js", path) or
- re.match(r"defines.inc", path)):
+ if mod == "dom":
+ # keep this file list in sync with jar.mn
+ if path in (
+ "chrome/global.dtd",
+ "chrome/accessibility/AccessFu.properties",
+ "chrome/dom/dom.properties",
+ "chrome/plugins.properties"):
+ return "error"
return "ignore"
- if path == "defines.inc":
- if entity == "MOZ_LANGPACK_CONTRIBUTORS":
- return "ignore"
- return "error"
- # we're in mod == "mobile"
- if path == "chrome/region.properties":
- # only region.properties exceptions remain
- if (re.match(r"browser\.search\.order\.[1-9]", entity) or
- re.match(r"browser\.search\.[a-zA-Z]+\.US", entity) or
- re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
- re.match(r"gecko\.handlerService\.schemes\.", entity) or
- re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity) or
- re.match(r"browser\.suggestedsites\.", entity)):
- return "ignore"
+ if mod not in ("mobile", "mobile/android"):
+ # we only have exceptions for mobile*
+ return "error"
+ if mod == "mobile/android":
+ if entity is None:
+ if (re.match(r"mobile-l10n.js", path) or
+ re.match(r"defines.inc", path)):
+ return "ignore"
+ if path == "defines.inc":
+ if entity == "MOZ_LANGPACK_CONTRIBUTORS":
+ return "ignore"
+ return "error"
- return "error"
+ # we're in mod == "mobile"
+ if path == "chrome/region.properties":
+ # only region.properties exceptions remain
+ if (re.match(r"browser\.search\.order\.[1-9]", entity) or
+ re.match(r"browser\.search\.[a-zA-Z]+\.US", entity) or
+ re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
+ re.match(r"gecko\.handlerService\.schemes\.", entity) or
+ re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity) or
+ re.match(r"browser\.suggestedsites\.", entity)):
+ return "ignore"
+
+ return "error"
--- a/mobile/android/mach_commands.py
+++ b/mobile/android/mach_commands.py
@@ -41,76 +41,76 @@ def REMOVED(cls):
@CommandProvider
class MachCommands(MachCommandBase):
def _root_url(self, artifactdir=None, objdir=None):
if 'TASK_ID' in os.environ and 'RUN_ID' in os.environ:
return 'https://queue.taskcluster.net/v1/task/{}/runs/{}/artifacts/{}'.format(os.environ['TASK_ID'], os.environ['RUN_ID'], artifactdir)
else:
return os.path.join(self.topobjdir, objdir)
-
@Command('android', category='devenv',
- description='Run Android-specific commands.',
- conditions=[conditions.is_android])
+ description='Run Android-specific commands.',
+ conditions=[conditions.is_android])
def android(self):
pass
@SubCommand('android', 'assemble-app',
- """Assemble Firefox for Android.
+ """Assemble Firefox for Android.
See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")
@CommandArgument('args', nargs=argparse.REMAINDER)
def android_assemble_app(self, args):
- ret = self.gradle(self.substs['GRADLE_ANDROID_APP_TASKS'] + ['-x', 'lint', '--continue'] + args, verbose=True)
+ ret = self.gradle(self.substs['GRADLE_ANDROID_APP_TASKS'] +
+ ['-x', 'lint', '--continue'] + args, verbose=True)
return ret
-
@SubCommand('android', 'generate-sdk-bindings',
- """Generate SDK bindings used when building GeckoView.""")
+ """Generate SDK bindings used when building GeckoView.""")
@CommandArgument('inputs', nargs='+', help='config files, like [/path/to/ClassName-classes.txt]+')
@CommandArgument('args', nargs=argparse.REMAINDER)
def android_generate_sdk_bindings(self, inputs, args):
import itertools
def stem(input):
# Turn "/path/to/ClassName-classes.txt" into "ClassName".
return os.path.basename(input).rsplit('-classes.txt', 1)[0]
bindings_inputs = list(itertools.chain(*((input, stem(input)) for input in inputs)))
bindings_args = '-Pgenerate_sdk_bindings_args={}'.format(':'.join(bindings_inputs))
- ret = self.gradle(self.substs['GRADLE_ANDROID_GENERATE_SDK_BINDINGS_TASKS'] + [bindings_args] + args, verbose=True)
+ ret = self.gradle(
+ self.substs['GRADLE_ANDROID_GENERATE_SDK_BINDINGS_TASKS'] + [bindings_args] + args, verbose=True)
return ret
-
@SubCommand('android', 'generate-generated-jni-wrappers',
- """Generate GeckoView JNI wrappers used when building GeckoView.""")
+ """Generate GeckoView JNI wrappers used when building GeckoView.""")
@CommandArgument('args', nargs=argparse.REMAINDER)
def android_generate_generated_jni_wrappers(self, args):
- ret = self.gradle(self.substs['GRADLE_ANDROID_GENERATE_GENERATED_JNI_WRAPPERS_TASKS'] + args, verbose=True)
+ ret = self.gradle(
+ self.substs['GRADLE_ANDROID_GENERATE_GENERATED_JNI_WRAPPERS_TASKS'] + args, verbose=True)
return ret
-
@SubCommand('android', 'generate-fennec-jni-wrappers',
- """Generate Fennec-specific JNI wrappers used when building Firefox for Android.""")
+ """Generate Fennec-specific JNI wrappers used when building Firefox for Android.""")
@CommandArgument('args', nargs=argparse.REMAINDER)
def android_generate_fennec_jni_wrappers(self, args):
- ret = self.gradle(self.substs['GRADLE_ANDROID_GENERATE_FENNEC_JNI_WRAPPERS_TASKS'] + args, verbose=True)
+ ret = self.gradle(
+ self.substs['GRADLE_ANDROID_GENERATE_FENNEC_JNI_WRAPPERS_TASKS'] + args, verbose=True)
return ret
-
@SubCommand('android', 'test',
- """Run Android local unit tests.
+ """Run Android local unit tests.
See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-test""")
@CommandArgument('args', nargs=argparse.REMAINDER)
def android_test(self, args):
- ret = self.gradle(self.substs['GRADLE_ANDROID_TEST_TASKS'] + ["--continue"] + args, verbose=True)
+ ret = self.gradle(self.substs['GRADLE_ANDROID_TEST_TASKS'] +
+ ["--continue"] + args, verbose=True)
ret |= self._parse_android_test_results('public/app/unittest', 'gradle/build/mobile/android/app',
(self.substs['GRADLE_ANDROID_APP_VARIANT_NAME'],))
ret |= self._parse_android_test_results('public/geckoview/unittest', 'gradle/build/mobile/android/geckoview',
(self.substs['GRADLE_ANDROID_GECKOVIEW_VARIANT_NAME'],))
return ret
@@ -147,17 +147,18 @@ class MachCommands(MachCommandBase):
root = tree.getroot()
# Log reports for Tree Herder "Job Details".
print('TinderboxPrint: report<br/><a href="{}/{}/index.html">HTML {} report</a>, visit "Inspect Task" link for details'.format(root_url, report, report))
# And make the report display as soon as possible.
failed = root.findall('testcase/error') or root.findall('testcase/failure')
if failed:
- print('TEST-UNEXPECTED-FAIL | android-test | There were failing tests. See the reports at: {}/{}/index.html'.format(root_url, report))
+ print(
+ 'TEST-UNEXPECTED-FAIL | android-test | There were failing tests. See the reports at: {}/{}/index.html'.format(root_url, report))
print('SUITE-START | android-test | {} {}'.format(report, root.get('name')))
for testcase in root.findall('testcase'):
name = testcase.get('name')
print('TEST-START | {}'.format(name))
# Schema cribbed from
@@ -186,36 +187,37 @@ class MachCommands(MachCommandBase):
print('SUITE-END | android-test | {} {}'.format(report, root.get('name')))
if not found_reports:
print('TEST-UNEXPECTED-FAIL | android-test | No reports found under {}'.format(gradledir))
return 1
return ret
-
@SubCommand('android', 'lint',
- """Run Android lint.
+ """Run Android lint.
See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-lint""")
@CommandArgument('args', nargs=argparse.REMAINDER)
def android_lint(self, args):
- ret = self.gradle(self.substs['GRADLE_ANDROID_LINT_TASKS'] + ["--continue"] + args, verbose=True)
+ ret = self.gradle(self.substs['GRADLE_ANDROID_LINT_TASKS'] +
+ ["--continue"] + args, verbose=True)
# Android Lint produces both HTML and XML reports. Visit the
# XML report(s) to report errors and link to the HTML
# report(s) for human consumption.
import xml.etree.ElementTree as ET
root_url = self._root_url(
artifactdir='public/android/lint',
objdir='gradle/build/mobile/android/app/reports')
reports = (self.substs['GRADLE_ANDROID_APP_VARIANT_NAME'],)
for report in reports:
- f = open(os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/reports/lint-results-{}.xml'.format(report)), 'rt')
+ f = open(os.path.join(
+ self.topobjdir, 'gradle/build/mobile/android/app/reports/lint-results-{}.xml'.format(report)), 'rt')
tree = ET.parse(f)
root = tree.getroot()
# Log reports for Tree Herder "Job Details".
html_report_url = '{}/lint-results-{}.html'.format(root_url, report)
xml_report_url = '{}/lint-results-{}.xml'.format(root_url, report)
print('TinderboxPrint: report<br/><a href="{}">HTML {} report</a>, visit "Inspect Task" link for details'.format(html_report_url, report))
print('TinderboxPrint: report<br/><a href="{}">XML {} report</a>, visit "Inspect Task" link for details'.format(xml_report_url, report))
@@ -231,30 +233,31 @@ class MachCommands(MachCommandBase):
# tag.
for line in ET.tostring(issue).strip().splitlines():
print('TEST-UNEXPECTED-FAIL | {}'.format(line))
ret |= 1
print('SUITE-END | android-lint | {}'.format(report))
return ret
-
@SubCommand('android', 'checkstyle',
- """Run Android checkstyle.
+ """Run Android checkstyle.
See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-checkstyle""")
@CommandArgument('args', nargs=argparse.REMAINDER)
def android_checkstyle(self, args):
- ret = self.gradle(self.substs['GRADLE_ANDROID_CHECKSTYLE_TASKS'] + ["--continue"] + args, verbose=True)
+ ret = self.gradle(self.substs['GRADLE_ANDROID_CHECKSTYLE_TASKS'] +
+ ["--continue"] + args, verbose=True)
# Checkstyle produces both HTML and XML reports. Visit the
# XML report(s) to report errors and link to the HTML
# report(s) for human consumption.
import xml.etree.ElementTree as ET
- f = open(os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/reports/checkstyle/checkstyle.xml'), 'rt')
+ f = open(os.path.join(self.topobjdir,
+ 'gradle/build/mobile/android/app/reports/checkstyle/checkstyle.xml'), 'rt')
tree = ET.parse(f)
root = tree.getroot()
# Now the reports, linkified.
root_url = self._root_url(
artifactdir='public/android/checkstyle',
objdir='gradle/build/mobile/android/app/reports/checkstyle')
@@ -285,37 +288,38 @@ class MachCommands(MachCommandBase):
error_count += 1
if not error_count:
print('TEST-PASS | {}'.format(name))
print('SUITE-END | android-checkstyle')
return ret
-
@SubCommand('android', 'findbugs',
- """Run Android findbugs.
+ """Run Android findbugs.
See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-findbugs""")
@CommandArgument('args', nargs=argparse.REMAINDER)
def android_findbugs(self, dryrun=False, args=[]):
- ret = self.gradle(self.substs['GRADLE_ANDROID_FINDBUGS_TASKS'] + ["--continue"] + args, verbose=True)
+ ret = self.gradle(self.substs['GRADLE_ANDROID_FINDBUGS_TASKS'] +
+ ["--continue"] + args, verbose=True)
# Findbug produces both HTML and XML reports. Visit the
# XML report(s) to report errors and link to the HTML
# report(s) for human consumption.
import xml.etree.ElementTree as ET
root_url = self._root_url(
artifactdir='public/android/findbugs',
objdir='gradle/build/mobile/android/app/reports/findbugs')
reports = (self.substs['GRADLE_ANDROID_APP_VARIANT_NAME'],)
for report in reports:
try:
- f = open(os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/reports/findbugs', 'findbugs-{}-output.xml'.format(report)), 'rt')
+ f = open(os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/reports/findbugs',
+ 'findbugs-{}-output.xml'.format(report)), 'rt')
except IOError:
continue
tree = ET.parse(f)
root = tree.getroot()
# Log reports for Tree Herder "Job Details".
html_report_url = '{}/findbugs-{}-output.html'.format(root_url, report)
@@ -327,62 +331,63 @@ class MachCommands(MachCommandBase):
if root.findall("./BugInstance"):
print('TEST-UNEXPECTED-FAIL | android-findbugs | Findbugs found issues in the project. See the report at: {}'.format(html_report_url))
print('SUITE-START | android-findbugs | {}'.format(report))
for error in root.findall('./BugInstance'):
# There's no particular advantage to formatting the
# error, so for now let's just output the <error> XML
# tag.
- print('TEST-UNEXPECTED-FAIL | {}:{} | {}'.format(report, error.get('type'), error.find('Class').get('classname')))
+ print('TEST-UNEXPECTED-FAIL | {}:{} | {}'.format(report,
+ error.get('type'), error.find('Class').get('classname')))
for line in ET.tostring(error).strip().splitlines():
print('TEST-UNEXPECTED-FAIL | {}:{} | {}'.format(report, error.get('type'), line))
ret |= 1
print('SUITE-END | android-findbugs | {}'.format(report))
return ret
-
@SubCommand('android', 'gradle-dependencies',
- """Collect Android Gradle dependencies.
+ """Collect Android Gradle dependencies.
See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")
@CommandArgument('args', nargs=argparse.REMAINDER)
def android_gradle_dependencies(self, args):
# We don't want to gate producing dependency archives on clean
# lint or checkstyle, particularly because toolchain versions
# can change the outputs for those processes.
- self.gradle(self.substs['GRADLE_ANDROID_DEPENDENCIES_TASKS'] + ["--continue"] + args, verbose=True)
+ self.gradle(self.substs['GRADLE_ANDROID_DEPENDENCIES_TASKS'] +
+ ["--continue"] + args, verbose=True)
return 0
-
@SubCommand('android', 'archive-geckoview',
- """Create GeckoView archives.
+ """Create GeckoView archives.
See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")
@CommandArgument('args', nargs=argparse.REMAINDER)
def android_archive_geckoview(self, args):
- ret = self.gradle(self.substs['GRADLE_ANDROID_ARCHIVE_GECKOVIEW_TASKS'] + ["--continue"] + args, verbose=True)
+ ret = self.gradle(
+ self.substs['GRADLE_ANDROID_ARCHIVE_GECKOVIEW_TASKS'] + ["--continue"] + args, verbose=True)
return ret
@SubCommand('android', 'geckoview-docs',
- """Create GeckoView javadoc and optionally upload to Github""")
+ """Create GeckoView javadoc and optionally upload to Github""")
@CommandArgument('--archive', action='store_true',
- help='Generate a javadoc archive.')
+ help='Generate a javadoc archive.')
@CommandArgument('--upload', metavar='USER/REPO',
- help='Upload generated javadoc to Github, '
- 'using the specified USER/REPO.')
+ help='Upload generated javadoc to Github, '
+ 'using the specified USER/REPO.')
@CommandArgument('--upload-branch', metavar='BRANCH[/PATH]',
- default='gh-pages/javadoc',
- help='Use the specified branch/path for commits.')
+ default='gh-pages/javadoc',
+ help='Use the specified branch/path for commits.')
@CommandArgument('--upload-message', metavar='MSG',
- default='GeckoView docs upload',
- help='Use the specified message for commits.')
+ default='GeckoView docs upload',
+ help='Use the specified message for commits.')
@CommandArgument('--variant', default='debug',
- help='Gradle variant used to generate javadoc.')
+ help='Gradle variant used to generate javadoc.')
def android_geckoview_docs(self, archive, upload, upload_branch,
upload_message, variant):
def capitalize(s):
# Can't use str.capitalize because it lower cases trailing letters.
return (s[0].upper() + s[1:]) if s else ''
task = 'geckoview:javadoc' + ('Jar' if archive or upload else '') + capitalize(variant)
@@ -449,35 +454,34 @@ class MachCommands(MachCommandBase):
self.run_process(['git', 'push', 'origin', 'gh-pages'],
append_env=env, pass_thru=True)
mozfile.remove(repo_path)
if secret:
mozfile.remove(keyfile)
return 0
-
@Command('gradle', category='devenv',
- description='Run gradle.',
- conditions=[conditions.is_android])
+ description='Run gradle.',
+ conditions=[conditions.is_android])
@CommandArgument('-v', '--verbose', action='store_true',
- help='Verbose output for what commands the build is running.')
+ help='Verbose output for what commands the build is running.')
@CommandArgument('args', nargs=argparse.REMAINDER)
def gradle(self, args, verbose=False):
if not verbose:
# Avoid logging the command
self.log_manager.terminal_handler.setLevel(logging.CRITICAL)
# In automation, JAVA_HOME is set via mozconfig, which needs
# to be specially handled in each mach command. This turns
# $JAVA_HOME/bin/java into $JAVA_HOME.
java_home = os.path.dirname(os.path.dirname(self.substs['JAVA']))
gradle_flags = self.substs.get('GRADLE_FLAGS', '') or \
- os.environ.get('GRADLE_FLAGS', '')
+ os.environ.get('GRADLE_FLAGS', '')
gradle_flags = shell_split(gradle_flags)
# We force the Gradle JVM to run with the UTF-8 encoding, since we
# filter strings.xml, which is really UTF-8; the ellipsis character is
# replaced with ??? in some encodings (including ASCII). It's not yet
# possible to filter with encodings in Gradle
# (https://github.com/gradle/gradle/pull/520) and it's challenging to
# do our filtering with Gradle's Ant support. Moreover, all of the
@@ -489,54 +493,55 @@ class MachCommands(MachCommandBase):
# needs to be for JVMs spawned by Gradle as well. This
# happens during the maven deployment generating the GeckoView
# documents; this works around "error: unmappable character
# for encoding ASCII" in exoplayer2. See
# https://discuss.gradle.org/t/unmappable-character-for-encoding-ascii-when-building-a-utf-8-project/10692/11
# and especially https://stackoverflow.com/a/21755671.
return self.run_process([self.substs['GRADLE']] + gradle_flags + ['--console=plain'] + args,
- append_env={
+ append_env={
'GRADLE_OPTS': '-Dfile.encoding=utf-8',
'JAVA_HOME': java_home,
'JAVA_TOOL_OPTIONS': '-Dfile.encoding=utf-8',
},
- pass_thru=True, # Allow user to run gradle interactively.
- ensure_exit_code=False, # Don't throw on non-zero exit code.
+ pass_thru=True, # Allow user to run gradle interactively.
+ ensure_exit_code=False, # Don't throw on non-zero exit code.
cwd=mozpath.join(self.topsrcdir))
@Command('gradle-install', category='devenv',
- conditions=[REMOVED])
+ conditions=[REMOVED])
def gradle_install(self):
pass
@CommandProvider
class AndroidEmulatorCommands(MachCommandBase):
"""
Run the Android emulator with one of the AVDs used in the Mozilla
automated test environment. If necessary, the AVD is fetched from
the tooltool server and installed.
"""
@Command('android-emulator', category='devenv',
- conditions=[],
- description='Run the Android emulator with an AVD from test automation.')
+ conditions=[],
+ description='Run the Android emulator with an AVD from test automation.')
@CommandArgument('--version', metavar='VERSION', choices=['4.3', '6.0', '7.0', 'x86', 'x86-6.0', 'x86-7.0'],
- help='Specify Android version to run in emulator. One of "4.3", "6.0", "7.0", "x86", "x86-6.0", or "x86-7.0".',
- default='4.3')
+ help='Specify Android version to run in emulator. One of "4.3", "6.0", "7.0", "x86", "x86-6.0", or "x86-7.0".',
+ default='4.3')
@CommandArgument('--wait', action='store_true',
- help='Wait for emulator to be closed.')
+ help='Wait for emulator to be closed.')
@CommandArgument('--force-update', action='store_true',
- help='Update AVD definition even when AVD is already installed.')
+ help='Update AVD definition even when AVD is already installed.')
@CommandArgument('--verbose', action='store_true',
- help='Log informative status messages.')
+ help='Log informative status messages.')
def emulator(self, version, wait=False, force_update=False, verbose=False):
from mozrunner.devices.android_device import AndroidEmulator
- emulator = AndroidEmulator(version, verbose, substs=self.substs, device_serial='emulator-5554')
+ emulator = AndroidEmulator(version, verbose, substs=self.substs,
+ device_serial='emulator-5554')
if emulator.is_running():
# It is possible to run multiple emulators simultaneously, but:
# - if more than one emulator is using the same avd, errors may
# occur due to locked resources;
# - additional parameters must be specified when running tests,
# to select a specific device.
# To avoid these complications, allow just one emulator at a time.
self.log(logging.ERROR, "emulator", {},
@@ -592,30 +597,30 @@ class AndroidEmulatorCommands(MachComman
@CommandProvider
class AutophoneCommands(MachCommandBase):
"""
Run autophone, https://wiki.mozilla.org/Auto-tools/Projects/Autophone.
If necessary, autophone is cloned from github, installed, and configured.
"""
@Command('autophone', category='devenv',
- conditions=[],
- description='Run autophone.')
+ conditions=[],
+ description='Run autophone.')
@CommandArgument('--clean', action='store_true',
- help='Delete an existing autophone installation.')
+ help='Delete an existing autophone installation.')
@CommandArgument('--verbose', action='store_true',
- help='Log informative status messages.')
+ help='Log informative status messages.')
def autophone(self, clean=False, verbose=False):
import platform
from mozrunner.devices.autophone import AutophoneRunner
if platform.system() == "Windows":
# Autophone is normally run on Linux or OSX.
self.log(logging.ERROR, "autophone", {},
- "This mach command is not supported on Windows!")
+ "This mach command is not supported on Windows!")
return -1
runner = AutophoneRunner(self, verbose)
runner.load_config()
if clean:
runner.reset_to_clean()
return 0
if not runner.setup_directory():
--- a/mobile/locales/filter.py
+++ b/mobile/locales/filter.py
@@ -2,73 +2,74 @@
# 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/.
"""This routine controls which localizable files and entries are
reported and l10n-merged.
This needs to stay in sync with the copy in mobile/android/locales.
"""
-def test(mod, path, entity = None):
- import re
- # ignore anything but mobile, which is our local repo checkout name
- if mod not in ("dom", "toolkit", "mobile",
- "mobile/android/base", "mobile/android"):
- return "ignore"
+
+def test(mod, path, entity=None):
+ import re
+ # ignore anything but mobile, which is our local repo checkout name
+ if mod not in ("dom", "toolkit", "mobile",
+ "mobile/android/base", "mobile/android"):
+ return "ignore"
- if mod == "toolkit":
- # keep this file list in sync with jar.mn
- if path in (
- "chrome/global/aboutAbout.dtd",
- "chrome/global/aboutReader.properties",
- "chrome/global/aboutRights.dtd",
- "chrome/global/charsetMenu.properties",
- "chrome/global/commonDialogs.properties",
- "chrome/global/intl.properties",
- "chrome/global/intl.css",
- "chrome/search/search.properties",
- "chrome/pluginproblem/pluginproblem.dtd",
- "chrome/global/aboutSupport.dtd",
- "chrome/global/aboutSupport.properties",
- "crashreporter/crashes.dtd",
- "crashreporter/crashes.properties",
- "chrome/global/mozilla.dtd",
- "chrome/global/aboutTelemetry.dtd",
- "chrome/global/aboutTelemetry.properties",
- "chrome/global/aboutWebrtc.properties"):
- return "error"
- return "ignore"
+ if mod == "toolkit":
+ # keep this file list in sync with jar.mn
+ if path in (
+ "chrome/global/aboutAbout.dtd",
+ "chrome/global/aboutReader.properties",
+ "chrome/global/aboutRights.dtd",
+ "chrome/global/charsetMenu.properties",
+ "chrome/global/commonDialogs.properties",
+ "chrome/global/intl.properties",
+ "chrome/global/intl.css",
+ "chrome/search/search.properties",
+ "chrome/pluginproblem/pluginproblem.dtd",
+ "chrome/global/aboutSupport.dtd",
+ "chrome/global/aboutSupport.properties",
+ "crashreporter/crashes.dtd",
+ "crashreporter/crashes.properties",
+ "chrome/global/mozilla.dtd",
+ "chrome/global/aboutTelemetry.dtd",
+ "chrome/global/aboutTelemetry.properties",
+ "chrome/global/aboutWebrtc.properties"):
+ return "error"
+ return "ignore"
- if mod == "dom":
- # keep this file list in sync with jar.mn
- if path in (
- "chrome/global.dtd",
- "chrome/accessibility/AccessFu.properties",
- "chrome/dom/dom.properties",
- "chrome/plugins.properties"):
- return "error"
- return "ignore"
-
- if mod not in ("mobile", "mobile/android"):
- # we only have exceptions for mobile*
- return "error"
- if mod == "mobile/android":
- if not entity:
- if (re.match(r"mobile-l10n.js", path) or
- re.match(r"defines.inc", path)):
+ if mod == "dom":
+ # keep this file list in sync with jar.mn
+ if path in (
+ "chrome/global.dtd",
+ "chrome/accessibility/AccessFu.properties",
+ "chrome/dom/dom.properties",
+ "chrome/plugins.properties"):
+ return "error"
return "ignore"
- if path == "defines.inc":
- if entity == "MOZ_LANGPACK_CONTRIBUTORS":
- return "ignore"
- return "error"
- # we're in mod == "mobile"
- if path == "chrome/region.properties":
- # only region.properties exceptions remain
- if (re.match(r"browser\.search\.order\.[1-9]", entity) or
- re.match(r"browser\.search\.[a-zA-Z]+\.US", entity) or
- re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
- re.match(r"gecko\.handlerService\.schemes\.", entity) or
- re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity) or
- re.match(r"browser\.suggestedsites\.", entity)):
- return "ignore"
+ if mod not in ("mobile", "mobile/android"):
+ # we only have exceptions for mobile*
+ return "error"
+ if mod == "mobile/android":
+ if not entity:
+ if (re.match(r"mobile-l10n.js", path) or
+ re.match(r"defines.inc", path)):
+ return "ignore"
+ if path == "defines.inc":
+ if entity == "MOZ_LANGPACK_CONTRIBUTORS":
+ return "ignore"
+ return "error"
- return "error"
+ # we're in mod == "mobile"
+ if path == "chrome/region.properties":
+ # only region.properties exceptions remain
+ if (re.match(r"browser\.search\.order\.[1-9]", entity) or
+ re.match(r"browser\.search\.[a-zA-Z]+\.US", entity) or
+ re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or
+ re.match(r"gecko\.handlerService\.schemes\.", entity) or
+ re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity) or
+ re.match(r"browser\.suggestedsites\.", entity)):
+ return "ignore"
+
+ return "error"