Bug 1440432 - Remove AAR exploding from configure. r=jchen

The moz.build Java JAR definitions are, of course, broken, but they
will be removed soon enough.

MozReview-Commit-ID: KIxqLDwd9I7

--HG--
extra : rebase_source : 8312b3f125793f73d3e835d1c0a5c7cabd4ebc0c
This commit is contained in:
Nick Alexander 2018-02-23 12:16:51 -08:00
parent b9e726131c
commit 665e41ac95
4 changed files with 0 additions and 284 deletions

View File

@ -90,94 +90,6 @@ 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.
@ -279,26 +191,6 @@ case "$target" in
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

View File

@ -167,12 +167,6 @@ constants_jar.generated_sources = [
'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 [
@ -219,7 +213,6 @@ mgjar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x for x in
]]
mgjar.generated_sources = [] # Keep it this way.
mgjar.extra_jars += [
CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
'constants.jar',
]
mgjar.javac_flags += ['-Xlint:all']
@ -263,10 +256,6 @@ gujar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x for x in
'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',
]
@ -279,10 +268,6 @@ 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',
@ -427,10 +412,6 @@ if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
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',
@ -986,9 +967,6 @@ gbjar.sources += ['../app/src/photon/java/org/mozilla/gecko/' + x for x in [
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']:
@ -1035,13 +1013,6 @@ gbjar.extra_jars += [
'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',
@ -1052,55 +1023,8 @@ moz_native_devices_sources = ['java/org/mozilla/gecko/' + x for x in [
'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
@ -1145,11 +1069,6 @@ gtjar.sources += [ thirdparty_source_dir + f for f in [
'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 [
@ -1301,14 +1220,6 @@ if CONFIG['MOZ_ANDROID_MMA']:
'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',
]
@ -1339,10 +1250,6 @@ if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
'-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',

View File

@ -2276,17 +2276,6 @@ 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 ========================================================

View File

@ -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:]))