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

--HG--
extra : rebase_source : 07351f9d3702cfc42c58bd317885d07882c45c3a
This commit is contained in:
Nick Alexander 2018-02-23 11:57:28 -08:00
parent f4f4a41d30
commit b9e726131c
9 changed files with 15 additions and 324 deletions

View File

@ -232,21 +232,9 @@ case "$target" in
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])

View File

@ -12,7 +12,6 @@ GARBAGE += \
res/values/strings.xml \
res/raw/browsersearch.json \
res/raw/suggestedsites.json \
.aapt.deps \
GeneratedJNINatives.h \
GeneratedJNIWrappers.cpp \
GeneratedJNIWrappers.h \
@ -23,6 +22,13 @@ GARBAGE += \
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
@ -31,8 +37,8 @@ $(1): $(2)
$$(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)
@ -42,20 +48,6 @@ FennecJNIWrappers.cpp FennecJNIWrappers.h FennecJNINatives.h: .gradle.deps
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
@ -89,96 +81,18 @@ 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 ;
gecko-nodeps.ap_: .gradle.nodeps
cp $(GRADLE_ANDROID_APP_APK) $@
# 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
# 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
@ -187,9 +101,6 @@ endef
# 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.
@ -197,10 +108,6 @@ $(eval $(call aapt_command,.aapt.deps,$(all_resources),gecko.ap_,generated/,./))
# .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
@ -236,9 +143,7 @@ ifndef MOZILLA_OFFICIAL
# 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.

View File

@ -204,43 +204,6 @@ 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')
@ -1030,7 +993,6 @@ gbjar.extra_jars += [
]
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 [
@ -1094,23 +1056,15 @@ if CONFIG['MOZ_NATIVE_DEVICES']:
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']:
@ -1122,25 +1076,11 @@ if CONFIG['MOZ_ANDROID_GCM']:
]
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'],
@ -1148,13 +1088,9 @@ if CONFIG['MOZ_INSTALL_TRACKING']:
]
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']]
@ -1376,36 +1312,6 @@ if CONFIG['MOZ_ANDROID_MMA']:
'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']

View File

@ -86,11 +86,6 @@ 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',
@ -675,26 +670,6 @@ class RecursiveMakeBackend(CommonBackend):
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)

View File

@ -1206,45 +1206,6 @@ SUBCONTEXTS = {cls.__name__: cls for cls in SUBCONTEXTS}
# (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.

View File

@ -1054,7 +1054,6 @@ class TreeMetadataEmitter(LoggingMixin):
# desired abstraction of the build definition away from makefiles.
passthru = VariablePassthru(context)
varlist = [
'ANDROID_GENERATED_RESFILES',
'EXTRA_DSO_LDOPTS',
'RCFILE',
'RESFILE',
@ -1338,24 +1337,6 @@ class TreeMetadataEmitter(LoggingMixin):
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

View File

@ -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',
]

View File

@ -1548,22 +1548,6 @@ class TestEmitterBasic(unittest.TestCase):
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')