--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -85,104 +85,16 @@ if test "$OS_TARGET" = "Android"; then
done
fi
fi
AC_SUBST_LIST([STLPORT_LIBS])
])
-AC_DEFUN([concat],[$1$2$3$4])
-
-dnl Find a component of an AAR.
-dnl Arg 1: variable name to expose, like ANDROID_SUPPORT_V4_LIB.
-dnl Arg 2: path to component.
-dnl Arg 3: if non-empty, expect and require component.
-AC_DEFUN([MOZ_ANDROID_AAR_COMPONENT], [
- ifelse([$3], ,
- [
- if test -e "$$1" ; then
- AC_MSG_ERROR([Found unexpected exploded $1!])
- fi
- ],
- [
- AC_MSG_CHECKING([for $1])
- $1="$2"
- if ! test -e "$$1" ; then
- AC_MSG_ERROR([Could not find required exploded $1!])
- fi
- AC_MSG_RESULT([$$1])
- AC_SUBST($1)
- ])
-])
-
-dnl Find an AAR and expose variables representing its exploded components.
-dnl AC_SUBSTs ANDROID_NAME_{AAR,AAR_RES,AAR_LIB,AAR_INTERNAL_LIB}.
-dnl Arg 1: name, like play-services-base
-dnl Arg 2: version, like 7.8.0
-dnl Arg 3: extras subdirectory, either android or google
-dnl Arg 4: package subdirectory, like com/google/android/gms
-dnl Arg 5: if non-empty, expect and require internal_impl JAR.
-dnl Arg 6: if non-empty, expect and require assets/ directory.
-AC_DEFUN([MOZ_ANDROID_AAR],[
- define([local_aar_var_base], translit($1, [-a-z], [_A-Z]))
- define([local_aar_var], concat(ANDROID_, local_aar_var_base, _AAR))
- local_aar_var="$ANDROID_SDK_ROOT/extras/$3/m2repository/$4/$1/$2/$1-$2.aar"
- AC_MSG_CHECKING([for $1 AAR])
- if ! test -e "$local_aar_var" ; then
- AC_MSG_ERROR([You must download the $1 AAR. Run the Android SDK tool and install the Android and Google Support Repositories under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (Looked for $local_aar_var)])
- fi
- AC_SUBST(local_aar_var)
- AC_MSG_RESULT([$local_aar_var])
-
- if ! $PYTHON -m mozbuild.action.explode_aar --destdir=$MOZ_BUILD_ROOT/dist/exploded-aar $local_aar_var ; then
- AC_MSG_ERROR([Could not explode $local_aar_var!])
- fi
-
- define([root], $MOZ_BUILD_ROOT/dist/exploded-aar/$1-$2/)
- MOZ_ANDROID_AAR_COMPONENT(concat(local_aar_var, _LIB), concat(root, $1-$2-classes.jar), REQUIRED)
- MOZ_ANDROID_AAR_COMPONENT(concat(local_aar_var, _RES), concat(root, res), REQUIRED)
- MOZ_ANDROID_AAR_COMPONENT(concat(local_aar_var, _INTERNAL_LIB), concat(root, libs/$1-$2-internal_impl-$2.jar), $5)
- MOZ_ANDROID_AAR_COMPONENT(concat(local_aar_var, _ASSETS), concat(root, assets), $6)
-])
-
-AC_DEFUN([MOZ_ANDROID_GOOGLE_PLAY_SERVICES],
-[
-
-if test -n "$MOZ_NATIVE_DEVICES" ; then
- MOZ_ANDROID_AAR(play-services-base, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
- MOZ_ANDROID_AAR(play-services-basement, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
- MOZ_ANDROID_AAR(play-services-cast, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
- MOZ_ANDROID_AAR(mediarouter-v7, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support, REQUIRED_INTERNAL_IMPL)
-fi
-
-])
-
-AC_DEFUN([MOZ_ANDROID_GOOGLE_CLOUD_MESSAGING],
-[
-
-if test -n "$MOZ_ANDROID_GCM" ; then
- MOZ_ANDROID_AAR(play-services-base, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
- MOZ_ANDROID_AAR(play-services-basement, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
- MOZ_ANDROID_AAR(play-services-gcm, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
- MOZ_ANDROID_AAR(play-services-measurement, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
-fi
-
-])
-
-AC_DEFUN([MOZ_ANDROID_INSTALL_TRACKING],
-[
-
-if test -n "$MOZ_INSTALL_TRACKING"; then
- MOZ_ANDROID_AAR(play-services-ads, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
- MOZ_ANDROID_AAR(play-services-basement, $ANDROID_GOOGLE_PLAY_SERVICES_VERSION, google, com/google/android/gms)
-fi
-
-])
-
dnl Configure an Android SDK.
dnl Arg 1: compile SDK version, like 23.
dnl Arg 2: target SDK version, like 23.
dnl Arg 3: list of build-tools versions, like "23.0.3 23.0.1".
dnl Arg 4: list of target lint versions, like "25.3.2 25.3.1" (note: we fall back to
dnl unversioned lint if this version is not found).
AC_DEFUN([MOZ_ANDROID_SDK],
[
@@ -274,36 +186,16 @@ case "$target" in
ANDROID_TOOLS="${android_tools}"
ANDROID_BUILD_TOOLS_VERSION="$android_build_tools_version"
AC_SUBST(ANDROID_COMPILE_SDK_VERSION)
AC_SUBST(ANDROID_TARGET_SDK)
AC_SUBST(ANDROID_SDK_ROOT)
AC_SUBST(ANDROID_SDK)
AC_SUBST(ANDROID_TOOLS)
AC_SUBST(ANDROID_BUILD_TOOLS_VERSION)
-
- MOZ_ANDROID_AAR(customtabs, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support)
- MOZ_ANDROID_AAR(appcompat-v7, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support)
- MOZ_ANDROID_AAR(support-vector-drawable, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support)
- MOZ_ANDROID_AAR(animated-vector-drawable, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support)
- MOZ_ANDROID_AAR(cardview-v7, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support)
- MOZ_ANDROID_AAR(design, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support)
- MOZ_ANDROID_AAR(recyclerview-v7, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support)
- MOZ_ANDROID_AAR(support-v4, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support, REQUIRED_INTERNAL_IMPL)
- MOZ_ANDROID_AAR(palette-v7, $ANDROID_SUPPORT_LIBRARY_VERSION, android, com/android/support)
-
- ANDROID_SUPPORT_ANNOTATIONS_JAR="$ANDROID_SDK_ROOT/extras/android/m2repository/com/android/support/support-annotations/$ANDROID_SUPPORT_LIBRARY_VERSION/support-annotations-$ANDROID_SUPPORT_LIBRARY_VERSION.jar"
- AC_MSG_CHECKING([for support-annotations JAR])
- if ! test -e $ANDROID_SUPPORT_ANNOTATIONS_JAR ; then
- AC_MSG_ERROR([You must download the support-annotations lib. Run the Android SDK tool and install the Android Support Repository under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_SUPPORT_ANNOTATIONS_JAR)])
- fi
- AC_MSG_RESULT([$ANDROID_SUPPORT_ANNOTATIONS_JAR])
- AC_SUBST(ANDROID_SUPPORT_ANNOTATIONS_JAR)
- ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB=$ANDROID_SUPPORT_ANNOTATIONS_JAR
- AC_SUBST(ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB)
;;
esac
AC_MSG_CHECKING([for Android lint classpath])
ANDROID_LINT_CLASSPATH=""
for version in $4; do
android_lint_versioned_jar="$ANDROID_SDK_ROOT/tools/lib/lint-$version.jar"
if test -e "$android_lint_versioned_jar" ; then
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -162,22 +162,16 @@ constants_jar.sources += ['java/org/mozi
'mma/MmaInterface.java',
]]
constants_jar.generated_sources = [
'../geckoview/generated/preprocessed/org/mozilla/geckoview/BuildConfig.java',
'generated/preprocessed/org/mozilla/gecko/AdjustConstants.java',
'generated/preprocessed/org/mozilla/gecko/AppConstants.java',
'generated/preprocessed/org/mozilla/gecko/MmaConstants.java',
]
-constants_jar.extra_jars = [
- CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
- CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
- CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
- CONFIG['ANDROID_APPCOMPAT_V7_AAR_LIB'],
-]
if CONFIG['MOZ_INSTALL_TRACKING']:
constants_jar.sources += ['java/org/mozilla/gecko/' + x for x in [
'adjust/AdjustHelper.java',
]]
constants_jar.extra_jars += [
'gecko-thirdparty-adjust_sdk.jar',
]
@@ -214,17 +208,16 @@ mgjar.sources += [geckoview_source_dir +
'mozglue/JNIObject.java',
'mozglue/NativeReference.java',
'mozglue/NativeZip.java',
'mozglue/SafeIntent.java',
'mozglue/SharedMemory.java',
]]
mgjar.generated_sources = [] # Keep it this way.
mgjar.extra_jars += [
- CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
'constants.jar',
]
mgjar.javac_flags += ['-Xlint:all']
gujar = add_java_jar('gecko-util')
gujar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x for x in [
'util/ActivityResultHandler.java',
'util/ActivityResultHandlerMap.java',
@@ -258,36 +251,28 @@ gujar.sources += [geckoview_source_dir +
'util/StringUtils.java',
'util/ThreadUtils.java',
'util/UIAsyncTask.java',
'util/UUIDUtil.java',
'util/WeakReferenceHandler.java',
'util/WindowUtils.java',
]]
gujar.extra_jars = [
- CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
- CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
- CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
- CONFIG['ANDROID_PALETTE_V7_AAR_LIB'],
'constants.jar',
'gecko-mozglue.jar',
]
gujar.javac_flags += ['-Xlint:all,-deprecation']
stjar = add_java_jar('sync-thirdparty')
stjar.sources += [ thirdparty_source_dir + f for f in sync_thirdparty_java_files ]
stjar.javac_flags = ['-Xlint:none']
services_jar = add_java_jar('services')
services_jar.sources += sync_java_files
services_jar.extra_jars = [
- CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
- CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
- CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
- CONFIG['ANDROID_APPCOMPAT_V7_AAR_LIB'],
'constants.jar',
'gecko-R.jar',
'gecko-mozglue.jar',
'gecko-thirdparty.jar',
'gecko-util.jar',
'sync-thirdparty.jar',
]
services_jar.javac_flags += ['-Xlint:all,-deprecation']
@@ -422,20 +407,16 @@ if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
'media/GeckoHlsPlayer.java',
'media/GeckoHlsRendererBase.java',
'media/GeckoHlsVideoRenderer.java',
'media/Utils.java',
]]
gvjar.extra_jars += [
- CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
- CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
- CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
- CONFIG['ANDROID_PALETTE_V7_AAR_LIB'],
'constants.jar',
'gecko-mozglue.jar',
'gecko-util.jar',
]
gvjar.javac_flags += [
'-Xlint:all,-deprecation,-fallthrough',
'-J-Xmx512m',
@@ -981,19 +962,16 @@ gbjar.sources += ['../app/src/photon/jav
'toolbar/TabCounter.java',
'toolbar/ToolbarDisplayLayout.java',
'toolbar/ToolbarRoundButton.java',
]]
android_package_dir = CONFIG['ANDROID_PACKAGE_NAME'].replace('.', '/')
gbjar.generated_sources = [] # Keep it this way.
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' ]
if CONFIG['MOZ_ANDROID_GCM']:
gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
'gcm/GcmInstanceIDListenerService.java',
@@ -1030,82 +1008,28 @@ gbjar.extra_jars += [
'gecko-mozglue.jar',
'gecko-thirdparty.jar',
'gecko-util.jar',
'gecko-view.jar',
'sync-thirdparty.jar',
'services.jar',
]
-moz_native_devices_jars = [
- CONFIG['ANDROID_MEDIAROUTER_V7_AAR_LIB'],
- CONFIG['ANDROID_MEDIAROUTER_V7_AAR_INTERNAL_LIB'],
- CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR_LIB'],
- CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB'],
- CONFIG['ANDROID_PLAY_SERVICES_CAST_AAR_LIB'],
-]
moz_native_devices_sources = ['java/org/mozilla/gecko/' + x for x in [
'ChromeCastDisplay.java',
'ChromeCastPlayer.java',
'GeckoMediaPlayer.java',
'GeckoPresentationDisplay.java',
'MediaPlayerManager.java',
'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']:
- resjar.generated_sources += ['generated/android/support/v7/mediarouter/R.java']
-
- if CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR']:
- resjar.generated_sources += ['generated/com/google/android/gms/base/R.java']
-
- if CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR']:
- resjar.generated_sources += ['generated/com/google/android/gms/R.java']
-
- if CONFIG['ANDROID_PLAY_SERVICES_CAST_AAR']:
- 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']:
- resjar.generated_sources += ['generated/com/google/android/gms/R.java']
-
- if CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR']:
- resjar.generated_sources += ['generated/com/google/android/gms/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']:
- resjar.generated_sources += ['generated/com/google/android/gms/ads/R.java']
-
- if CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR']:
- 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']]
-gbjar.extra_jars += [CONFIG['ANDROID_CUSTOMTABS_AAR_LIB']]
-
gbjar.javac_flags += ['-Xlint:all,-deprecation,-fallthrough,-cast', '-J-Xmx512m', '-J-Xms128m']
# gecko-thirdparty is a good place to put small independent libraries
gtjar = add_java_jar('gecko-thirdparty')
gtjar.sources += [ thirdparty_source_dir + f for f in [
'com/booking/rtlviewpager/PagerAdapterWrapper.java',
'com/booking/rtlviewpager/RtlViewPager.java',
'com/jakewharton/disklrucache/DiskLruCache.java',
@@ -1140,21 +1064,16 @@ gtjar.sources += [ thirdparty_source_dir
'com/squareup/picasso/Stats.java',
'com/squareup/picasso/StatsSnapshot.java',
'com/squareup/picasso/Target.java',
'com/squareup/picasso/TargetAction.java',
'com/squareup/picasso/Transformation.java',
'com/squareup/picasso/UrlConnectionDownloader.java',
'com/squareup/picasso/Utils.java'
] ]
-gtjar.extra_jars = [
- CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
- CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
- CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
-]
if not CONFIG['MOZILLA_OFFICIAL']:
gtjar.sources += [ thirdparty_source_dir + f for f in [
'org/lucasr/dspec/DesignSpec.java',
'org/lucasr/dspec/RawResource.java'
] ]
if CONFIG['MOZ_INSTALL_TRACKING']:
@@ -1296,24 +1215,16 @@ if CONFIG['MOZ_ANDROID_MMA']:
'com/leanplum/utils/BitmapUtil.java',
'com/leanplum/utils/SharedPreferencesUtil.java',
'com/leanplum/utils/SizeUtil.java',
'com/leanplum/Var.java',
'com/leanplum/views/BackgroundImageView.java',
'com/leanplum/views/CloseButton.java',
] ]
lpjar.extra_jars += [
- CONFIG['ANDROID_APPCOMPAT_V7_AAR_LIB'],
- CONFIG['ANDROID_PLAY_SERVICES_ADS_AAR_LIB'],
- CONFIG['ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB'],
- 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',
]
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',
@@ -1334,20 +1245,16 @@ if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
]
exoplayer2_jar = add_java_jar('exoplayer2')
exoplayer2_jar.javac_flags += [
'-Xlint:all,-serial,-rawtypes,-unchecked,-fallthrough',
]
- exoplayer2_jar.extra_jars += [
- CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
- ]
-
exoplayer2_jar.sources += [geckoview_thirdparty_source_dir + 'java/com/google/android/exoplayer2/' + x for x in [
'audio/Ac3Util.java',
'audio/AudioCapabilities.java',
'audio/AudioCapabilitiesReceiver.java',
'audio/AudioDecoderException.java',
'audio/AudioProcessor.java',
'audio/AudioRendererEventListener.java',
'audio/AudioTrack.java',
--- a/old-configure.in
+++ b/old-configure.in
@@ -2271,27 +2271,16 @@ MOZ_ARG_WITH_STRING(distribution-id,
if test -z "$MOZ_DISTRIBUTION_ID"; then
MOZ_DISTRIBUTION_ID="org.mozilla"
fi
AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
AC_SUBST(MOZ_DISTRIBUTION_ID)
-
-dnl ========================================================
-dnl Google Play Services, placed here so it can depend on
-dnl values set by configure.sh above.
-dnl ========================================================
-
-MOZ_ANDROID_GOOGLE_PLAY_SERVICES
-MOZ_ANDROID_GOOGLE_CLOUD_MESSAGING
-MOZ_ANDROID_INSTALL_TRACKING
-
-
dnl ========================================================
dnl = GConf support module
dnl ========================================================
if test "$MOZ_X11"
then
if test "$MOZ_ENABLE_GTK"
then
deleted file mode 100644
--- 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'))
- 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 as 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:]))