Bug 1163082 - Part 1: Add --with-android-distribution-directory. r=gps a=sylvestre
authorNick Alexander <nalexander@mozilla.com>
Wed, 27 Jan 2016 12:25:04 -0800
changeset 318815 776b5ddd56675421d3e282ae62e73f58410f9f18
parent 318814 bd6f38ef9fd361c9ef0b64e7eb09d05095a459c8
child 318816 87206efd5e93920f58b97d9cf33d51836bccdb8a
push id1079
push userjlund@mozilla.com
push dateFri, 15 Apr 2016 21:02:33 +0000
treeherdermozilla-release@575fbf6786d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps, sylvestre
bugs1163082
milestone46.0a2
Bug 1163082 - Part 1: Add --with-android-distribution-directory. r=gps a=sylvestre This simply packs the assets/ subdirectory of the distribution directory into the assets/ directory of the Android APK using existing mechanisms. It also removes the older method of manually pushing files into dist/bin/distribution, from where they would be packaged into the APK under distribution/.
configure.in
mobile/android/app/build.gradle
mobile/android/base/moz.build
mobile/android/installer/package-manifest.in
toolkit/mozapps/installer/upload-files.mk
--- a/configure.in
+++ b/configure.in
@@ -4013,16 +4013,32 @@ MOZ_ARG_ENABLE_BOOL(android-resource-con
                           Exclude hi-res images and similar from the final APK],
     MOZ_ANDROID_RESOURCE_CONSTRAINED=1)
 
 if test -n "$MOZ_ANDROID_RESOURCE_CONSTRAINED"; then
     AC_DEFINE(MOZ_ANDROID_RESOURCE_CONSTRAINED)
 fi
 AC_SUBST(MOZ_ANDROID_RESOURCE_CONSTRAINED)
 
+# Optional Firefox for Android partner distribution directory.
+MOZ_ARG_WITH_STRING(android-distribution-directory,
+[  --with-android-distribution-directory=dir
+                          Optional Firefox for Android partner distribution directory.],
+  MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
+
+if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
+  # A distribution directory must have an assets/distribution directory.
+  # See https://wiki.mozilla.org/Mobile/Distribution_Files.
+  if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
+    AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
+                  (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
+  fi
+fi
+AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
+
 dnl ========================================================
 dnl = Trademarked Branding
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(official-branding,
 [  --enable-official-branding
                           Enable Official mozilla.org Branding
                           Do not distribute builds with
                           --enable-official-branding unless you have
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -60,16 +60,21 @@ android {
         // Automation builds.
         automation {
         }
     }
 
     sourceSets {
         main {
             manifest.srcFile "${topobjdir}/mobile/android/base/AndroidManifest.xml"
+            assets {
+                if (mozconfig.substs.MOZ_ANDROID_DISTRIBUTION_DIRECTORY) {
+                    srcDir "${mozconfig.substs.MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets"
+                }
+            }
         }
 
         androidTest {
             java {
                 srcDir "${topsrcdir}/mobile/android/tests/browser/robocop/src"
                 srcDir "${topsrcdir}/mobile/android/tests/background/junit3/src"
                 srcDir "${topsrcdir}/mobile/android/tests/browser/junit3/src"
                 srcDir "${topsrcdir}/mobile/android/tests/javaddons/src"
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -908,16 +908,21 @@ ANDROID_GENERATED_RESFILES += [
     'res/raw/suggestedsites.json',
     'res/values/strings.xml',
 ]
 
 ANDROID_ASSETS_DIRS += [
     '/mobile/android/app/assets',
 ]
 
+if CONFIG['MOZ_ANDROID_DISTRIBUTION_DIRECTORY']:
+    ANDROID_ASSETS_DIRS += [
+        '%' + CONFIG['MOZ_ANDROID_DISTRIBUTION_DIRECTORY'] + '/assets',
+    ]
+
 # We do not expose MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN here because that
 # would leak the value to build logs.  Instead we expose the token quietly where
 # appropriate in Makefile.in.
 for var in ('MOZ_ANDROID_ANR_REPORTER', 'MOZ_LINKER_EXTRACT', 'MOZ_DEBUG',
             'MOZ_ANDROID_SEARCH_ACTIVITY', 'MOZ_NATIVE_DEVICES', 'MOZ_ANDROID_MLS_STUMBLER',
             'MOZ_ANDROID_DOWNLOADS_INTEGRATION', 'MOZ_INSTALL_TRACKING',
             'MOZ_ANDROID_GCM'):
     if CONFIG[var]:
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -73,17 +73,16 @@
 @BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
 # This should be MOZ_CHILD_PROCESS_NAME, but that has a "lib/" prefix.
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME_PIE@
 
 [xpcom]
 @BINPATH@/package-name.txt
 @BINPATH@/classes.dex
-@BINPATH@/distribution/*
 
 [browser]
 ; [Base Browser Files]
 @BINPATH@/application.ini
 @BINPATH@/platform.ini
 @BINPATH@/blocklist.xml
 
 ; [Components]
--- a/toolkit/mozapps/installer/upload-files.mk
+++ b/toolkit/mozapps/installer/upload-files.mk
@@ -303,17 +303,16 @@ DIST_FILES += \
   ua-update.json \
   platform.ini \
   greprefs.js \
   browserconfig.properties \
   blocklist.xml \
   chrome.manifest \
   update.locale \
   removed-files \
-  distribution \
   $(NULL)
 
 NON_DIST_FILES = \
   classes.dex \
   $(NULL)
 
 UPLOAD_EXTRA_FILES += gecko-unsigned-unaligned.apk