Bug 1550146 - Part 2: Make mach "build" run "stage-package && android assemble-app" for mobile/android. r=glandium
authorNick Alexander <nalexander@mozilla.com>
Wed, 21 Aug 2019 03:07:16 +0000
changeset 489109 ce76e1a54a3c60423754459ed63e106b072753e3
parent 489108 e4eb5e085f39229c979cceebf6a8219bb442344e
child 489110 0aa0dd2f418b0d6c7cc5e8c58f2ca78dd425a62b
push id93131
push usernalexander@mozilla.com
push dateWed, 21 Aug 2019 03:22:55 +0000
treeherderautoland@ce76e1a54a3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1550146
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1550146 - Part 2: Make mach "build" run "stage-package && android assemble-app" for mobile/android. r=glandium Android artifacts (GeckoView AARs, GeckoViewExample (and Fennec) APKs) require native libraries (`libxul.so`) and an omnijar (`omni.ja`). These are produced by `mach package` (really, the `stage-package` target). Engineers essentially never want a build without a package for mobile/android. This adds mobile/android-only tiers that run `mach package` and then `mach android assemble-app`. The latter consumes `libxul.so` and `omni.ja` to produce _all the things_ relevant to GeckoView engineers. Differential Revision: https://phabricator.services.mozilla.com/D41450
Makefile.in
config/baseconfig.mk
mobile/android/build.mk
mobile/android/gradle/with_gecko_binaries.gradle
testing/mozharness/configs/builds/releng_base_android_64_builds.py
testing/mozharness/configs/builds/releng_sub_android_configs/64_api_16_debug_ccov.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -162,16 +162,24 @@ recurse_android-fat-aar-artifact:
 	$(call py_action,fat_aar,\
     $(addprefix --armeabi-v7a $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_ARMEABI_V7A)) \
     $(addprefix --arm64-v8a $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_ARM64_V8A)) \
     $(addprefix --x86 $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_X86)) \
     $(addprefix --x86-64 $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_X86_64)) \
     --distdir $(abspath $(DIST)/fat-aar))
 endif
 
+ifeq ($(MOZ_BUILD_APP),mobile/android)
+
+recurse_android-stage-package: stage-package
+
+recurse_android-archive-geckoview:
+	GRADLE_INVOKED_WITHIN_MACH_BUILD=1 $(topsrcdir)/mach --log-no-times android archive-geckoview
+endif
+
 ifdef MOZ_WIDGET_TOOLKIT
 ifdef ENABLE_TESTS
 # Additional makefile targets to call automated test suites
 include $(topsrcdir)/testing/testsuite-targets.mk
 endif
 endif
 
 default all::
--- a/config/baseconfig.mk
+++ b/config/baseconfig.mk
@@ -38,29 +38,33 @@ ifeq (a,$(firstword a$(subst /, ,$(srcdi
 endif
 endif
 endif # WINNT
 
 ifndef INCLUDED_AUTOCONF_MK
 default::
 else
 # All possible tiers
-ALL_TIERS := artifact win32-artifact android-fat-aar-artifact pre-export export rust compile misc libs tools check
+ALL_TIERS := artifact win32-artifact android-fat-aar-artifact pre-export export rust compile misc libs android-stage-package android-archive-geckoview tools check
 
 # All tiers that may be used manually via `mach build $tier`
 RUNNABLE_TIERS := $(ALL_TIERS)
 ifndef MOZ_ARTIFACT_BUILDS
 RUNNABLE_TIERS := $(filter-out artifact,$(RUNNABLE_TIERS))
 endif
 ifndef MOZ_EME_WIN32_ARTIFACT
 RUNNABLE_TIERS := $(filter-out win32-artifact,$(RUNNABLE_TIERS))
 endif
 ifndef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
 RUNNABLE_TIERS := $(filter-out android-fat-aar-artifact,$(RUNNABLE_TIERS))
 endif
+ifneq ($(MOZ_BUILD_APP),mobile/android)
+RUNNABLE_TIERS := $(filter-out android-stage-package,$(RUNNABLE_TIERS))
+RUNNABLE_TIERS := $(filter-out android-archive-geckoview,$(RUNNABLE_TIERS))
+endif
 
 # All tiers that run automatically on `mach build`
 TIERS := $(filter-out check,$(RUNNABLE_TIERS))
 ifndef COMPILE_ENVIRONMENT
 TIERS := $(filter-out rust compile,$(TIERS))
 endif
 ifndef MOZ_RUST_TIER
 TIERS := $(filter-out rust,$(TIERS))
--- a/mobile/android/build.mk
+++ b/mobile/android/build.mk
@@ -4,18 +4,28 @@
 
 include  $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
 
 installer:
 	@$(MAKE) -C mobile/android/installer installer
 
 package:
 	# Setting MOZ_GECKOVIEW_JAR makes the installer generate a separate GeckoView JAR
+ifdef MOZ_ANDROID_WITH_FENNEC
 	@$(MAKE) MOZ_GECKOVIEW_JAR=1 -C mobile/android/installer stage-package
 	@$(MAKE) -C mobile/android/installer
+else
+	@$(MAKE) MOZ_GECKOVIEW_JAR=1 -C mobile/android/installer
+endif # MOZ_ANDROID_WITH_FENNEC
+
+stage-package:
+	$(MAKE) MOZ_GECKOVIEW_JAR=1 -C mobile/android/installer stage-package
+ifdef MOZ_ANDROID_WITH_FENNEC
+	$(MAKE) -C mobile/android/installer stage-package
+endif # MOZ_ANDROID_WITH_FENNEC
 
 ifeq ($(OS_TARGET),Android)
 ifneq ($(MOZ_ANDROID_INSTALL_TARGET),)
 ANDROID_SERIAL = $(MOZ_ANDROID_INSTALL_TARGET)
 endif
 ifneq ($(ANDROID_SERIAL),)
 export ANDROID_SERIAL
 else
--- a/mobile/android/gradle/with_gecko_binaries.gradle
+++ b/mobile/android/gradle/with_gecko_binaries.gradle
@@ -27,16 +27,21 @@ ext.configureVariantWithGeckoBinaries = 
              "${omnijarDir}/assets/omni.ja") {
             // Throw an exception if we find multiple, potentially conflicting omni.ja files.
             duplicatesStrategy 'fail'
         }
     }
 
     def syncLibsFromDistDir = task("syncLibsFromDistDirFor${variant.name.capitalize()}", type: Sync) {
         onlyIf {
+            if (!mozconfig.substs.COMPILE_ENVIRONMENT && !mozconfig.substs.MOZ_ARTIFACT_BUILDS) {
+                // We won't have JNI libraries if we're not compiling and we're not downloading
+                // artifacts.  Such a configuration is used for running lints, generating docs, etc.
+                return true
+            }
             if (source.empty) {
                 throw new StopExecutionException("Required JNI libraries not found in ${distDir}/lib.  Have you built and packaged?")
             }
             return true
         }
 
         into("${project.buildDir}/moz.build/src/${variant.name}/jniLibs")
         from("${distDir}/lib")
--- a/testing/mozharness/configs/builds/releng_base_android_64_builds.py
+++ b/testing/mozharness/configs/builds/releng_base_android_64_builds.py
@@ -69,18 +69,9 @@ config = {
         'SHIP_LICENSED_FONTS': '1',
     },
     "check_test_env": {
         'MINIDUMP_STACKWALK': '%(abs_tools_dir)s/breakpad/linux/minidump_stackwalk',
         'MINIDUMP_SAVE_PATH': '%(base_work_dir)s/minidumps',
     },
     'src_mozconfig': 'mobile/android/config/mozconfigs/android/nightly',
     #########################################################################
-
-    # It's not obvious, but postflight_build is after packaging, so the Gecko
-    # binaries are in the object directory, ready to be packaged into the
-    # GeckoView AAR.
-    'postflight_build_mach_commands': [
-        ['android',
-         'archive-geckoview',
-        ],
-    ],
 }
--- a/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_16_debug_ccov.py
+++ b/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_16_debug_ccov.py
@@ -1,14 +1,11 @@
 config = {
     'stage_platform': 'android-api-16-debug-ccov',
     'src_mozconfig': 'mobile/android/config/mozconfigs/android-api-16/debug-ccov',
     'multi_locale_config_platform': 'android',
     'debug_build': True,
     'postflight_build_mach_commands': [
         ['android',
-         'archive-geckoview',
-        ],
-        ['android',
          'archive-coverage-artifacts',
         ],
     ],
 }