Bug 1440757 - Don't invoke aapt in mobile/android/base/Makefile.in. r=jchen draft
authorNick Alexander <nalexander@mozilla.com>
Fri, 23 Feb 2018 11:57:28 -0800
changeset 759908 07351f9d3702cfc42c58bd317885d07882c45c3a
parent 759907 b1d9db226e5d426bc29f7d382c787a4b73ca34ff
child 759909 18140174feb89addd28251eb7513ea51f878f517
push id100507
push usernalexander@mozilla.com
push dateMon, 26 Feb 2018 19:51:29 +0000
reviewersjchen
bugs1440757
milestone60.0a1
Bug 1440757 - Don't invoke aapt in mobile/android/base/Makefile.in. r=jchen I choose to clean a bunch of ANDROID_* moz.build cruft here, too, since it's just passing dependencies between moz.build and Makefile.in. The replacement for all of this is to just use GENERATED_FILES in moz.build, but it'll still take some work to get to that. (Why does this stuff exist? GENERATED_FILES didn't exist and was resisted when I built this stuff.) MozReview-Commit-ID: D3GJqJNL0Ih
build/autoconf/android.m4
mobile/android/base/Makefile.in
mobile/android/base/moz.build
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/frontend/context.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/test/frontend/data/android-res-dirs/dir1/foo
python/mozbuild/mozbuild/test/frontend/data/android-res-dirs/moz.build
python/mozbuild/mozbuild/test/frontend/test_emitter.py
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -227,31 +227,19 @@ case "$target" in
         fi
     done
     if test "$android_build_tools_version" = ""; then
         version=$(echo $3 | cut -d" " -f1)
         AC_MSG_ERROR([You must install the Android build-tools version $version.  Try |mach bootstrap|.  (Looked for "$android_build_tools_base"/$version)])
     fi
 
     MOZ_PATH_PROG(ZIPALIGN, zipalign, :, [$android_build_tools])
-    MOZ_PATH_PROG(DX, dx, :, [$android_build_tools])
-    MOZ_PATH_PROG(AAPT, aapt, :, [$android_build_tools])
-    MOZ_PATH_PROG(AIDL, aidl, :, [$android_build_tools])
     if test -z "$ZIPALIGN" -o "$ZIPALIGN" = ":"; then
       AC_MSG_ERROR([The program zipalign was not found.  Try |mach bootstrap|.])
     fi
-    if test -z "$DX" -o "$DX" = ":"; then
-      AC_MSG_ERROR([The program dx was not found.  Try |mach bootstrap|.])
-    fi
-    if test -z "$AAPT" -o "$AAPT" = ":"; then
-      AC_MSG_ERROR([The program aapt was not found.  Try |mach bootstrap|.])
-    fi
-    if test -z "$AIDL" -o "$AIDL" = ":"; then
-      AC_MSG_ERROR([The program aidl was not found.  Try |mach bootstrap|.])
-    fi
 
     android_platform_tools="$android_sdk_root"/platform-tools
     AC_MSG_CHECKING([for Android platform-tools])
     if test -d "$android_platform_tools" -a -f "$android_platform_tools/adb"; then
         AC_MSG_RESULT([$android_platform_tools])
     else
         AC_MSG_ERROR([You must install the Android platform-tools.  Try |mach bootstrap|.  (Looked for $android_platform_tools)])
     fi
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -7,60 +7,52 @@
 .NOTPARALLEL:
 
 GARBAGE += \
   classes.dex  \
   gecko.ap_  \
   res/values/strings.xml \
   res/raw/browsersearch.json \
   res/raw/suggestedsites.json \
-  .aapt.deps \
   GeneratedJNINatives.h \
   GeneratedJNIWrappers.cpp \
   GeneratedJNIWrappers.h \
   FennecJNINatives.h \
   FennecJNIWrappers.cpp \
   FennecJNIWrappers.h \
   $(NULL)
 
 GARBAGE_DIRS += classes db jars res sync services generated
 
+generated_resources := \
+  AndroidManifest.xml \
+  res/raw/browsersearch.json \
+  res/raw/suggestedsites.json \
+  res/values/strings.xml \
+  $(NULL)
+
 gradle_dir := $(topobjdir)/gradle/build/mobile/android
 
 define gradle_command
 $(1): $(2)
 	@$$(TOUCH) $$@
 	$$(topsrcdir)/mach android assemble-app
 endef
 
-# .gradle.deps: .aapt.deps FORCE
-$(eval $(call gradle_command,.gradle.deps,.aapt.deps FORCE))
+# .gradle.deps: $(generated_resources) $(constants_PP_JAVAFILES) FORCE
+$(eval $(call gradle_command,.gradle.deps,$(generated_resources) $(constants_PP_JAVAFILES) FORCE))
 
 GeneratedJNIWrappers.cpp GeneratedJNIWrappers.h GeneratedJNINatives.h : .gradle.deps
 	$(REPORT_BUILD)
 
 FennecJNIWrappers.cpp FennecJNIWrappers.h FennecJNINatives.h: .gradle.deps
 	$(REPORT_BUILD)
 
 include $(topsrcdir)/config/rules.mk
 
-not_android_res_files := \
-  *.mkdir.done* \
-  *.DS_Store* \
-  *\#* \
-  *.rej \
-  *.orig \
-  $(NULL)
-
-# This uses the fact that Android resource directories list all
-# resource files one subdirectory below the parent resource directory.
-android_res_files := $(filter-out $(not_android_res_files),$(wildcard $(addsuffix /*,$(wildcard $(addsuffix /*,$(ANDROID_RES_DIRS))))))
-
-$(ANDROID_GENERATED_RESFILES): $(call mkdir_deps,$(sort $(dir $(ANDROID_GENERATED_RESFILES))))
-
 # [Comment 1/3] We don't have correct dependencies for strings.xml at
 # this point, so we always recursively invoke the submake to check the
 # dependencies.  Sigh.  And, with multilocale builds, there will be
 # multiple strings.xml files, and we need to rebuild gecko.ap_ if any
 # of them change.  But!  mobile/android/base/locales does not have
 # enough information to actually build res/values/strings.xml during a
 # language repack.  So rather than adding rules into the main
 # makefile, and trying to work around the lack of information, we
@@ -84,128 +76,43 @@ android_res_files := $(filter-out $(not_
 # invocation generates strings.xml, browsersearch.json, and
 # suggestedsites.json. The trailing semi-colon defines an empty
 # recipe: defining no recipe at all causes Make to treat the target
 # differently, in a way that defeats our dependencies.
 res/values/strings.xml: .locales.deps ;
 res/raw/browsersearch.json: .locales.deps ;
 res/raw/suggestedsites.json: .locales.deps ;
 
-all_resources = \
-  AndroidManifest.xml \
-  $(android_res_files) \
-  $(ANDROID_GENERATED_RESFILES) \
-  $(NULL)
-
-# All of generated/org/mozilla/gecko/R.java, gecko.ap_, and R.txt are
-# produced by aapt; this saves aapt invocations.  The trailing
-# semi-colon defines an empty recipe; defining no recipe at all causes
-# Make to treat the target differently, in a way that defeats our
-# dependencies.
-
-generated/org/mozilla/gecko/R.java: .aapt.deps ;
-
-# Only add libraries that contain resources here. We (unecessarily) generate an identical R.java which
-# is copied into each of these locations, and each of these files contains thousands of fields.
-# Each unnecessary copy therefore wastes unnecessary fields in the output dex file.
-# Note: usually proguard will help clean this up after the fact, but having too many fields will cause
-# dexing to fail, regardless of any later optimisations proguard could later make to bring us back
-# under the limit.
-# Ideally we would fix our aapt invocations to correctly generate minimal copies of R.java for each
-# package, but that seems redundant since gradle builds are able to correctly generate these files.
-
-# If native devices are enabled, add Google Play Services, build their resources
-# (no resources) generated/android/support/v4/R.java: .aapt.deps ;
-generated/android/support/v7/appcompat/R.java: .aapt.deps ;
-# (no resources) generated/android/support/graphics/drawable/animated/R.java: .aapt.deps ;
-# (no resources) generated/android/support/graphics/drawable/R.java: .aapt.deps ;
-generated/android/support/v7/cardview/R.java: .aapt.deps ;
-generated/android/support/design/R.java: .aapt.deps ;
-generated/android/support/v7/mediarouter/R.java: .aapt.deps ;
-generated/android/support/v7/recyclerview/R.java: .aapt.deps ;
-# (no resources) generated/android/support/customtabs/R.java: .aapt.deps ;
-# (no resources) generated/android/support/v7/palette/R.java: .aapt.deps ;
-generated/com/google/android/gms/R.java: .aapt.deps ;
-generated/com/google/android/gms/ads/R.java: .aapt.deps ;
-generated/com/google/android/gms/base/R.java: .aapt.deps ;
-generated/com/google/android/gms/cast/R.java: .aapt.deps ;
-# (no resources) generated/com/google/android/gms/gcm/R.java: .aapt.deps ;
-# (no resources) generated/com/google/android/gms/measurement/R.java: .aapt.deps ;
-
-gecko.ap_: .aapt.deps ;
-R.txt: .aapt.deps ;
+gecko.ap_: .gradle.deps ;
+R.txt: .gradle.deps ;
 
 # [Comment 2/3] This tom-foolery provides a target that forces a
 # rebuild of gecko.ap_.  This is used during packaging to ensure that
 # resources are fresh.  The alternative would be complicated; see
 # [Comment 1/3].
 
-gecko-nodeps/R.java: .aapt.nodeps ;
-gecko-nodeps.ap_: .aapt.nodeps ;
-gecko-nodeps/R.txt: .aapt.nodeps ;
-
-# This ignores the default set of resources ignored by aapt, plus
-# files starting with '#'.  (Emacs produces temp files named #temp#.)
-# This doesn't actually set the environment variable; it's used as a
-# parameter in the aapt invocation below.  Consider updating
-# not_android_res_files as well.
-
-ANDROID_AAPT_IGNORE := !.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~:\#*:*.rej:*.orig
+gecko-nodeps.ap_: .gradle.nodeps
+	cp $(GRADLE_ANDROID_APP_APK) $@
 
-# 1: target file.
-# 2: dependencies.
-# 3: name of ap_ file to write.
-# 4: directory to write R.java into.
-# 5: directory to write R.txt into.
-# We touch the target file before invoking aapt so that aapt's outputs
-# are fresher than the target, preventing a subsequent invocation from
-# thinking aapt's outputs are stale.  This is safe because Make
-# removes the target file if any recipe command fails.
-
-define aapt_command
-$(1): $$(call mkdir_deps,$(filter-out ./,$(dir $(3) $(4) $(5)))) $(2)
-	@$$(TOUCH) $$@
-	$$(AAPT) package -f -m \
-		-M AndroidManifest.xml \
-		-I $(ANDROID_SDK)/android.jar \
-		$(if $(MOZ_ANDROID_MAX_SDK_VERSION),--max-res-version $(MOZ_ANDROID_MAX_SDK_VERSION),) \
-		--auto-add-overlay \
-		$$(addprefix -S ,$$(ANDROID_RES_DIRS)) \
-		$$(addprefix -A ,$$(ANDROID_ASSETS_DIRS)) \
-		$(if $(ANDROID_EXTRA_PACKAGES),--extra-packages $$(subst $$(NULL) ,:,$$(strip $$(ANDROID_EXTRA_PACKAGES)))) \
-		$(if $(ANDROID_EXTRA_RES_DIRS),$$(addprefix -S ,$$(ANDROID_EXTRA_RES_DIRS))) \
-		--custom-package org.mozilla.gecko \
-		--no-version-vectors \
-		-F $(3) \
-		-J $(4) \
-		--output-text-symbols $(5) \
-		--ignore-assets "$$(ANDROID_AAPT_IGNORE)"
-endef
+gecko-nodeps/R.txt: .gradle.nodeps ;
 
 # [Comment 3/3] The first of these rules is used during regular
 # builds.  The second writes an ap_ file that is only used during
 # packaging.  It doesn't write the normal ap_, or R.java, since we
 # don't want the packaging step to write anything that would make a
 # further no-op build do work.  See also
 # toolkit/mozapps/installer/packager.mk.
 
-# .aapt.deps: $(all_resources)
-$(eval $(call aapt_command,.aapt.deps,$(all_resources),gecko.ap_,generated/,./))
-
 # It's not quite "no dependencies": nodeps means that it doesn't
 # depend on the generated resources that incorporate l10n, principally
 # strings.xml.
 
 # .gradle.nodeps: AndroidManifest.xml generated/preprocessed/org/mozilla/gecko/AppConstants.java ... FORCE
 $(eval $(call gradle_command,.gradle.nodeps,AndroidManifest.xml $(constants_PP_JAVAFILES) FORCE))
 
-.aapt.nodeps: .gradle.nodeps FORCE
-	@$(TOUCH) $@
-	cp $(GRADLE_ANDROID_APP_APK) gecko-nodeps.ap_
-
 # Override the Java settings with some specific android settings
 include $(topsrcdir)/config/android-common.mk
 
 update-generated-wrappers:
 	@cp $(CURDIR)/GeneratedJNIWrappers.cpp \
 	    $(CURDIR)/GeneratedJNIWrappers.h \
 	    $(CURDIR)/GeneratedJNINatives.h $(topsrcdir)/widget/android
 	@echo Updated generated JNI code
@@ -231,19 +138,17 @@ update-fennec-wrappers:
 	rsync --update $(DIST)/fennec/$(notdir $(OMNIJAR_NAME)) $@
 	$(RM) $(DIST)/fennec/$(notdir $(OMNIJAR_NAME))
 
 ifndef MOZILLA_OFFICIAL
 # Targets built very early during a Gradle build.  In automation,
 # these are built before Gradle is invoked by .gradle.deps and
 # gradle-targets is not made at all.  This is required to avoid
 # building gradle-targets with AB_CD=multi during multi-l10n builds.
-gradle-targets: $(foreach f,$(constants_PP_JAVAFILES),$(f))
-gradle-targets: AndroidManifest.xml
-gradle-targets: $(ANDROID_GENERATED_RESFILES)
+gradle-targets: $(generated_resources) $(constants_PP_JAVAFILES)
 
 # Local developers update omni.ja during their builds.  There's a
 # chicken-and-egg problem here.
 gradle-omnijar: $(abspath $(DIST)/fennec/$(OMNIJAR_NAME))
 else
 # In automation, omni.ja is built only during packaging.
 gradle-omnijar:
 
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -199,53 +199,16 @@ else:
     ]]
 
 resjar = add_java_jar('gecko-R')
 resjar.sources = []
 resjar.generated_sources += [
     'generated/org/mozilla/gecko/R.java',
 ]
 
-if CONFIG['ANDROID_SUPPORT_V4_AAR']:
-    ANDROID_EXTRA_PACKAGES += ['android.support.v4']
-    ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_SUPPORT_V4_AAR_RES']]
-# (no resources) resjar.generated_sources += ['generated/android/support/v4/R.java']
-if CONFIG['ANDROID_APPCOMPAT_V7_AAR']:
-    ANDROID_EXTRA_PACKAGES += ['android.support.v7.appcompat']
-    ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_APPCOMPAT_V7_AAR_RES']]
-    resjar.generated_sources += ['generated/android/support/v7/appcompat/R.java']
-if CONFIG['ANDROID_SUPPORT_VECTOR_DRAWABLE_AAR']:
-    ANDROID_EXTRA_PACKAGES += ['android.support.graphics.drawable']
-    ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_SUPPORT_VECTOR_DRAWABLE_AAR_RES']]
-# (no reosurces) resjar.generated_sources += ['generated/android/support/graphics/drawable/R.java']
-if CONFIG['ANDROID_ANIMATED_VECTOR_DRAWABLE_AAR']:
-    ANDROID_EXTRA_PACKAGES += ['android.support.graphics.drawable.animated']
-    ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_ANIMATED_VECTOR_DRAWABLE_AAR_RES']]
-# (no resources) resjar.generated_sources += ['generated/android/support/graphics/drawable/animated/R.java']
-if CONFIG['ANDROID_CARDVIEW_V7_AAR']:
-    ANDROID_EXTRA_PACKAGES += ['android.support.v7.cardview']
-    ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_CARDVIEW_V7_AAR_RES']]
-    resjar.generated_sources += ['generated/android/support/v7/cardview/R.java']
-if CONFIG['ANDROID_DESIGN_AAR']:
-    ANDROID_EXTRA_PACKAGES += ['android.support.design']
-    ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_DESIGN_AAR_RES']]
-    resjar.generated_sources += ['generated/android/support/design/R.java']
-if CONFIG['ANDROID_RECYCLERVIEW_V7_AAR']:
-    ANDROID_EXTRA_PACKAGES += ['android.support.v7.recyclerview']
-    ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_RES']]
-    resjar.generated_sources += ['generated/android/support/v7/recyclerview/R.java']
-if CONFIG['ANDROID_CUSTOMTABS_AAR']:
-    ANDROID_EXTRA_PACKAGES += ['android.support.customtabs']
-    ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_CUSTOMTABS_AAR_RES']]
-# (no resources) resjar.generated_sources += ['generated/android/support/customtabs/R.java']
-if CONFIG['ANDROID_PALETTE_V7_AAR']:
-    ANDROID_EXTRA_PACKAGES += ['android.support.v7.palette']
-    ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PALETTE_V7_AAR_RES']]
-# (no resources) resjar.generated_sources += ['generated/android/support/v7/palette/R.java']
-
 resjar.javac_flags += ['-Xlint:all']
 
 mgjar = add_java_jar('gecko-mozglue')
 mgjar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x for x in [
     'mozglue/ByteBufferInputStream.java',
     'mozglue/DirectBufferAllocator.java',
     'mozglue/GeckoLoader.java',
     'mozglue/JNIObject.java',
@@ -1025,17 +988,16 @@ gbjar.generated_sources = [] # Keep it t
 gbjar.extra_jars += [
     CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
     CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
     'constants.jar',
 ]
 if CONFIG['MOZ_CRASHREPORTER']:
     gbjar.sources += [ 'java/org/mozilla/gecko/CrashReporter.java' ]
-    ANDROID_RES_DIRS += [ 'crashreporter/res' ]
 
 if CONFIG['MOZ_ANDROID_GCM']:
     gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
         'gcm/GcmInstanceIDListenerService.java',
         'gcm/GcmMessageListenerService.java',
         'gcm/GcmTokenClient.java',
         'push/Fetched.java',
         'push/PushClient.java',
@@ -1089,77 +1051,51 @@ moz_native_devices_sources = ['java/org/
     'PresentationMediaPlayerManager.java',
     'RemotePresentationService.java',
 ]]
 if CONFIG['MOZ_NATIVE_DEVICES']:
     gbjar.extra_jars += moz_native_devices_jars
     gbjar.sources += moz_native_devices_sources
 
     if CONFIG['ANDROID_MEDIAROUTER_V7_AAR']:
-        ANDROID_EXTRA_PACKAGES += ['android.support.v7.mediarouter']
-        ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_MEDIAROUTER_V7_AAR_RES']]
         resjar.generated_sources += ['generated/android/support/v7/mediarouter/R.java']
 
     if CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR']:
-        ANDROID_EXTRA_PACKAGES += ['com.google.android.gms.base']
-        ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR_RES']]
         resjar.generated_sources += ['generated/com/google/android/gms/base/R.java']
 
     if CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR']:
-        ANDROID_EXTRA_PACKAGES += ['com.google.android.gms']
-        ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR_RES']]
         resjar.generated_sources += ['generated/com/google/android/gms/R.java']
 
     if CONFIG['ANDROID_PLAY_SERVICES_CAST_AAR']:
-        ANDROID_EXTRA_PACKAGES += ['com.google.android.gms.cast']
-        ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_CAST_AAR_RES']]
         resjar.generated_sources += ['generated/com/google/android/gms/cast/R.java']
 
 if CONFIG['MOZ_ANDROID_GCM']:
     gbjar.extra_jars += [
         CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR_LIB'],
         CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB'],
         CONFIG['ANDROID_PLAY_SERVICES_GCM_AAR_LIB'],
         CONFIG['ANDROID_PLAY_SERVICES_MEASUREMENT_AAR_LIB'],
     ]
 
     if CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR']:
-        ANDROID_EXTRA_PACKAGES += ['com.google.android.gms']
-        ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR_RES']]
         resjar.generated_sources += ['generated/com/google/android/gms/R.java']
 
     if CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR']:
-        ANDROID_EXTRA_PACKAGES += ['com.google.android.gms']
-        ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR_RES']]
         resjar.generated_sources += ['generated/com/google/android/gms/R.java']
 
-    if CONFIG['ANDROID_PLAY_SERVICES_GCM_AAR']:
-        ANDROID_EXTRA_PACKAGES += ['com.google.android.gms.gcm']
-        ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_GCM_AAR_RES']]
-# (no resources) resjar.generated_sources += ['generated/com/google/android/gms/gcm/R.java']
-
-    if CONFIG['ANDROID_PLAY_SERVICES_MEASUREMENT_AAR']:
-        ANDROID_EXTRA_PACKAGES += ['com.google.android.gms.measurement']
-        ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_MEASUREMENT_AAR_RES']]
-# (no resources) resjar.generated_sources += ['generated/android/support/v7/palette/R.java']
-
 if CONFIG['MOZ_INSTALL_TRACKING']:
     gbjar.extra_jars += [
         CONFIG['ANDROID_PLAY_SERVICES_ADS_AAR_LIB'],
         CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB'],
     ]
 
     if CONFIG['ANDROID_PLAY_SERVICES_ADS_AAR']:
-        ANDROID_EXTRA_PACKAGES += ['com.google.android.gms.ads']
-        ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_ADS_AAR_RES']]
         resjar.generated_sources += ['generated/com/google/android/gms/ads/R.java']
 
     if CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR']:
-        ANDROID_EXTRA_PACKAGES += ['com.google.android.gms']
-        ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR_RES']]
         resjar.generated_sources += ['generated/com/google/android/gms/R.java']
 
 gbjar.extra_jars += [CONFIG['ANDROID_APPCOMPAT_V7_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_SUPPORT_VECTOR_DRAWABLE_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_ANIMATED_VECTOR_DRAWABLE_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_CARDVIEW_V7_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_DESIGN_AAR_LIB']]
 gbjar.extra_jars += [CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_LIB']]
@@ -1371,46 +1307,16 @@ if CONFIG['MOZ_ANDROID_MMA']:
         CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR_LIB'],
         CONFIG['ANDROID_PLAY_SERVICES_GCM_AAR_LIB'],
         CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
         CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
         CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
         'sync-thirdparty.jar',
     ]
 
-# Putting branding earlier allows branders to override default resources.
-ANDROID_RES_DIRS += [
-    '/' + CONFIG['MOZ_BRANDING_DIRECTORY'] + '/res',
-]
-
-ANDROID_RES_DIRS += [
-    '/mobile/android/app/src/photon/res',
-]
-
-ANDROID_RES_DIRS += [
-    '/mobile/android/app/src/main/res',
-    '/mobile/android/services/src/main/res',
-    '!res',
-]
-
-ANDROID_GENERATED_RESFILES += [
-    'res/raw/browsersearch.json',
-    'res/raw/suggestedsites.json',
-    'res/values/strings.xml',
-]
-
-ANDROID_ASSETS_DIRS += [
-    '/mobile/android/app/src/main/assets',
-]
-
-if CONFIG['MOZ_ANDROID_DISTRIBUTION_DIRECTORY']:
-    ANDROID_ASSETS_DIRS += [
-        '%' + CONFIG['MOZ_ANDROID_DISTRIBUTION_DIRECTORY'] + '/assets',
-    ]
-
 DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME']
 FINAL_TARGET_PP_FILES += ['package-name.txt.in']
 
 gvjar.sources += ['generated/org/mozilla/gecko/' + x for x in [
     'gfx/ISurfaceAllocator.java',
     'IGeckoEditableChild.java',
     'IGeckoEditableParent.java',
     'media/ICodec.java',
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -81,21 +81,16 @@ from ..util import (
     ensureParentDir,
     FileAvoidWrite,
     OrderedDefaultDict,
 )
 from ..makeutil import Makefile
 from mozbuild.shellutil import quote as shell_quote
 
 MOZBUILD_VARIABLES = [
-    b'ANDROID_ASSETS_DIRS',
-    b'ANDROID_EXTRA_PACKAGES',
-    b'ANDROID_EXTRA_RES_DIRS',
-    b'ANDROID_GENERATED_RESFILES',
-    b'ANDROID_RES_DIRS',
     b'ASFLAGS',
     b'CMSRCS',
     b'CMMSRCS',
     b'CPP_UNIT_TESTS',
     b'DIRS',
     b'DIST_INSTALL',
     b'EXTRA_DSO_LDOPTS',
     b'EXTRA_JS_MODULES',
@@ -670,36 +665,16 @@ class RecursiveMakeBackend(CommonBackend
             self._process_localized_pp_files(obj, obj.files, backend_file)
 
         elif isinstance(obj, FinalTargetFiles):
             self._process_final_target_files(obj, obj.files, backend_file)
 
         elif isinstance(obj, FinalTargetPreprocessedFiles):
             self._process_final_target_pp_files(obj, obj.files, backend_file, 'DIST_FILES')
 
-        elif isinstance(obj, AndroidResDirs):
-            # Order matters.
-            for p in obj.paths:
-                backend_file.write('ANDROID_RES_DIRS += %s\n' % p.full_path)
-
-        elif isinstance(obj, AndroidAssetsDirs):
-            # Order matters.
-            for p in obj.paths:
-                backend_file.write('ANDROID_ASSETS_DIRS += %s\n' % p.full_path)
-
-        elif isinstance(obj, AndroidExtraResDirs):
-            # Order does not matter.
-            for p in sorted(set(p.full_path for p in obj.paths)):
-                backend_file.write('ANDROID_EXTRA_RES_DIRS += %s\n' % p)
-
-        elif isinstance(obj, AndroidExtraPackages):
-            # Order does not matter.
-            for p in sorted(set(obj.packages)):
-                backend_file.write('ANDROID_EXTRA_PACKAGES += %s\n' % p)
-
         elif isinstance(obj, ChromeManifestEntry):
             self._process_chrome_manifest_entry(obj, backend_file)
 
         elif isinstance(obj, TestManifest):
             self._process_test_manifest(obj, backend_file)
 
         else:
             return False
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -1201,55 +1201,16 @@ SUBCONTEXTS = {cls.__name__: cls for cls
 
 # This defines the set of mutable global variables.
 #
 # Each variable is a tuple of:
 #
 #   (storage_type, input_types, docs)
 
 VARIABLES = {
-    # Variables controlling reading of other frontend files.
-    'ANDROID_GENERATED_RESFILES': (StrictOrderingOnAppendList, list,
-        """Android resource files generated as part of the build.
-
-        This variable contains a list of files that are expected to be
-        generated (often by preprocessing) into a 'res' directory as
-        part of the build process, and subsequently merged into an APK
-        file.
-        """),
-
-    'ANDROID_EXTRA_PACKAGES': (StrictOrderingOnAppendList, list,
-        """The name of extra Android packages to generate R.java for, like ['org.mozilla.other'].
-        """),
-
-    'ANDROID_EXTRA_RES_DIRS': (ContextDerivedTypedListWithItems(Path, List), list,
-        """Android extra package resource directories.
-
-        This variable contains a list of directories containing static files
-        to package into a 'res' directory and merge into an APK file.  These
-        directories are packaged into the APK but are assumed to be static
-        unchecked dependencies that should not be otherwise re-distributed.
-        """),
-
-    'ANDROID_RES_DIRS': (ContextDerivedTypedListWithItems(Path, List), list,
-        """Android resource directories.
-
-        This variable contains a list of directories containing static
-        files to package into a 'res' directory and merge into an APK
-        file.
-        """),
-
-    'ANDROID_ASSETS_DIRS': (ContextDerivedTypedListWithItems(Path, List), list,
-        """Android assets directories.
-
-        This variable contains a list of directories containing static
-        files to package into an 'assets' directory and merge into an
-        APK file.
-        """),
-
     'SOURCES': (ContextDerivedTypedListWithItems(Path, StrictOrderingOnAppendListWithFlagsFactory({'no_pgo': bool, 'flags': List})), list,
         """Source code files.
 
         This variable contains a list of source code files to compile.
         Accepts assembler, C, C++, Objective C/C++.
         """),
 
     'FILES_PER_UNIFIED_FILE': (int, int,
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -1049,17 +1049,16 @@ class TreeMetadataEmitter(LoggingMixin):
         computed_host_flags = ComputedFlags(context, context['HOST_COMPILE_FLAGS'])
         computed_as_flags = ComputedFlags(context, context['ASM_FLAGS'])
 
         # Proxy some variables as-is until we have richer classes to represent
         # them. We should aim to keep this set small because it violates the
         # desired abstraction of the build definition away from makefiles.
         passthru = VariablePassthru(context)
         varlist = [
-            'ANDROID_GENERATED_RESFILES',
             'EXTRA_DSO_LDOPTS',
             'RCFILE',
             'RESFILE',
             'RCINCLUDE',
             'DEFFILE',
             'WIN32_EXE_LDFLAGS',
             'USE_EXTENSION_MANIFEST',
             'NO_JS_MANIFEST',
@@ -1333,34 +1332,16 @@ class TreeMetadataEmitter(LoggingMixin):
             if not yasm:
                 raise SandboxValidationError('yasm is not available', context)
             passthru.variables['AS'] = yasm
             passthru.variables['AS_DASH_C_FLAG'] = ''
             computed_as_flags.resolve_flags('OS',
                                             context.config.substs.get('YASM_ASFLAGS', []))
 
 
-        for (symbol, cls) in [
-                ('ANDROID_RES_DIRS', AndroidResDirs),
-                ('ANDROID_EXTRA_RES_DIRS', AndroidExtraResDirs),
-                ('ANDROID_ASSETS_DIRS', AndroidAssetsDirs)]:
-            paths = context.get(symbol)
-            if not paths:
-                continue
-            for p in paths:
-                if isinstance(p, SourcePath) and not os.path.isdir(p.full_path):
-                    raise SandboxValidationError('Directory listed in '
-                        '%s is not a directory: \'%s\'' %
-                            (symbol, p.full_path), context)
-            yield cls(context, paths)
-
-        android_extra_packages = context.get('ANDROID_EXTRA_PACKAGES')
-        if android_extra_packages:
-            yield AndroidExtraPackages(context, android_extra_packages)
-
         if passthru.variables:
             yield passthru
 
         if context.objdir in self._compile_dirs:
             self._compile_flags[context.objdir] = computed_flags
             yield computed_link_flags
         elif context.objdir in self._rust_compile_dirs:
             yield computed_link_flags
deleted file mode 100644
deleted file mode 100644
--- a/python/mozbuild/mozbuild/test/frontend/data/android-res-dirs/moz.build
+++ /dev/null
@@ -1,9 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# Any copyright is dedicated to the Public Domain.
-# http://creativecommons.org/publicdomain/zero/1.0/
-
-ANDROID_RES_DIRS += [
-    '/dir1',
-    '!/dir2',
-    '%/dir3',
-]
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -1543,32 +1543,16 @@ class TestEmitterBasic(unittest.TestCase
         reader = self.reader('crate-dependency-path-resolution',
                              extra_substs=dict(RUST_TARGET='i686-pc-windows-msvc'))
         objs = self.read_topsrcdir(reader)
 
         ldflags, lib = objs
         self.assertIsInstance(ldflags, ComputedFlags)
         self.assertIsInstance(lib, RustLibrary)
 
-    def test_android_res_dirs(self):
-        """Test that ANDROID_RES_DIRS works properly."""
-        reader = self.reader('android-res-dirs')
-        objs = self.read_topsrcdir(reader)
-
-        self.assertEqual(len(objs), 1)
-        self.assertIsInstance(objs[0], AndroidResDirs)
-
-        # Android resource directories are ordered.
-        expected = [
-            mozpath.join(reader.config.topsrcdir, 'dir1'),
-            mozpath.join(reader.config.topobjdir, 'dir2'),
-            '/dir3',
-        ]
-        self.assertEquals([p.full_path for p in objs[0].paths], expected)
-
     def test_install_shared_lib(self):
         """Test that we can install a shared library with TEST_HARNESS_FILES"""
         reader = self.reader('test-install-shared-lib')
         objs = self.read_topsrcdir(reader)
         self.assertIsInstance(objs[0], TestHarnessFiles)
         self.assertIsInstance(objs[1], VariablePassthru)
         self.assertIsInstance(objs[2], ComputedFlags)
         self.assertIsInstance(objs[3], SharedLibrary)