diff options
author | Moonchild <moonchild@palemoon.org> | 2021-03-10 14:26:15 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-03-10 14:26:15 +0000 |
commit | c2268033a8fa5cc342e8ab9b1fa4ed54c6d45e5c (patch) | |
tree | 799d482006b857b1f3e43f7bee564b1a3c37818b /python | |
parent | 78a37c10452a8bb73d7ef4cfa837e1e613449a85 (diff) | |
download | uxp-c2268033a8fa5cc342e8ab9b1fa4ed54c6d45e5c.tar.gz |
Issue #1053 - Remove build system MOZ_ANDROID_* defines and related code.
Diffstat (limited to 'python')
12 files changed, 0 insertions, 348 deletions
diff --git a/python/mozbuild/mozbuild/backend/android_eclipse.py b/python/mozbuild/mozbuild/backend/android_eclipse.py deleted file mode 100644 index f17eb8d34e..0000000000 --- a/python/mozbuild/mozbuild/backend/android_eclipse.py +++ /dev/null @@ -1,267 +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, unicode_literals - -import itertools -import os -import time -import types -import xml.dom.minidom as minidom -import xml.etree.ElementTree as ET - -from mozpack.copier import FileCopier -from mozpack.files import (FileFinder, PreprocessedFile) -from mozpack.manifests import InstallManifest -import mozpack.path as mozpath - -from .common import CommonBackend -from ..frontend.data import ( - AndroidEclipseProjectData, - ContextDerived, - ContextWrapped, -) -from ..makeutil import Makefile -from ..util import ensureParentDir -from mozbuild.base import ( - ExecutionSummary, - MachCommandConditions, -) - - -def pretty_print(element): - """Return a pretty-printed XML string for an Element. - """ - s = ET.tostring(element, 'utf-8') - # minidom wraps element in a Document node; firstChild strips it. - return minidom.parseString(s).firstChild.toprettyxml(indent=' ') - - -class AndroidEclipseBackend(CommonBackend): - """Backend that generates Android Eclipse project files. - """ - def __init__(self, environment): - if not MachCommandConditions.is_android(environment): - raise Exception( - 'The Android Eclipse backend is not available with this ' - 'configuration.') - - super(AndroidEclipseBackend, self).__init__(environment) - - def summary(self): - return ExecutionSummary( - 'AndroidEclipse backend executed in {execution_time:.2f}s\n' - 'Wrote {projects:d} Android Eclipse projects to {path:s}; ' - '{created:d} created; {updated:d} updated', - execution_time=self._execution_time, - projects=self._created_count + self._updated_count, - path=mozpath.join(self.environment.topobjdir, 'android_eclipse'), - created=self._created_count, - updated=self._updated_count, - ) - - def consume_object(self, obj): - """Write out Android Eclipse project files.""" - - if not isinstance(obj, ContextDerived): - return False - - if CommonBackend.consume_object(self, obj): - # If CommonBackend acknowledged the object, we're done with it. - return True - - # Handle the one case we care about specially. - if isinstance(obj, ContextWrapped) and isinstance(obj.wrapped, AndroidEclipseProjectData): - self._process_android_eclipse_project_data(obj.wrapped, obj.srcdir, obj.objdir) - - # We don't want to handle most things, so we just acknowledge all objects - return True - - def consume_finished(self): - """The common backend handles WebIDL and test files. We don't handle - these, so we don't call our superclass. - """ - - def _Element_for_classpathentry(self, cpe): - """Turn a ClassPathEntry into an XML Element, like one of: - <classpathentry including="**/*.java" kind="src" path="preprocessed"/> - <classpathentry including="**/*.java" excluding="org/mozilla/gecko/Excluded.java|org/mozilla/gecko/SecondExcluded.java" kind="src" path="src"/> - <classpathentry including="**/*.java" kind="src" path="thirdparty"> - <attributes> - <attribute name="ignore_optional_problems" value="true"/> - </attributes> - </classpathentry> - """ - e = ET.Element('classpathentry') - e.set('kind', 'src') - e.set('including', '**/*.java') - e.set('path', cpe.path) - if cpe.exclude_patterns: - e.set('excluding', '|'.join(sorted(cpe.exclude_patterns))) - if cpe.ignore_warnings: - attrs = ET.SubElement(e, 'attributes') - attr = ET.SubElement(attrs, 'attribute') - attr.set('name', 'ignore_optional_problems') - attr.set('value', 'true') - return e - - def _Element_for_referenced_project(self, name): - """Turn a referenced project name into an XML Element, like: - <classpathentry combineaccessrules="false" kind="src" path="/Fennec"/> - """ - e = ET.Element('classpathentry') - e.set('kind', 'src') - e.set('combineaccessrules', 'false') - # All project directories are in the same root; this - # reference is absolute in the Eclipse namespace. - e.set('path', '/' + name) - return e - - def _Element_for_extra_jar(self, name): - """Turn a referenced JAR name into an XML Element, like: - <classpathentry exported="true" kind="lib" path="/Users/nalexander/Mozilla/gecko-dev/build/mobile/robocop/robotium-solo-4.3.1.jar"/> - """ - e = ET.Element('classpathentry') - e.set('kind', 'lib') - e.set('exported', 'true') - e.set('path', name) - return e - - def _Element_for_filtered_resources(self, filtered_resources): - """Turn a list of filtered resource arguments like - ['1.0-projectRelativePath-matches-false-false-*org/mozilla/gecko/resources/**'] - into an XML Element, like: - <filteredResources> - <filter> - <id>1393009101322</id> - <name></name> - <type>30</type> - <matcher> - <id>org.eclipse.ui.ide.multiFilter</id> - <arguments>1.0-projectRelativePath-matches-false-false-*org/mozilla/gecko/resources/**</arguments> - </matcher> - </filter> - </filteredResources> - - The id is random; the values are magic.""" - - id = int(1000 * time.time()) - filteredResources = ET.Element('filteredResources') - for arg in sorted(filtered_resources): - e = ET.SubElement(filteredResources, 'filter') - ET.SubElement(e, 'id').text = str(id) - id += 1 - ET.SubElement(e, 'name') - ET.SubElement(e, 'type').text = '30' # It's magic! - matcher = ET.SubElement(e, 'matcher') - ET.SubElement(matcher, 'id').text = 'org.eclipse.ui.ide.multiFilter' - ET.SubElement(matcher, 'arguments').text = str(arg) - return filteredResources - - def _manifest_for_project(self, srcdir, project): - manifest = InstallManifest() - - if project.manifest: - manifest.add_copy(mozpath.join(srcdir, project.manifest), 'AndroidManifest.xml') - - if project.res: - manifest.add_symlink(mozpath.join(srcdir, project.res), 'res') - else: - # Eclipse expects a res directory no matter what, so we - # make an empty directory if the project doesn't specify. - res = os.path.abspath(mozpath.join(os.path.dirname(__file__), - 'templates', 'android_eclipse_empty_resource_directory')) - manifest.add_pattern_copy(res, '.**', 'res') - - if project.assets: - manifest.add_symlink(mozpath.join(srcdir, project.assets), 'assets') - - for cpe in project._classpathentries: - manifest.add_symlink(mozpath.join(srcdir, cpe.srcdir), cpe.dstdir) - - # JARs and native libraries go in the same place. For now, we're adding - # class path entries with the full path to required JAR files (which - # makes sense for JARs in the source directory, but probably doesn't for - # JARs in the object directory). This could be a problem because we only - # know the contents of (a subdirectory of) libs/ after a successful - # build and package, which is after build-backend time. At the cost of - # some flexibility, we explicitly copy certain libraries here; if the - # libraries aren't present -- namely, when the tree hasn't been packaged - # -- this fails. That's by design, to avoid crashes on device caused by - # missing native libraries. - for src, dst in project.libs: - manifest.add_copy(mozpath.join(srcdir, src), dst) - - return manifest - - def _process_android_eclipse_project_data(self, data, srcdir, objdir): - # This can't be relative to the environment's topsrcdir, - # because during testing topsrcdir is faked. - template_directory = os.path.abspath(mozpath.join(os.path.dirname(__file__), - 'templates', 'android_eclipse')) - - project_directory = mozpath.join(self.environment.topobjdir, 'android_eclipse', data.name) - manifest_path = mozpath.join(self.environment.topobjdir, 'android_eclipse', '%s.manifest' % data.name) - - manifest = self._manifest_for_project(srcdir, data) - ensureParentDir(manifest_path) - manifest.write(path=manifest_path) - - classpathentries = [] - for cpe in sorted(data._classpathentries, key=lambda x: x.path): - e = self._Element_for_classpathentry(cpe) - classpathentries.append(ET.tostring(e)) - - for name in sorted(data.referenced_projects): - e = self._Element_for_referenced_project(name) - classpathentries.append(ET.tostring(e)) - - for name in sorted(data.extra_jars): - e = self._Element_for_extra_jar(mozpath.join(srcdir, name)) - classpathentries.append(ET.tostring(e)) - - defines = {} - defines['IDE_OBJDIR'] = objdir - defines['IDE_TOPOBJDIR'] = self.environment.topobjdir - defines['IDE_SRCDIR'] = srcdir - defines['IDE_TOPSRCDIR'] = self.environment.topsrcdir - defines['IDE_PROJECT_NAME'] = data.name - defines['IDE_PACKAGE_NAME'] = data.package_name - defines['IDE_PROJECT_DIRECTORY'] = project_directory - defines['IDE_RELSRCDIR'] = mozpath.relpath(srcdir, self.environment.topsrcdir) - defines['IDE_CLASSPATH_ENTRIES'] = '\n'.join('\t' + cpe for cpe in classpathentries) - defines['IDE_RECURSIVE_MAKE_TARGETS'] = ' '.join(sorted(data.recursive_make_targets)) - # Like android.library=true - defines['IDE_PROJECT_LIBRARY_SETTING'] = 'android.library=true' if data.is_library else '' - # Like android.library.reference.1=FennecBrandingResources - defines['IDE_PROJECT_LIBRARY_REFERENCES'] = '\n'.join( - 'android.library.reference.%s=%s' % (i + 1, ref) - for i, ref in enumerate(sorted(data.included_projects))) - if data.filtered_resources: - filteredResources = self._Element_for_filtered_resources(data.filtered_resources) - defines['IDE_PROJECT_FILTERED_RESOURCES'] = pretty_print(filteredResources).strip() - else: - defines['IDE_PROJECT_FILTERED_RESOURCES'] = '' - defines['ANDROID_TARGET_SDK'] = self.environment.substs['ANDROID_TARGET_SDK'] - defines['MOZ_ANDROID_MIN_SDK_VERSION'] = self.environment.defines['MOZ_ANDROID_MIN_SDK_VERSION'] - - copier = FileCopier() - finder = FileFinder(template_directory) - for input_filename, f in itertools.chain(finder.find('**'), finder.find('.**')): - if input_filename == 'AndroidManifest.xml' and not data.is_library: - # Main projects supply their own manifests. - continue - copier.add(input_filename, PreprocessedFile( - mozpath.join(finder.base, input_filename), - depfile_path=None, - marker='#', - defines=defines, - extra_depends={mozpath.join(finder.base, input_filename)})) - - # When we re-create the build backend, we kill everything that was there. - if os.path.isdir(project_directory): - self._updated_count += 1 - else: - self._created_count += 1 - copier.copy(project_directory, skip_if_older=False, remove_unaccounted=True) diff --git a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.classpath b/python/mozbuild/mozbuild/backend/templates/android_eclipse/.classpath deleted file mode 100644 index 7c51c539cb..0000000000 --- a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.classpath +++ /dev/null @@ -1,10 +0,0 @@ -#filter substitution -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="gen"/> - <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> - <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> - <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> - <classpathentry kind="output" path="bin/classes"/> -@IDE_CLASSPATH_ENTRIES@ -</classpath> diff --git a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/com.android.ide.eclipse.adt.ApkBuilder.launch b/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/com.android.ide.eclipse.adt.ApkBuilder.launch deleted file mode 100644 index 3005dee453..0000000000 --- a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/com.android.ide.eclipse.adt.ApkBuilder.launch +++ /dev/null @@ -1,8 +0,0 @@ -#filter substitution -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> -<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="com.android.ide.eclipse.adt.ApkBuilder"/> -<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/> -<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> -</launchConfiguration> diff --git a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/com.android.ide.eclipse.adt.PreCompilerBuilder.launch b/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/com.android.ide.eclipse.adt.PreCompilerBuilder.launch deleted file mode 100644 index 9fa599f5f3..0000000000 --- a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/com.android.ide.eclipse.adt.PreCompilerBuilder.launch +++ /dev/null @@ -1,8 +0,0 @@ -#filter substitution -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> -<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="com.android.ide.eclipse.adt.PreCompilerBuilder"/> -<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/> -<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> -</launchConfiguration> diff --git a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/com.android.ide.eclipse.adt.ResourceManagerBuilder.launch b/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/com.android.ide.eclipse.adt.ResourceManagerBuilder.launch deleted file mode 100644 index 20d1c3f4e6..0000000000 --- a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/com.android.ide.eclipse.adt.ResourceManagerBuilder.launch +++ /dev/null @@ -1,8 +0,0 @@ -#filter substitution -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> -<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="com.android.ide.eclipse.adt.ResourceManagerBuilder"/> -<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/> -<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> -</launchConfiguration> diff --git a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/org.eclipse.jdt.core.javabuilder.launch b/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/org.eclipse.jdt.core.javabuilder.launch deleted file mode 100644 index ed5bf68850..0000000000 --- a/python/mozbuild/mozbuild/backend/templates/android_eclipse/.externalToolBuilders/org.eclipse.jdt.core.javabuilder.launch +++ /dev/null @@ -1,8 +0,0 @@ -#filter substitution -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> -<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/> -<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.jdt.core.javabuilder"/> -<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/> -<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> -</launchConfiguration> diff --git a/python/mozbuild/mozbuild/backend/templates/android_eclipse/AndroidManifest.xml b/python/mozbuild/mozbuild/backend/templates/android_eclipse/AndroidManifest.xml deleted file mode 100644 index 57d8aca8cb..0000000000 --- a/python/mozbuild/mozbuild/backend/templates/android_eclipse/AndroidManifest.xml +++ /dev/null @@ -1,11 +0,0 @@ -#filter substitution -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="@IDE_PACKAGE_NAME@" - android:versionCode="1" - android:versionName="1.0" > - - <uses-sdk - android:minSdkVersion="@MOZ_ANDROID_MIN_SDK_VERSION@" - android:targetSdkVersion="@ANDROID_TARGET_SDK@" /> - -</manifest> diff --git a/python/mozbuild/mozbuild/backend/templates/android_eclipse/gen/tmp b/python/mozbuild/mozbuild/backend/templates/android_eclipse/gen/tmp deleted file mode 100644 index c1c78936f6..0000000000 --- a/python/mozbuild/mozbuild/backend/templates/android_eclipse/gen/tmp +++ /dev/null @@ -1 +0,0 @@ -#filter substitution diff --git a/python/mozbuild/mozbuild/backend/templates/android_eclipse/lint.xml b/python/mozbuild/mozbuild/backend/templates/android_eclipse/lint.xml deleted file mode 100644 index 43ad15dc95..0000000000 --- a/python/mozbuild/mozbuild/backend/templates/android_eclipse/lint.xml +++ /dev/null @@ -1,5 +0,0 @@ -#filter substitution -<?xml version="1.0" encoding="UTF-8"?> -<lint> - <issue id="NewApi" severity="ignore" /> -</lint> diff --git a/python/mozbuild/mozbuild/backend/templates/android_eclipse/project.properties b/python/mozbuild/mozbuild/backend/templates/android_eclipse/project.properties deleted file mode 100644 index 2106d9646a..0000000000 --- a/python/mozbuild/mozbuild/backend/templates/android_eclipse/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -#filter substitution -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-L -@IDE_PROJECT_LIBRARY_SETTING@ -@IDE_PROJECT_LIBRARY_REFERENCES@ diff --git a/python/mozbuild/mozbuild/backend/templates/android_eclipse_empty_resource_directory/.not_an_android_resource b/python/mozbuild/mozbuild/backend/templates/android_eclipse_empty_resource_directory/.not_an_android_resource deleted file mode 100644 index 8ffce06921..0000000000 --- a/python/mozbuild/mozbuild/backend/templates/android_eclipse_empty_resource_directory/.not_an_android_resource +++ /dev/null @@ -1,5 +0,0 @@ -This file is named such that it is ignored by Android aapt. The file -itself ensures that the AndroidEclipse build backend can create an -empty res/ directory for projects explicitly specifying that it has no -resource directory. This is necessary because the Android Eclipse -plugin requires that each project have a res/ directory. diff --git a/python/mozbuild/mozbuild/mozinfo.py b/python/mozbuild/mozbuild/mozinfo.py index 3bdde249ce..c6c95d9230 100755 --- a/python/mozbuild/mozbuild/mozinfo.py +++ b/python/mozbuild/mozbuild/mozinfo.py @@ -126,9 +126,6 @@ def build_dict(config, env=os.environ): d['platform_guess'] = guess_platform() d['buildtype_guess'] = guess_buildtype() - if 'buildapp' in d and d['buildapp'] == 'mobile/android' and 'MOZ_ANDROID_MIN_SDK_VERSION' in substs: - d['android_min_sdk'] = substs['MOZ_ANDROID_MIN_SDK_VERSION'] - return d |