diff options
author | Moonchild <moonchild@palemoon.org> | 2021-10-17 17:19:41 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-10-17 17:19:41 +0000 |
commit | 8a409cdaebdfb72595b17a563a82d3448ca02763 (patch) | |
tree | e5f53bbf09e508826b864920891e0c64081136a0 /python | |
parent | df215eb533eb4cfdb51d85dd34a46c0e53d25ff9 (diff) | |
download | aura-central-8a409cdaebdfb72595b17a563a82d3448ca02763.tar.gz |
Issue %3020 - Part 9: Second pass remove android defines and build system stuff.
Mostly IPC, tools and mozbuild.
Diffstat (limited to 'python')
-rw-r--r-- | python/moz.build | 7 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/action/explode_aar.py | 72 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/action/generate_suggestedsites.py | 147 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/action/package_fennec_apk.py | 150 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/android_version_code.py | 167 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/backend/__init__.py | 1 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/config_status.py | 17 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/frontend/data.py | 113 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/mach_commands.py | 9 | ||||
-rwxr-xr-x | python/mozbuild/mozbuild/mozinfo.py | 8 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/test/backend/test_android_eclipse.py | 153 | ||||
-rw-r--r-- | python/mozbuild/mozbuild/testing.py | 1 | ||||
-rw-r--r-- | python/mozbuild/mozpack/executables.py | 7 | ||||
-rw-r--r-- | python/mozlint/mozlint/cli.py | 2 |
14 files changed, 7 insertions, 847 deletions
diff --git a/python/moz.build b/python/moz.build index 5d7b90558..108b986b5 100644 --- a/python/moz.build +++ b/python/moz.build @@ -3,12 +3,6 @@ # 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/. -with Files('mach/**'): - BUG_COMPONENT = ('Core', 'mach') - -with Files('mozbuild/**'): - BUG_COMPONENT = ('Core', 'Build Config') - SPHINX_PYTHON_PACKAGE_DIRS += [ 'mach', 'mozbuild/mozbuild', @@ -30,7 +24,6 @@ PYTHON_UNIT_TESTS += [ 'mozbuild/mozbuild/test/action/test_buildlist.py', 'mozbuild/mozbuild/test/action/test_generate_browsersearch.py', 'mozbuild/mozbuild/test/action/test_package_fennec_apk.py', - 'mozbuild/mozbuild/test/backend/test_android_eclipse.py', 'mozbuild/mozbuild/test/backend/test_build.py', 'mozbuild/mozbuild/test/backend/test_configenvironment.py', 'mozbuild/mozbuild/test/backend/test_recursivemake.py', diff --git a/python/mozbuild/mozbuild/action/explode_aar.py b/python/mozbuild/mozbuild/action/explode_aar.py deleted file mode 100644 index fcaf594c1..000000000 --- a/python/mozbuild/mozbuild/action/explode_aar.py +++ /dev/null @@ -1,72 +0,0 @@ -# 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/. - -from __future__ import absolute_import, print_function, unicode_literals - -import argparse -import errno -import os -import shutil -import sys -import zipfile - -from mozpack.files import FileFinder -import mozpack.path as mozpath -from mozbuild.util import ensureParentDir - -def explode(aar, destdir): - # Take just the support-v4-22.2.1 part. - name, _ = os.path.splitext(os.path.basename(aar)) - - destdir = mozpath.join(destdir, name) - if os.path.exists(destdir): - # We always want to start fresh. - shutil.rmtree(destdir) - ensureParentDir(destdir) - with zipfile.ZipFile(aar) as zf: - zf.extractall(destdir) - - # classes.jar is always present. However, multiple JAR files with the same - # name confuses our staged Proguard process in - # mobile/android/base/Makefile.in, so we make the names unique here. - classes_jar = mozpath.join(destdir, name + '-classes.jar') - os.rename(mozpath.join(destdir, 'classes.jar'), classes_jar) - - # Embedded JAR libraries are optional. - finder = FileFinder(mozpath.join(destdir, 'libs'), find_executables=False) - for p, _ in finder.find('*.jar'): - jar = mozpath.join(finder.base, name + '-' + p) - os.rename(mozpath.join(finder.base, p), jar) - - # Frequently assets/ is present but empty. Protect against meaningless - # changes to the AAR files by deleting empty assets/ directories. - assets = mozpath.join(destdir, 'assets') - try: - os.rmdir(assets) - except OSError, e: - if e.errno in (errno.ENOTEMPTY, errno.ENOENT): - pass - else: - raise - - return True - - -def main(argv): - parser = argparse.ArgumentParser( - description='Explode Android AAR file.') - - parser.add_argument('--destdir', required=True, help='Destination directory.') - parser.add_argument('aars', nargs='+', help='Path to AAR file(s).') - - args = parser.parse_args(argv) - - for aar in args.aars: - if not explode(aar, args.destdir): - return 1 - return 0 - - -if __name__ == '__main__': - sys.exit(main(sys.argv[1:])) diff --git a/python/mozbuild/mozbuild/action/generate_suggestedsites.py b/python/mozbuild/mozbuild/action/generate_suggestedsites.py deleted file mode 100644 index 96d824cc2..000000000 --- a/python/mozbuild/mozbuild/action/generate_suggestedsites.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# 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/. - -''' Script to generate the suggestedsites.json file for Fennec. - -This script follows these steps: - -1. Read the region.properties file in all the given source directories -(see srcdir option). Merge all properties into a single dict accounting for -the priority of source directories. - -2. Read the list of sites from the list 'browser.suggestedsites.list.INDEX' and -'browser.suggestedsites.restricted.list.INDEX' properties with value of these keys -being an identifier for each suggested site e.g. browser.suggestedsites.list.0=mozilla, -browser.suggestedsites.list.1=fxmarketplace. - -3. For each site identifier defined by the list keys, look for matching branches -containing the respective properties i.e. url, title, etc. For example, -for a 'mozilla' identifier, we'll look for keys like: -browser.suggestedsites.mozilla.url, browser.suggestedsites.mozilla.title, etc. - -4. Generate a JSON representation of each site, join them in a JSON array, and -write the result to suggestedsites.json on the locale-specific raw resource -directory e.g. raw/suggestedsites.json, raw-pt-rBR/suggestedsites.json. -''' - -from __future__ import absolute_import, print_function - -import argparse -import copy -import json -import sys -import os - -from mozbuild.dotproperties import ( - DotProperties, -) -from mozbuild.util import ( - FileAvoidWrite, -) -from mozpack.files import ( - FileFinder, -) -import mozpack.path as mozpath - - -def merge_properties(filename, srcdirs): - """Merges properties from the given file in the given source directories.""" - properties = DotProperties() - for srcdir in srcdirs: - path = mozpath.join(srcdir, filename) - try: - properties.update(path) - except IOError: - # Ignore non-existing files - continue - return properties - - -def main(args): - parser = argparse.ArgumentParser() - parser.add_argument('--verbose', '-v', default=False, action='store_true', - help='be verbose') - parser.add_argument('--silent', '-s', default=False, action='store_true', - help='be silent') - parser.add_argument('--android-package-name', metavar='NAME', - required=True, - help='Android package name') - parser.add_argument('--resources', metavar='RESOURCES', - default=None, - help='optional Android resource directory to find drawables in') - parser.add_argument('--srcdir', metavar='SRCDIR', - action='append', required=True, - help='directories to read inputs from, in order of priority') - parser.add_argument('output', metavar='OUTPUT', - help='output') - opts = parser.parse_args(args) - - # Use reversed order so that the first srcdir has higher priority to override keys. - properties = merge_properties('region.properties', reversed(opts.srcdir)) - - # Keep these two in sync. - image_url_template = 'android.resource://%s/drawable/suggestedsites_{name}' % opts.android_package_name - drawables_template = 'drawable*/suggestedsites_{name}.*' - - # Load properties corresponding to each site name and define their - # respective image URL. - sites = [] - - def add_names(names, defaults={}): - for name in names: - site = copy.deepcopy(defaults) - site.update(properties.get_dict('browser.suggestedsites.{name}'.format(name=name), required_keys=('title', 'url', 'bgcolor'))) - site['imageurl'] = image_url_template.format(name=name) - sites.append(site) - - # Now check for existence of an appropriately named drawable. If none - # exists, throw. This stops a locale discovering, at runtime, that the - # corresponding drawable was not added to en-US. - if not opts.resources: - continue - resources = os.path.abspath(opts.resources) - finder = FileFinder(resources) - matches = [p for p, _ in finder.find(drawables_template.format(name=name))] - if not matches: - raise Exception("Could not find drawable in '{resources}' for '{name}'" - .format(resources=resources, name=name)) - else: - if opts.verbose: - print("Found {len} drawables in '{resources}' for '{name}': {matches}" - .format(len=len(matches), resources=resources, name=name, matches=matches)) - - # We want the lists to be ordered for reproducibility. Each list has a - # "default" JSON list item which will be extended by the properties read. - lists = [ - ('browser.suggestedsites.list', {}), - ('browser.suggestedsites.restricted.list', {'restricted': True}), - ] - if opts.verbose: - print('Reading {len} suggested site lists: {lists}'.format(len=len(lists), lists=[list_name for list_name, _ in lists])) - - for (list_name, list_item_defaults) in lists: - names = properties.get_list(list_name) - if opts.verbose: - print('Reading {len} suggested sites from {list}: {names}'.format(len=len(names), list=list_name, names=names)) - add_names(names, list_item_defaults) - - - # FileAvoidWrite creates its parent directories. - output = os.path.abspath(opts.output) - fh = FileAvoidWrite(output) - json.dump(sites, fh) - existed, updated = fh.close() - - if not opts.silent: - if updated: - print('{output} updated'.format(output=output)) - else: - print('{output} already up-to-date'.format(output=output)) - - return 0 - - -if __name__ == '__main__': - sys.exit(main(sys.argv[1:])) diff --git a/python/mozbuild/mozbuild/action/package_fennec_apk.py b/python/mozbuild/mozbuild/action/package_fennec_apk.py deleted file mode 100644 index ecd5a9af3..000000000 --- a/python/mozbuild/mozbuild/action/package_fennec_apk.py +++ /dev/null @@ -1,150 +0,0 @@ -# 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/. - -''' -Script to produce an Android package (.apk) for Fennec. -''' - -from __future__ import absolute_import, print_function - -import argparse -import buildconfig -import os -import subprocess -import sys - -from mozpack.copier import Jarrer -from mozpack.files import ( - DeflatedFile, - File, - FileFinder, -) -from mozpack.mozjar import JarReader -import mozpack.path as mozpath - - -def package_fennec_apk(inputs=[], omni_ja=None, classes_dex=None, - lib_dirs=[], - assets_dirs=[], - features_dirs=[], - root_files=[], - verbose=False): - jarrer = Jarrer(optimize=False) - - # First, take input files. The contents of the later files overwrites the - # content of earlier files. - for input in inputs: - jar = JarReader(input) - for file in jar: - path = file.filename - if jarrer.contains(path): - jarrer.remove(path) - jarrer.add(path, DeflatedFile(file), compress=file.compressed) - - def add(path, file, compress=None): - abspath = os.path.abspath(file.path) - if verbose: - print('Packaging %s from %s' % (path, file.path)) - if not os.path.exists(abspath): - raise ValueError('File %s not found (looked for %s)' % \ - (file.path, abspath)) - if jarrer.contains(path): - jarrer.remove(path) - jarrer.add(path, file, compress=compress) - - for features_dir in features_dirs: - finder = FileFinder(features_dir, find_executables=False) - for p, f in finder.find('**'): - add(mozpath.join('assets', 'features', p), f, False) - - for assets_dir in assets_dirs: - finder = FileFinder(assets_dir, find_executables=False) - for p, f in finder.find('**'): - compress = None # Take default from Jarrer. - if p.endswith('.so'): - # Asset libraries are special. - if f.open().read(5)[1:] == '7zXZ': - print('%s is already compressed' % p) - # We need to store (rather than deflate) compressed libraries - # (even if we don't compress them ourselves). - compress = False - elif buildconfig.substs.get('XZ'): - cmd = [buildconfig.substs.get('XZ'), '-zkf', - mozpath.join(finder.base, p)] - - bcj = None - if buildconfig.substs.get('MOZ_THUMB2'): - bcj = '--armthumb' - elif buildconfig.substs.get('CPU_ARCH') == 'arm': - bcj = '--arm' - elif buildconfig.substs.get('CPU_ARCH') == 'x86': - bcj = '--x86' - - if bcj: - cmd.extend([bcj, '--lzma2']) - print('xz-compressing %s with %s' % (p, ' '.join(cmd))) - subprocess.check_output(cmd) - os.rename(f.path + '.xz', f.path) - compress = False - - add(mozpath.join('assets', p), f, compress=compress) - - for lib_dir in lib_dirs: - finder = FileFinder(lib_dir, find_executables=False) - for p, f in finder.find('**'): - add(mozpath.join('lib', p), f) - - for root_file in root_files: - add(os.path.basename(root_file), File(root_file)) - - if omni_ja: - add(mozpath.join('assets', 'omni.ja'), File(omni_ja), compress=False) - - if classes_dex: - add('classes.dex', File(classes_dex)) - - return jarrer - - -def main(args): - parser = argparse.ArgumentParser() - parser.add_argument('--verbose', '-v', default=False, action='store_true', - help='be verbose') - parser.add_argument('--inputs', nargs='+', - help='Input skeleton AP_ or APK file(s).') - parser.add_argument('-o', '--output', - help='Output APK file.') - parser.add_argument('--omnijar', default=None, - help='Optional omni.ja to pack into APK file.') - parser.add_argument('--classes-dex', default=None, - help='Optional classes.dex to pack into APK file.') - parser.add_argument('--lib-dirs', nargs='*', default=[], - help='Optional lib/ dirs to pack into APK file.') - parser.add_argument('--assets-dirs', nargs='*', default=[], - help='Optional assets/ dirs to pack into APK file.') - parser.add_argument('--features-dirs', nargs='*', default=[], - help='Optional features/ dirs to pack into APK file.') - parser.add_argument('--root-files', nargs='*', default=[], - help='Optional files to pack into APK file root.') - args = parser.parse_args(args) - - if buildconfig.substs.get('OMNIJAR_NAME') != 'assets/omni.ja': - raise ValueError("Don't know how package Fennec APKs when " - " OMNIJAR_NAME is not 'assets/omni.jar'.") - - jarrer = package_fennec_apk(inputs=args.inputs, - omni_ja=args.omnijar, - classes_dex=args.classes_dex, - lib_dirs=args.lib_dirs, - assets_dirs=args.assets_dirs, - features_dirs=args.features_dirs, - root_files=args.root_files, - verbose=args.verbose) - jarrer.copy(args.output) - - return 0 - - -if __name__ == '__main__': - sys.exit(main(sys.argv[1:])) diff --git a/python/mozbuild/mozbuild/android_version_code.py b/python/mozbuild/mozbuild/android_version_code.py deleted file mode 100644 index 6d9445c63..000000000 --- a/python/mozbuild/mozbuild/android_version_code.py +++ /dev/null @@ -1,167 +0,0 @@ -# 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/. - -from __future__ import absolute_import, print_function - -import argparse -import math -import sys -import time - -# Builds before this build ID use the v0 version scheme. Builds after this -# build ID use the v1 version scheme. -V1_CUTOFF = 20150801000000 # YYYYmmddHHMMSS - -def android_version_code_v0(buildid, cpu_arch=None, min_sdk=0, max_sdk=0): - base = int(str(buildid)[:10]) - # None is interpreted as arm. - if not cpu_arch or cpu_arch in ['armeabi', 'armeabi-v7a']: - # Increment by MIN_SDK_VERSION -- this adds 9 to every build ID as a - # minimum. Our split APK starts at 15. - return base + min_sdk + 0 - elif cpu_arch in ['x86']: - # Increment the version code by 3 for x86 builds so they are offered to - # x86 phones that have ARM emulators, beating the 2-point advantage that - # the v15+ ARMv7 APK has. If we change our splits in the future, we'll - # need to do this further still. - return base + min_sdk + 3 - else: - raise ValueError("Don't know how to compute android:versionCode " - "for CPU arch %s" % cpu_arch) - -def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0): - '''Generate a v1 android:versionCode. - - The important consideration is that version codes be monotonically - increasing (per Android package name) for all published builds. The input - build IDs are based on timestamps and hence are always monotonically - increasing. - - The generated v1 version codes look like (in binary): - - 0111 1000 0010 tttt tttt tttt tttt txpg - - The 17 bits labelled 't' represent the number of hours since midnight on - September 1, 2015. (2015090100 in YYYYMMMDDHH format.) This yields a - little under 15 years worth of hourly build identifiers, since 2**17 / (366 - * 24) =~ 14.92. - - The bits labelled 'x', 'p', and 'g' are feature flags. - - The bit labelled 'x' is 1 if the build is for an x86 architecture and 0 - otherwise, which means the build is for an ARM architecture. (Fennec no - longer supports ARMv6, so ARM is equivalent to ARMv7 and above.) - - The bit labelled 'p' is a placeholder that is always 0 (for now). - - Firefox no longer supports API 14 or earlier. - - This version code computation allows for a split on API levels that allowed - us to ship builds specifically for Gingerbread (API 9-10); we preserve - that functionality for sanity's sake, and to allow us to reintroduce a - split in the future. - - At present, the bit labelled 'g' is 1 if the build is an ARM build - targeting API 15+, which will always be the case. - - We throw an explanatory exception when we are within one calendar year of - running out of build events. This gives lots of time to update the version - scheme. The responsible individual should then bump the range (to allow - builds to continue) and use the time remaining to update the version scheme - via the reserved high order bits. - - N.B.: the reserved 0 bit to the left of the highest order 't' bit can, - sometimes, be used to bump the version scheme. In addition, by reducing the - granularity of the build identifiers (for example, moving to identifying - builds every 2 or 4 hours), the version scheme may be adjusted further still - without losing a (valuable) high order bit. - ''' - def hours_since_cutoff(buildid): - # The ID is formatted like YYYYMMDDHHMMSS (using - # datetime.utcnow().strftime('%Y%m%d%H%M%S'); see build/variables.py). - # The inverse function is time.strptime. - # N.B.: the time module expresses time as decimal seconds since the - # epoch. - fmt = '%Y%m%d%H%M%S' - build = time.strptime(str(buildid), fmt) - cutoff = time.strptime(str(V1_CUTOFF), fmt) - return int(math.floor((time.mktime(build) - time.mktime(cutoff)) / (60.0 * 60.0))) - - # Of the 21 low order bits, we take 17 bits for builds. - base = hours_since_cutoff(buildid) - if base < 0: - raise ValueError("Something has gone horribly wrong: cannot calculate " - "android:versionCode from build ID %s: hours underflow " - "bits allotted!" % buildid) - if base > 2**17: - raise ValueError("Something has gone horribly wrong: cannot calculate " - "android:versionCode from build ID %s: hours overflow " - "bits allotted!" % buildid) - if base > 2**17 - 366 * 24: - raise ValueError("Running out of low order bits calculating " - "android:versionCode from build ID %s: " - "; YOU HAVE ONE YEAR TO UPDATE THE VERSION SCHEME." % buildid) - - version = 0b1111000001000000000000000000000 - # We reserve 1 "middle" high order bit for the future, and 3 low order bits - # for architecture and APK splits. - version |= base << 3 - - # None is interpreted as arm. - if not cpu_arch or cpu_arch in ['armeabi', 'armeabi-v7a']: - # 0 is interpreted as SDK 9. - if not min_sdk or min_sdk == 9: - pass - # This used to compare to 11. The 15+ APK directly supersedes 11+, so - # we reuse this check. - elif min_sdk == 15: - version |= 1 << 0 - else: - raise ValueError("Don't know how to compute android:versionCode " - "for CPU arch %s and min SDK %s" % (cpu_arch, min_sdk)) - elif cpu_arch in ['x86']: - version |= 1 << 2 - else: - raise ValueError("Don't know how to compute android:versionCode " - "for CPU arch %s" % cpu_arch) - - return version - -def android_version_code(buildid, *args, **kwargs): - base = int(str(buildid)) - if base < V1_CUTOFF: - return android_version_code_v0(buildid, *args, **kwargs) - else: - return android_version_code_v1(buildid, *args, **kwargs) - - -def main(argv): - parser = argparse.ArgumentParser('Generate an android:versionCode', - add_help=False) - parser.add_argument('--verbose', action='store_true', - default=False, - help='Be verbose') - parser.add_argument('--with-android-cpu-arch', dest='cpu_arch', - choices=['armeabi', 'armeabi-v7a', 'mips', 'x86'], - help='The target CPU architecture') - parser.add_argument('--with-android-min-sdk-version', dest='min_sdk', - type=int, default=0, - help='The minimum target SDK') - parser.add_argument('--with-android-max-sdk-version', dest='max_sdk', - type=int, default=0, - help='The maximum target SDK') - parser.add_argument('buildid', type=int, - help='The input build ID') - - args = parser.parse_args(argv) - code = android_version_code(args.buildid, - cpu_arch=args.cpu_arch, - min_sdk=args.min_sdk, - max_sdk=args.max_sdk) - print(code) - return 0 - - -if __name__ == '__main__': - sys.exit(main(sys.argv[1:])) diff --git a/python/mozbuild/mozbuild/backend/__init__.py b/python/mozbuild/mozbuild/backend/__init__.py index 64bcb87d9..7093e0c83 100644 --- a/python/mozbuild/mozbuild/backend/__init__.py +++ b/python/mozbuild/mozbuild/backend/__init__.py @@ -3,7 +3,6 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. backends = { - 'AndroidEclipse': 'mozbuild.backend.android_eclipse', 'ChromeMap': 'mozbuild.codecoverage.chrome_map', 'CompileDB': 'mozbuild.compilation.database', 'CppEclipse': 'mozbuild.backend.cpp_eclipse', diff --git a/python/mozbuild/mozbuild/config_status.py b/python/mozbuild/mozbuild/config_status.py index fa15fa65b..e279dbf48 100644 --- a/python/mozbuild/mozbuild/config_status.py +++ b/python/mozbuild/mozbuild/config_status.py @@ -29,25 +29,8 @@ from mozbuild.backend import ( get_backend_class, ) - log_manager = LoggingManager() - -ANDROID_IDE_ADVERTISEMENT = ''' -============= -ADVERTISEMENT - -You are building Firefox for Android. After your build completes, you can open -the top source directory in IntelliJ or Android Studio directly and build using -Gradle. See the documentation at - -https://developer.mozilla.org/en-US/docs/Simple_Firefox_for_Android_build - -PLEASE BE AWARE THAT GRADLE AND INTELLIJ/ANDROID STUDIO SUPPORT IS EXPERIMENTAL. -You should verify any changes using |mach build|. -============= -'''.strip() - VISUAL_STUDIO_ADVERTISEMENT = ''' =============================== Visual Studio Support Available diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py index fb0bf2405..83d7b122a 100644 --- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -936,119 +936,6 @@ class GeneratedFile(ContextDerived): self.inputs = inputs self.flags = flags - -class ClassPathEntry(object): - """Represents a classpathentry in an Android Eclipse project.""" - - __slots__ = ( - 'dstdir', - 'srcdir', - 'path', - 'exclude_patterns', - 'ignore_warnings', - ) - - def __init__(self): - self.dstdir = None - self.srcdir = None - self.path = None - self.exclude_patterns = [] - self.ignore_warnings = False - - -class AndroidEclipseProjectData(object): - """Represents an Android Eclipse project.""" - - __slots__ = ( - 'name', - 'package_name', - 'is_library', - 'res', - 'assets', - 'libs', - 'manifest', - 'recursive_make_targets', - 'extra_jars', - 'included_projects', - 'referenced_projects', - '_classpathentries', - 'filtered_resources', - ) - - def __init__(self, name): - self.name = name - self.is_library = False - self.manifest = None - self.res = None - self.assets = None - self.libs = [] - self.recursive_make_targets = [] - self.extra_jars = [] - self.included_projects = [] - self.referenced_projects = [] - self._classpathentries = [] - self.filtered_resources = [] - - def add_classpathentry(self, path, srcdir, dstdir, exclude_patterns=[], ignore_warnings=False): - cpe = ClassPathEntry() - cpe.srcdir = srcdir - cpe.dstdir = dstdir - cpe.path = path - cpe.exclude_patterns = list(exclude_patterns) - cpe.ignore_warnings = ignore_warnings - self._classpathentries.append(cpe) - return cpe - - -class AndroidResDirs(ContextDerived): - """Represents Android resource directories.""" - - __slots__ = ( - 'paths', - ) - - def __init__(self, context, paths): - ContextDerived.__init__(self, context) - self.paths = paths - -class AndroidAssetsDirs(ContextDerived): - """Represents Android assets directories.""" - - __slots__ = ( - 'paths', - ) - - def __init__(self, context, paths): - ContextDerived.__init__(self, context) - self.paths = paths - -class AndroidExtraResDirs(ContextDerived): - """Represents Android extra resource directories. - - Extra resources are resources provided by libraries and including in a - packaged APK, but not otherwise redistributed. In practice, this means - resources included in Fennec but not in GeckoView. - """ - - __slots__ = ( - 'paths', - ) - - def __init__(self, context, paths): - ContextDerived.__init__(self, context) - self.paths = paths - -class AndroidExtraPackages(ContextDerived): - """Represents Android extra packages.""" - - __slots__ = ( - 'packages', - ) - - def __init__(self, context, packages): - ContextDerived.__init__(self, context) - self.packages = packages - class ChromeManifestEntry(ContextDerived): """Represents a chrome.manifest entry.""" diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index d1a1e1393..e299fca18 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -532,10 +532,7 @@ class Build(MachCommandBase): # need to be burdened with this. if not what: try: - # Fennec doesn't have useful output from just building. We should - # arguably make the build action useful for Fennec. Another day... - if self.substs['MOZ_BUILD_APP'] != 'mobile/android': - print('To take your build for a test drive, run: |mach run|') + print('To take your build for a test drive, run: |mach run|') except Exception: # Ignore Exceptions in case we can't find config.status (such # as when doing OSX Universal builds) @@ -1147,7 +1144,7 @@ class Install(MachCommandBase): @Command('install', category='post-build', description='Install the package on the machine, or on a device.') @CommandArgument('--verbose', '-v', action='store_true', - help='Print verbose output when installing to an Android emulator.') + help='Print verbose output.') def install(self, verbose=False): ret = self._run_make(directory=".", target='install', ensure_exit_code=False) if ret == 0: @@ -1484,8 +1481,6 @@ class ArtifactSubCommand(SubCommand): def __call__(self, func): after = SubCommand.__call__(self, func) jobchoices = { - 'android-api-15', - 'android-x86', 'linux', 'linux64', 'macosx64', diff --git a/python/mozbuild/mozbuild/mozinfo.py b/python/mozbuild/mozbuild/mozinfo.py index c6c95d923..8fca024c9 100755 --- a/python/mozbuild/mozbuild/mozinfo.py +++ b/python/mozbuild/mozbuild/mozinfo.py @@ -36,8 +36,7 @@ def build_dict(config, env=os.environ): o = substs["OS_TARGET"] known_os = {"Linux": "linux", "WINNT": "win", - "Darwin": "mac", - "Android": "android"} + "Darwin": "mac"} if o in known_os: d["os"] = known_os[o] else: @@ -108,11 +107,6 @@ def build_dict(config, env=os.environ): return p - if d['buildapp'] == 'mobile/android': - if d['processor'] == 'x86': - return 'android-x86' - return 'android-arm' - def guess_buildtype(): if d['debug']: return 'debug' diff --git a/python/mozbuild/mozbuild/test/backend/test_android_eclipse.py b/python/mozbuild/mozbuild/test/backend/test_android_eclipse.py deleted file mode 100644 index c4e9221c9..000000000 --- a/python/mozbuild/mozbuild/test/backend/test_android_eclipse.py +++ /dev/null @@ -1,153 +0,0 @@ -# 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/. - -from __future__ import unicode_literals - -import json -import os -import unittest - -from mozbuild.backend.android_eclipse import AndroidEclipseBackend -from mozbuild.frontend.emitter import TreeMetadataEmitter -from mozbuild.frontend.reader import BuildReader -from mozbuild.test.backend.common import BackendTester -from mozpack.manifests import InstallManifest -from mozunit import main - -import mozpack.path as mozpath - -class TestAndroidEclipseBackend(BackendTester): - def __init__(self, *args, **kwargs): - BackendTester.__init__(self, *args, **kwargs) - self.env = None - - def assertExists(self, *args): - p = mozpath.join(self.env.topobjdir, 'android_eclipse', *args) - self.assertTrue(os.path.exists(p), "Path %s exists" % p) - - def assertNotExists(self, *args): - p = mozpath.join(self.env.topobjdir, 'android_eclipse', *args) - self.assertFalse(os.path.exists(p), "Path %s does not exist" % p) - - def test_library_project_files(self): - """Ensure we generate reasonable files for library projects.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - for f in ['.classpath', - '.project', - '.settings', - 'AndroidManifest.xml', - 'project.properties']: - self.assertExists('library1', f) - - def test_main_project_files(self): - """Ensure we generate reasonable files for main (non-library) projects.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - for f in ['.classpath', - '.project', - '.settings', - 'gen', - 'lint.xml', - 'project.properties']: - self.assertExists('main1', f) - - def test_library_manifest(self): - """Ensure we generate manifest for library projects.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - self.assertExists('library1', 'AndroidManifest.xml') - - def test_classpathentries(self): - """Ensure we produce reasonable classpathentries.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - self.assertExists('main3', '.classpath') - # This is brittle but simple. - with open(mozpath.join(self.env.topobjdir, 'android_eclipse', 'main3', '.classpath'), 'rt') as fh: - lines = fh.readlines() - lines = [line.strip() for line in lines] - self.assertIn('<classpathentry including="**/*.java" kind="src" path="a" />', lines) - self.assertIn('<classpathentry excluding="b/Excludes.java|b/Excludes2.java" including="**/*.java" kind="src" path="b" />', lines) - self.assertIn('<classpathentry including="**/*.java" kind="src" path="c"><attributes><attribute name="ignore_optional_problems" value="true" /></attributes></classpathentry>', lines) - - def test_library_project_setting(self): - """Ensure we declare a library project correctly.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - - self.assertExists('library1', 'project.properties') - with open(mozpath.join(self.env.topobjdir, 'android_eclipse', 'library1', 'project.properties'), 'rt') as fh: - lines = fh.readlines() - lines = [line.strip() for line in lines] - self.assertIn('android.library=true', lines) - - self.assertExists('main1', 'project.properties') - with open(mozpath.join(self.env.topobjdir, 'android_eclipse', 'main1', 'project.properties'), 'rt') as fh: - lines = fh.readlines() - lines = [line.strip() for line in lines] - self.assertNotIn('android.library=true', lines) - - def test_referenced_projects(self): - """Ensure we reference another project correctly.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - self.assertExists('main4', '.classpath') - # This is brittle but simple. - with open(mozpath.join(self.env.topobjdir, 'android_eclipse', 'main4', '.classpath'), 'rt') as fh: - lines = fh.readlines() - lines = [line.strip() for line in lines] - self.assertIn('<classpathentry combineaccessrules="false" kind="src" path="/library1" />', lines) - - def test_extra_jars(self): - """Ensure we add class path entries to extra jars iff asked to.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - self.assertExists('main2', '.classpath') - # This is brittle but simple. - with open(mozpath.join(self.env.topobjdir, 'android_eclipse', 'main2', '.classpath'), 'rt') as fh: - lines = fh.readlines() - lines = [line.strip() for line in lines] - self.assertIn('<classpathentry exported="true" kind="lib" path="%s/main2/extra.jar" />' % self.env.topsrcdir, lines) - - def test_included_projects(self): - """Ensure we include another project correctly.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - self.assertExists('main4', 'project.properties') - # This is brittle but simple. - with open(mozpath.join(self.env.topobjdir, 'android_eclipse', 'main4', 'project.properties'), 'rt') as fh: - lines = fh.readlines() - lines = [line.strip() for line in lines] - self.assertIn('android.library.reference.1=library2', lines) - - def assertInManifest(self, project_name, *args): - manifest_path = mozpath.join(self.env.topobjdir, 'android_eclipse', '%s.manifest' % project_name) - manifest = InstallManifest(manifest_path) - for arg in args: - self.assertIn(arg, manifest, '%s in manifest for project %s' % (arg, project_name)) - - def assertNotInManifest(self, project_name, *args): - manifest_path = mozpath.join(self.env.topobjdir, 'android_eclipse', '%s.manifest' % project_name) - manifest = InstallManifest(manifest_path) - for arg in args: - self.assertNotIn(arg, manifest, '%s not in manifest for project %s' % (arg, project_name)) - - def test_manifest_main_manifest(self): - """Ensure we symlink manifest if asked to for main projects.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - self.assertInManifest('main1', 'AndroidManifest.xml') - - def test_manifest_res(self): - """Ensure we symlink res/ iff asked to.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - self.assertInManifest('library1', 'res') - self.assertNotInManifest('library2', 'res') - - def test_manifest_classpathentries(self): - """Ensure we symlink classpathentries correctly.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - self.assertInManifest('main3', 'a/a', 'b', 'd/e') - - def test_manifest_assets(self): - """Ensure we symlink assets/ iff asked to.""" - self.env = self._consume('android_eclipse', AndroidEclipseBackend) - self.assertNotInManifest('main1', 'assets') - self.assertInManifest('main2', 'assets') - - -if __name__ == '__main__': - main() diff --git a/python/mozbuild/mozbuild/testing.py b/python/mozbuild/mozbuild/testing.py index b327cd74f..46b5abd4f 100644 --- a/python/mozbuild/mozbuild/testing.py +++ b/python/mozbuild/mozbuild/testing.py @@ -276,7 +276,6 @@ class TestResolver(MozbuildObject): TEST_MANIFESTS = dict( A11Y=('a11y', 'testing/mochitest', 'a11y', True), BROWSER_CHROME=('browser-chrome', 'testing/mochitest', 'browser', True), - ANDROID_INSTRUMENTATION=('instrumentation', 'instrumentation', '.', False), JETPACK_PACKAGE=('jetpack-package', 'testing/mochitest', 'jetpack-package', True), JETPACK_ADDON=('jetpack-addon', 'testing/mochitest', 'jetpack-addon', False), FIREFOX_UI_FUNCTIONAL=('firefox-ui-functional', 'firefox-ui', '.', False), diff --git a/python/mozbuild/mozpack/executables.py b/python/mozbuild/mozpack/executables.py index c943564fa..7a4fd0a0d 100644 --- a/python/mozbuild/mozpack/executables.py +++ b/python/mozbuild/mozpack/executables.py @@ -60,13 +60,12 @@ def is_executable(path): ''' Return whether a given file path points to an executable or a library, where an executable or library is identified by: - - the file extension on OS/2 and WINNT - - the file signature on OS/X and ELF systems (GNU/Linux, Android, BSD, - Solaris) + - the file extension on WINNT + - the file signature on ELF systems (GNU/Linux, Solaris) As this function is intended for use to choose between the ExecutableFile and File classes in FileFinder, and choosing ExecutableFile only matters - on OS/2, OS/X, ELF and WINNT (in GCC build) systems, we don't bother + on ELF and WINNT (in GCC build) systems, we don't bother detecting other kind of executables. ''' from buildconfig import substs diff --git a/python/mozlint/mozlint/cli.py b/python/mozlint/mozlint/cli.py index 84c1b6aa4..2a35064ed 100644 --- a/python/mozlint/mozlint/cli.py +++ b/python/mozlint/mozlint/cli.py @@ -18,7 +18,7 @@ class MozlintParser(ArgumentParser): {'nargs': '*', 'default': None, 'help': "Paths to file or directories to lint, like " - "'browser/components/loop' or 'mobile/android'. " + "'browser/components/loop'. " "Defaults to the current directory if not given.", }], [['-l', '--linter'], |