"Fossies" - the Fresh Open Source Software Archive

Member "UXP-2019.06.08/toolkit/mozapps/installer/upload-files-APK.mk" (8 Jun 2019, 5535 Bytes) of package /linux/www/UXP-2019.06.08.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Make source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "upload-files-APK.mk": 2019.03.27_vs_2019.06.08.

    1 # This Source Code Form is subject to the terms of the Mozilla Public
    2 # License, v. 2.0. If a copy of the MPL was not distributed with this
    3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
    4 
    5 # This file should ONLY be included from upload-files.mk. It was
    6 # split into its own file to increase comprehension of
    7 # upload-files.mk.
    8 
    9 include $(MOZILLA_DIR)/config/android-common.mk
   10 
   11 # Files packed into the APK root.  Packing files into the APK root is not
   12 # supported by modern Android build systems, including Gradle, so don't add to
   13 # this list without Android peer approval.
   14 ROOT_FILES := \
   15   application.ini \
   16   package-name.txt \
   17   ua-update.json \
   18   platform.ini \
   19   removed-files \
   20   $(NULL)
   21 
   22 GECKO_APP_AP_PATH = $(topobjdir)/mobile/android/base
   23 
   24 ifdef ENABLE_TESTS
   25 INNER_ROBOCOP_PACKAGE=true
   26 else
   27 INNER_ROBOCOP_PACKAGE=echo 'Testing is disabled - No Android Robocop for you'
   28 endif
   29 
   30 ifdef MOZ_ANDROID_PACKAGE_INSTALL_BOUNCER
   31 INNER_INSTALL_BOUNCER_PACKAGE=true
   32 ifdef ENABLE_TESTS
   33 UPLOAD_EXTRA_FILES += bouncer.apk
   34 
   35 bouncer_package=$(ABS_DIST)/bouncer.apk
   36 
   37 # Package and release sign the install bouncer APK.  This assumes that the main
   38 # APK (that is, $(PACKAGE)) has already been produced, and verifies that the
   39 # bouncer APK and the main APK define the same set of permissions.  The
   40 # intention is to avoid permission-related surprises when bouncing to the
   41 # installation process in the Play Store.  N.b.: sort -u is Posix and saves
   42 # invoking uniq separately.  diff -u is *not* Posix, so we only add -c.
   43 INNER_INSTALL_BOUNCER_PACKAGE=\
   44   $(call RELEASE_SIGN_ANDROID_APK,$(topobjdir)/mobile/android/bouncer/bouncer-unsigned-unaligned.apk,$(bouncer_package)) && \
   45   ($(AAPT) dump permissions $(PACKAGE) | sort -u > $(PACKAGE).permissions && \
   46    $(AAPT) dump permissions $(bouncer_package) | sort -u > $(bouncer_package).permissions && \
   47    diff -c $(PACKAGE).permissions $(bouncer_package).permissions || \
   48    (echo "*** Error: The permissions of the bouncer package differ from the permissions of the main package.  Ensure the bouncer and main package Android manifests agree, rebuild mobile/android, and re-package." && exit 1))
   49 else
   50 INNER_INSTALL_BOUNCER_PACKAGE=echo 'Testing is disabled, so the install bouncer is disabled - No trampolines for you'
   51 endif # ENABLE_TESTS
   52 else
   53 INNER_INSTALL_BOUNCER_PACKAGE=echo 'Install bouncer is disabled - No trampolines for you'
   54 endif # MOZ_ANDROID_PACKAGE_INSTALL_BOUNCER
   55 
   56 # Fennec's OMNIJAR_NAME can include a directory; for example, it might
   57 # be "assets/omni.ja". This path specifies where the omni.ja file
   58 # lives in the APK, but should not root the resources it contains
   59 # under assets/ (i.e., resources should not live at chrome://assets/).
   60 # packager.py writes /omni.ja in order to be consistent with the
   61 # layout expected by language repacks. Therefore, we move it to the
   62 # correct path here, in INNER_MAKE_PACKAGE. See comment about
   63 # OMNIJAR_NAME in configure.in.
   64 
   65 # OMNIJAR_DIR is './' for "omni.ja", 'assets/' for "assets/omni.ja".
   66 OMNIJAR_DIR := $(dir $(OMNIJAR_NAME))
   67 OMNIJAR_NAME := $(notdir $(OMNIJAR_NAME))
   68 
   69 # We force build an ap_ that does not check dependencies below.
   70 # Language repacks take advantage of this unchecked dependency ap_ to
   71 # insert additional resources (translated strings) into the ap_
   72 # without the build system's participation.  This can do the wrong
   73 # thing if there are resource changes in between build time and
   74 # package time.
   75 PKG_SUFFIX = .apk
   76 
   77 INNER_FENNEC_PACKAGE = \
   78   $(MAKE) -C $(GECKO_APP_AP_PATH) gecko-nodeps.ap_ && \
   79   $(PYTHON) -m mozbuild.action.package_fennec_apk \
   80     --verbose \
   81     --inputs \
   82       $(GECKO_APP_AP_PATH)/gecko-nodeps.ap_ \
   83     --omnijar $(STAGEPATH)$(MOZ_PKG_DIR)/$(OMNIJAR_NAME) \
   84     --classes-dex $(GECKO_APP_AP_PATH)/classes.dex \
   85     --lib-dirs $(STAGEPATH)$(MOZ_PKG_DIR)/lib \
   86     --assets-dirs $(STAGEPATH)$(MOZ_PKG_DIR)/assets \
   87     --features-dirs $(STAGEPATH)$(MOZ_PKG_DIR)/features \
   88     --root-files $(foreach f,$(ROOT_FILES),$(STAGEPATH)$(MOZ_PKG_DIR)/$(f)) \
   89     --output $(PACKAGE:.apk=-unsigned-unaligned.apk) && \
   90   $(call RELEASE_SIGN_ANDROID_APK,$(PACKAGE:.apk=-unsigned-unaligned.apk),$(PACKAGE))
   91 
   92 # Packaging produces many optional artifacts.
   93 package_fennec = \
   94   $(INNER_FENNEC_PACKAGE) && \
   95   $(INNER_ROBOCOP_PACKAGE) && \
   96   $(INNER_INSTALL_BOUNCER_PACKAGE)
   97 
   98 # Re-packaging only replaces Android resources and the omnijar before
   99 # (re-)signing.
  100 repackage_fennec = \
  101   $(MAKE) -C $(GECKO_APP_AP_PATH) gecko-nodeps.ap_ && \
  102   $(PYTHON) -m mozbuild.action.package_fennec_apk \
  103     --verbose \
  104     --inputs \
  105       $(UNPACKAGE) \
  106       $(GECKO_APP_AP_PATH)/gecko-nodeps.ap_ \
  107     --omnijar $(STAGEPATH)$(MOZ_PKG_DIR)/$(OMNIJAR_NAME) \
  108     --output $(PACKAGE:.apk=-unsigned-unaligned.apk) && \
  109   $(call RELEASE_SIGN_ANDROID_APK,$(PACKAGE:.apk=-unsigned-unaligned.apk),$(PACKAGE))
  110 
  111 INNER_MAKE_PACKAGE = $(if $(UNPACKAGE),$(repackage_fennec),$(package_fennec))
  112 
  113 # Language repacks root the resources contained in assets/omni.ja
  114 # under assets/, but the repacks expect them to be rooted at /.
  115 # Therefore, we we move the omnijar back to / so the resources are
  116 # under the root here, in INNER_UNMAKE_PACKAGE. See comments about
  117 # OMNIJAR_NAME earlier in this file and in configure.in.
  118 
  119 INNER_UNMAKE_PACKAGE = \
  120   mkdir $(MOZ_PKG_DIR) && \
  121   ( cd $(MOZ_PKG_DIR) && \
  122     $(UNZIP) $(UNPACKAGE) $(ROOT_FILES) && \
  123     $(UNZIP) $(UNPACKAGE) $(OMNIJAR_DIR)$(OMNIJAR_NAME) && \
  124     $(if $(filter-out ./,$(OMNIJAR_DIR)), \
  125       mv $(OMNIJAR_DIR)$(OMNIJAR_NAME) $(OMNIJAR_NAME), \
  126       true) )