mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1108782 - Part 2: Explode AAR files at configure time. r=glandium
This gets us a limited version of AAR support: we can consume static AAR libraries, where here static does not refer to linking, but to static assets that are fixed at build-backend time and not modified (or produced) during the build. This lets us pin our dependencies (and move to Google's versioned Maven repository packages, away from Google's unversioned ad-hoc packages). By restricting to static AAR libraries, we avoid having to handle truly complicated dependency trees, as changing parts of generated AAR files require delicate rebuilding of the APKs (and internal libraries) that depend on the AAR files. It is possible that we will generate AARs in the tree at some time. Right now, we don't do that, even for GeckoView: the AARs produced are assembled as artifacts at package time and are intended for external consumption. We might want this for GeckoView and Fennec at some time; we should consider using Gradle everywhere at that point. The patch itself does the simplest possible thing (which has precedent from Gradle and other build systems): it simply "explodes" the AAR into the object directory and uses existing mechanisms to refer to the exploded pieces. AARs have both required and optional components. Each component is defined with an expected and required flag. If a component is expected and not present, or not expected and is present, an error is raised. If the component is expected and present, autoconf's ifelse() macro is used to define the relevant AAR_* component variables. If the component is not expected and not present, no action is taken. A consuming build backend therefore can guard all AAR_* component variables with just the top-level AAR variable. Many AAR files have empty assets/ directories. This patch doesn't explode empty assets/ directories, protecting against trivial changes to AAR files that don't impact the build. There's a lot not to like in this approach, including: * We need to manually reference internal AAR libs; * I haven't separated the pinned version numbers out of configure.in. However, it's closer to what we want than what we have!
This commit is contained in:
parent
ec3a0bb18c
commit
f99a3d2d54
@ -234,41 +234,71 @@ AC_SUBST([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
|
||||
AC_SUBST(MOZ_NATIVE_DEVICES)
|
||||
|
||||
AC_MSG_CHECKING([for google play services])
|
||||
GOOGLE_PLAY_SERVICES_LIB="${ANDROID_SDK_ROOT}/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
|
||||
GOOGLE_PLAY_SERVICES_RES="${ANDROID_SDK_ROOT}/extras/google/google_play_services/libproject/google-play-services_lib/res"
|
||||
AC_SUBST(GOOGLE_PLAY_SERVICES_LIB)
|
||||
AC_SUBST(GOOGLE_PLAY_SERVICES_RES)
|
||||
if ! test -e $GOOGLE_PLAY_SERVICES_LIB ; then
|
||||
AC_MSG_ERROR([You must download Google Play Services to build with native video casting support enabled. Run the Android SDK tool and install Google Play Services under Extras. See http://developer.android.com/google/play-services/setup.html for more info. (looked for $GOOGLE_PLAY_SERVICES_LIB) ])
|
||||
fi
|
||||
AC_MSG_RESULT([$GOOGLE_PLAY_SERVICES_LIB])
|
||||
|
||||
ANDROID_APPCOMPAT_LIB="$ANDROID_COMPAT_DIR_BASE/v7/appcompat/libs/android-support-v7-appcompat.jar"
|
||||
ANDROID_APPCOMPAT_RES="$ANDROID_COMPAT_DIR_BASE/v7/appcompat/res"
|
||||
AC_MSG_CHECKING([for v7 appcompat library])
|
||||
if ! test -e $ANDROID_APPCOMPAT_LIB ; then
|
||||
AC_MSG_ERROR([You must download the v7 app compat Android support library when targeting Android with native video casting support enabled. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_APPCOMPAT_LIB)])
|
||||
fi
|
||||
AC_MSG_RESULT([$ANDROID_APPCOMPAT_LIB])
|
||||
AC_SUBST(ANDROID_APPCOMPAT_LIB)
|
||||
AC_SUBST(ANDROID_APPCOMPAT_RES)
|
||||
|
||||
ANDROID_MEDIAROUTER_LIB="$ANDROID_COMPAT_DIR_BASE/v7/mediarouter/libs/android-support-v7-mediarouter.jar"
|
||||
ANDROID_MEDIAROUTER_RES="$ANDROID_COMPAT_DIR_BASE/v7/mediarouter/res"
|
||||
AC_MSG_CHECKING([for v7 mediarouter library])
|
||||
if ! test -e $ANDROID_MEDIAROUTER_LIB ; then
|
||||
AC_MSG_ERROR([You must download the v7 media router Android support library when targeting Android with native video casting support enabled. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_MEDIAROUTER_LIB)])
|
||||
fi
|
||||
AC_MSG_RESULT([$ANDROID_MEDIAROUTER_LIB])
|
||||
AC_SUBST(ANDROID_MEDIAROUTER_LIB)
|
||||
AC_SUBST(ANDROID_MEDIAROUTER_RES)
|
||||
MOZ_ANDROID_AAR(play-services-base, 7.8.0, google, com/google/android/gms)
|
||||
MOZ_ANDROID_AAR(play-services-cast, 7.8.0, google, com/google/android/gms)
|
||||
MOZ_ANDROID_AAR(appcompat-v7, 22.2.1, android, com/android/support)
|
||||
MOZ_ANDROID_AAR(mediarouter-v7, 22.2.1, android, com/android/support, REQUIRED_INTERNAL_IMPL)
|
||||
fi
|
||||
|
||||
])
|
||||
@ -355,14 +385,6 @@ case "$target" in
|
||||
ANDROID_SDK="${android_sdk}"
|
||||
ANDROID_SDK_ROOT="${android_sdk_root}"
|
||||
|
||||
AC_MSG_CHECKING([for compat library dirs])
|
||||
if test -e "${android_sdk_root}/extras/android/compatibility/v4/android-support-v4.jar" ; then
|
||||
ANDROID_COMPAT_DIR_BASE="${android_sdk_root}/extras/android/compatibility";
|
||||
else
|
||||
ANDROID_COMPAT_DIR_BASE="${android_sdk_root}/extras/android/support";
|
||||
fi
|
||||
AC_MSG_RESULT([$ANDROID_COMPAT_DIR_BASE])
|
||||
|
||||
ANDROID_TOOLS="${android_tools}"
|
||||
ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
|
||||
ANDROID_BUILD_TOOLS="${android_build_tools}"
|
||||
@ -372,23 +394,18 @@ case "$target" in
|
||||
AC_SUBST(ANDROID_PLATFORM_TOOLS)
|
||||
AC_SUBST(ANDROID_BUILD_TOOLS)
|
||||
|
||||
ANDROID_COMPAT_LIB=$ANDROID_COMPAT_DIR_BASE/v4/android-support-v4.jar
|
||||
AC_MSG_CHECKING([for v4 compat library])
|
||||
AC_SUBST(ANDROID_COMPAT_LIB)
|
||||
if ! test -e $ANDROID_COMPAT_LIB ; then
|
||||
AC_MSG_ERROR([You must download the Android v4 support library when targeting Android. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_COMPAT_LIB)])
|
||||
fi
|
||||
AC_MSG_RESULT([$ANDROID_COMPAT_LIB])
|
||||
MOZ_ANDROID_AAR(support-v4, 22.2.1, android, com/android/support, REQUIRED_INTERNAL_IMPL)
|
||||
MOZ_ANDROID_AAR(recyclerview-v7, 22.2.1, android, com/android/support)
|
||||
|
||||
ANDROID_RECYCLERVIEW_LIB="$ANDROID_COMPAT_DIR_BASE/v7/recyclerview/libs/android-support-v7-recyclerview.jar"
|
||||
ANDROID_RECYCLERVIEW_RES="$ANDROID_COMPAT_DIR_BASE/v7/recyclerview/res"
|
||||
AC_MSG_CHECKING([for v7 recyclerview library])
|
||||
if ! test -e $ANDROID_RECYCLERVIEW_LIB ; then
|
||||
AC_MSG_ERROR([You must download the v7 recyclerview Android support library. Run the Android SDK tool and install Android Support Library under Extras. See https://developer.android.com/tools/extras/support-library.html for more info. (looked for $ANDROID_RECYCLERVIEW_LIB)])
|
||||
ANDROID_SUPPORT_ANNOTATIONS_JAR="$ANDROID_SDK_ROOT/extras/android/m2repository/com/android/support/support-annotations/22.2.1/support-annotations-22.2.1.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_RECYCLERVIEW_LIB])
|
||||
AC_SUBST(ANDROID_RECYCLERVIEW_LIB)
|
||||
AC_SUBST(ANDROID_RECYCLERVIEW_RES)
|
||||
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)
|
||||
|
||||
dnl Google has a history of moving the Android tools around. We don't
|
||||
dnl care where they are, so let's try to find them anywhere we can.
|
||||
|
@ -66,6 +66,7 @@ stumbler_jars_dir := $(DEPTH)/mobile/android/stumbler
|
||||
ANDROID_CLASSPATH_JARS += \
|
||||
$(wildcard $(jars_dir)/*.jar) \
|
||||
$(wildcard $(stumbler_jars_dir)/*.jar) \
|
||||
$(ANDROID_COMPAT_LIB) \
|
||||
$(ANDROID_RECYCLERVIEW_LIB) \
|
||||
$(ANDROID_SUPPORT_V4_AAR_LIB) \
|
||||
$(ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB) \
|
||||
$(ANDROID_RECYCLERVIEW_V7_AAR_LIB) \
|
||||
$(NULL)
|
||||
|
@ -49,20 +49,26 @@ GARBAGE_DIRS += classes db jars res sync services generated
|
||||
# over changes in behaviour between versions.
|
||||
JAVA_BOOTCLASSPATH := \
|
||||
$(ANDROID_SDK)/android.jar \
|
||||
$(ANDROID_COMPAT_LIB) \
|
||||
$(NULL)
|
||||
|
||||
JAVA_BOOTCLASSPATH := $(subst $(NULL) ,:,$(strip $(JAVA_BOOTCLASSPATH)))
|
||||
|
||||
JAVA_CLASSPATH += $(ANDROID_RECYCLERVIEW_LIB)
|
||||
JAVA_CLASSPATH += \
|
||||
$(ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB) \
|
||||
$(ANDROID_SUPPORT_V4_AAR_LIB) \
|
||||
$(ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB) \
|
||||
$(ANDROID_RECYCLERVIEW_V7_AAR_LIB) \
|
||||
$(NULL)
|
||||
|
||||
# If native devices are enabled, add Google Play Services and some of the v7
|
||||
# compat libraries.
|
||||
ifdef MOZ_NATIVE_DEVICES
|
||||
JAVA_CLASSPATH += \
|
||||
$(GOOGLE_PLAY_SERVICES_LIB) \
|
||||
$(ANDROID_MEDIAROUTER_LIB) \
|
||||
$(ANDROID_APPCOMPAT_LIB) \
|
||||
$(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
|
||||
$(ANDROID_PLAY_SERVICES_CAST_AAR_LIB) \
|
||||
$(ANDROID_MEDIAROUTER_V7_AAR_LIB) \
|
||||
$(ANDROID_MEDIAROUTER_V7_AAR_INTERNAL_LIB) \
|
||||
$(ANDROID_APPCOMPAT_V7_AAR_LIB) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
@ -71,15 +77,18 @@ JAVA_CLASSPATH := $(subst $(NULL) ,:,$(strip $(JAVA_CLASSPATH)))
|
||||
# Library jars that we're bundling: these are subject to Proguard before inclusion
|
||||
# into classes.dex.
|
||||
java_bundled_libs := \
|
||||
$(ANDROID_COMPAT_LIB) \
|
||||
$(ANDROID_RECYCLERVIEW_LIB) \
|
||||
$(ANDROID_SUPPORT_V4_AAR_LIB) \
|
||||
$(ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB) \
|
||||
$(ANDROID_RECYCLERVIEW_V7_AAR_LIB) \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_NATIVE_DEVICES
|
||||
java_bundled_libs += \
|
||||
$(GOOGLE_PLAY_SERVICES_LIB) \
|
||||
$(ANDROID_MEDIAROUTER_LIB) \
|
||||
$(ANDROID_APPCOMPAT_LIB) \
|
||||
$(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
|
||||
$(ANDROID_PLAY_SERVICES_CAST_AAR_LIB) \
|
||||
$(ANDROID_MEDIAROUTER_V7_AAR_LIB) \
|
||||
$(ANDROID_MEDIAROUTER_V7_AAR_INTERNAL_LIB) \
|
||||
$(ANDROID_APPCOMPAT_V7_AAR_LIB) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
@ -358,10 +367,12 @@ endif
|
||||
generated/org/mozilla/gecko/R.java: .aapt.deps ;
|
||||
|
||||
# If native devices are enabled, add Google Play Services, build their resources
|
||||
generated/android/support/v4/R.java: .aapt.deps ;
|
||||
generated/android/support/v7/appcompat/R.java: .aapt.deps ;
|
||||
generated/android/support/v7/mediarouter/R.java: .aapt.deps ;
|
||||
generated/android/support/v7/recyclerview/R.java: .aapt.deps ;
|
||||
generated/com/google/android/gms/R.java: .aapt.deps ;
|
||||
generated/com/google/android/gms/cast/R.java: .aapt.deps ;
|
||||
|
||||
gecko.ap_: .aapt.deps ;
|
||||
R.txt: .aapt.deps ;
|
||||
|
@ -44,9 +44,13 @@ resjar.generated_sources += [
|
||||
'org/mozilla/gecko/R.java',
|
||||
]
|
||||
|
||||
if CONFIG['ANDROID_RECYCLERVIEW_RES']:
|
||||
if CONFIG['ANDROID_SUPPORT_V4_AAR']:
|
||||
ANDROID_EXTRA_PACKAGES += ['android.support.v4']
|
||||
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_SUPPORT_V4_AAR_RES']]
|
||||
resjar.generated_sources += ['android/support/v4/R.java']
|
||||
if CONFIG['ANDROID_RECYCLERVIEW_V7_AAR']:
|
||||
ANDROID_EXTRA_PACKAGES += ['android.support.v7.recyclerview']
|
||||
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_RECYCLERVIEW_RES']]
|
||||
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_RES']]
|
||||
resjar.generated_sources += ['android/support/v7/recyclerview/R.java']
|
||||
|
||||
resjar.javac_flags += ['-Xlint:all']
|
||||
@ -107,7 +111,9 @@ gujar.sources += [
|
||||
'util/WindowUtils.java',
|
||||
]
|
||||
gujar.extra_jars = [
|
||||
CONFIG['ANDROID_COMPAT_LIB'],
|
||||
CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
|
||||
CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
|
||||
CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
|
||||
'constants.jar',
|
||||
'gecko-mozglue.jar',
|
||||
]
|
||||
@ -586,7 +592,9 @@ gbjar.sources += [ thirdparty_source_dir + f for f in [
|
||||
android_package_dir = CONFIG['ANDROID_PACKAGE_NAME'].replace('.', '/')
|
||||
gbjar.generated_sources = [] # Keep it this way.
|
||||
gbjar.extra_jars += [
|
||||
CONFIG['ANDROID_COMPAT_LIB'],
|
||||
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']:
|
||||
@ -640,9 +648,11 @@ gbjar.extra_jars += [
|
||||
]
|
||||
|
||||
moz_native_devices_jars = [
|
||||
CONFIG['ANDROID_APPCOMPAT_LIB'],
|
||||
CONFIG['ANDROID_MEDIAROUTER_LIB'],
|
||||
CONFIG['GOOGLE_PLAY_SERVICES_LIB'],
|
||||
CONFIG['ANDROID_APPCOMPAT_V7_AAR_LIB'],
|
||||
CONFIG['ANDROID_MEDIAROUTER_V7_AAR_LIB'],
|
||||
CONFIG['ANDROID_MEDIAROUTER_V7_AAR_INTERNAL_LIB'],
|
||||
CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR_LIB'],
|
||||
CONFIG['ANDROID_PLAY_SERVICES_CAST_AAR_LIB'],
|
||||
]
|
||||
moz_native_devices_sources = [
|
||||
'ChromeCast.java',
|
||||
@ -654,22 +664,27 @@ if CONFIG['MOZ_NATIVE_DEVICES']:
|
||||
gbjar.extra_jars += moz_native_devices_jars
|
||||
gbjar.sources += moz_native_devices_sources
|
||||
|
||||
if CONFIG['ANDROID_APPCOMPAT_RES']:
|
||||
if CONFIG['ANDROID_APPCOMPAT_V7_AAR']:
|
||||
ANDROID_EXTRA_PACKAGES += ['android.support.v7.appcompat']
|
||||
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_APPCOMPAT_RES']]
|
||||
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_APPCOMPAT_V7_AAR_RES']]
|
||||
resjar.generated_sources += ['android/support/v7/appcompat/R.java']
|
||||
|
||||
if CONFIG['ANDROID_MEDIAROUTER_RES']:
|
||||
if CONFIG['ANDROID_MEDIAROUTER_V7_AAR']:
|
||||
ANDROID_EXTRA_PACKAGES += ['android.support.v7.mediarouter']
|
||||
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_MEDIAROUTER_RES']]
|
||||
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_MEDIAROUTER_V7_AAR_RES']]
|
||||
resjar.generated_sources += ['android/support/v7/mediarouter/R.java']
|
||||
|
||||
if CONFIG['GOOGLE_PLAY_SERVICES_RES']:
|
||||
if CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR']:
|
||||
ANDROID_EXTRA_PACKAGES += ['com.google.android.gms']
|
||||
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['GOOGLE_PLAY_SERVICES_RES']]
|
||||
ANDROID_EXTRA_RES_DIRS += ['%' + CONFIG['ANDROID_PLAY_SERVICES_BASE_AAR_RES']]
|
||||
resjar.generated_sources += ['com/google/android/gms/R.java']
|
||||
|
||||
gbjar.extra_jars += [CONFIG['ANDROID_RECYCLERVIEW_LIB']]
|
||||
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 += ['com/google/android/gms/cast/R.java']
|
||||
|
||||
gbjar.extra_jars += [CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_LIB']]
|
||||
|
||||
gbjar.javac_flags += ['-Xlint:all,-deprecation,-fallthrough', '-J-Xmx512m', '-J-Xms128m']
|
||||
|
||||
@ -741,7 +756,11 @@ gtjar.sources += [ thirdparty_source_dir + f for f in [
|
||||
'com/squareup/picasso/UrlConnectionDownloader.java',
|
||||
'com/squareup/picasso/Utils.java'
|
||||
] ]
|
||||
#gtjar.javac_flags += ['-Xlint:all']
|
||||
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 [
|
||||
@ -848,7 +867,9 @@ if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
|
||||
search_activity.sources += [search_source_dir + '/' + f for f in search_activity_sources]
|
||||
search_activity.javac_flags += ['-Xlint:all']
|
||||
search_activity.extra_jars = [
|
||||
CONFIG['ANDROID_COMPAT_LIB'],
|
||||
CONFIG['ANDROID_SUPPORT_ANNOTATIONS_JAR_LIB'],
|
||||
CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
|
||||
CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
|
||||
'constants.jar',
|
||||
'gecko-R.jar',
|
||||
'gecko-browser.jar',
|
||||
|
@ -8,5 +8,5 @@ include('stumbler_sources.mozbuild')
|
||||
|
||||
stumbler_jar = add_java_jar('stumbler')
|
||||
stumbler_jar.sources += stumbler_sources
|
||||
stumbler_jar.extra_jars += [CONFIG['ANDROID_COMPAT_LIB']]
|
||||
stumbler_jar.extra_jars += [CONFIG['ANDROID_SUPPORT_V4_AAR_LIB']]
|
||||
stumbler_jar.javac_flags += ['-Xlint:all']
|
||||
|
@ -14,8 +14,8 @@ include('background_junit3_sources.mozbuild')
|
||||
jar = add_java_jar('background-junit3')
|
||||
jar.sources += background_junit3_sources
|
||||
jar.extra_jars += [
|
||||
CONFIG['ANDROID_COMPAT_LIB'],
|
||||
CONFIG['ANDROID_RECYCLERVIEW_LIB'],
|
||||
CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
|
||||
CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_LIB'],
|
||||
TOPOBJDIR + '/mobile/android/base/constants.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-R.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-browser.jar',
|
||||
|
@ -29,8 +29,8 @@ jar.generated_sources = [] # None yet -- try to keep it this way.
|
||||
jar.javac_flags += ['-Xlint:all']
|
||||
|
||||
jar.extra_jars += [
|
||||
CONFIG['ANDROID_COMPAT_LIB'],
|
||||
CONFIG['ANDROID_RECYCLERVIEW_LIB'],
|
||||
CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],
|
||||
CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_LIB'],
|
||||
TOPOBJDIR + '/mobile/android/base/constants.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-R.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-browser.jar',
|
||||
|
72
python/mozbuild/mozbuild/action/explode_aar.py
Normal file
72
python/mozbuild/mozbuild/action/explode_aar.py
Normal file
@ -0,0 +1,72 @@
|
||||
# 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'), find_executables=False)
|
||||
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, 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:]))
|
Loading…
Reference in New Issue
Block a user