From 851257343ae7e9b991b48878b241e9b1a7877b93 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Mon, 24 Aug 2020 18:13:49 +0000 Subject: [PATCH] Bug 1626336 - Remove `MOZ_GECKOVIEW_JAR`. r=agi,geckoview-reviewers While we're here we remove some Gradle Fennec-isms that are no longer needed. Differential Revision: https://phabricator.services.mozilla.com/D87334 --- build.gradle | 69 +++++++------------ mobile/android/build.mk | 5 +- .../android/gradle/with_gecko_binaries.gradle | 20 ++---- mobile/android/installer/Makefile.in | 5 -- mobile/android/installer/package-manifest.in | 16 ----- mobile/android/mach_commands.py | 10 --- testing/testsuite-targets.mk | 2 +- 7 files changed, 31 insertions(+), 96 deletions(-) diff --git a/build.gradle b/build.gradle index f3e8ca671b99..4a18fdfcd651 100644 --- a/build.gradle +++ b/build.gradle @@ -120,15 +120,9 @@ ext.geckoBinariesOnlyIf = { task -> return false } - // Multi-l10n builds set `AB_CD=multi`, which isn't a valid locale. This - // causes the - // - // |mach build| > |mach gradle| > - // |mach build mobile/android/base/generated_android_code_and_resources| > - // AndroidManifest.xml > strings.xml > multi/brand.dtd - // - // dependency chain to fail, since multi isn't a real locale. To avoid - // this, if Gradle is invoked with AB_CD=multi, we don't invoke Make at all. + // Multi-l10n builds set `AB_CD=multi`, which isn't a valid locale. To + // avoid failures, if Gradle is invoked with AB_CD=multi, we don't invoke + // Make at all. if ('multi' == System.env.AB_CD) { rootProject.logger.lifecycle("Skipping task ${task.path} because: AB_CD=multi") return false @@ -157,12 +151,6 @@ class MachExec extends Exec { } } -// Why |mach build mobile/android/base/...| and |mach build faster|? |mach -// build faster| generates dependentlibs.list, which in turn depends on compiled -// code. That causes a circular dependency between Java compilation/JNI wrapper -// generation/native code compilation. So we have the special target for -// Android-specific generated code, and the |mach build faster| target for all -// the stuff that goes into the omnijar. task machBuildFaster(type: MachExec) { onlyIf rootProject.ext.geckoBinariesOnlyIf @@ -183,42 +171,31 @@ task machBuildFaster(type: MachExec) { errorOutput = standardOutput } -def createMachStagePackageTask(name) { - return task(name, type: MachExec) { - onlyIf rootProject.ext.geckoBinariesOnlyIf +task machStagePackage(type: MachExec) { + onlyIf rootProject.ext.geckoBinariesOnlyIf - dependsOn rootProject.machBuildFaster + dependsOn rootProject.machBuildFaster - workingDir "${topobjdir}" + workingDir "${topobjdir}" - // We'd prefer this to be a `mach` invocation, but `mach build - // mobile/android/installer/stage-package` doesn't work as expected. - commandLine mozconfig.substs.GMAKE - args '-C' - args "${topobjdir}/mobile/android/installer" - args 'stage-package' + // We'd prefer this to be a `mach` invocation, but `mach build + // mobile/android/installer/stage-package` doesn't work as expected. + commandLine mozconfig.substs.GMAKE + args '-C' + args "${topobjdir}/mobile/android/installer" + args 'stage-package' - outputs.file "${topobjdir}/dist/fennec/assets/${mozconfig.substs.ANDROID_CPU_ARCH}/libxul.so" - outputs.file "${topobjdir}/dist/fennec/lib/${mozconfig.substs.ANDROID_CPU_ARCH}/libmozglue.so" - - // Force running `stage-package`. - outputs.upToDateWhen { false } - - // `path` is like `:machStagePackage`. - standardOutput = new TaggedLogOutputStream("${path}>", logger) - errorOutput = standardOutput - } -} - -createMachStagePackageTask("machStagePackageForFennec").with { - outputs.file "${topobjdir}/dist/fennec/assets/omni.ja" -} - -createMachStagePackageTask("machStagePackageForGeckoview").with { - args 'MOZ_GECKOVIEW_JAR=1' outputs.file "${topobjdir}/dist/geckoview/assets/omni.ja" - // Avoid races between stage-package invocations. - mustRunAfter tasks["machStagePackageForFennec"] + + outputs.file "${topobjdir}/dist/geckoview/assets/${mozconfig.substs.ANDROID_CPU_ARCH}/libxul.so" + outputs.file "${topobjdir}/dist/geckoview/lib/${mozconfig.substs.ANDROID_CPU_ARCH}/libmozglue.so" + + // Force running `stage-package`. + outputs.upToDateWhen { false } + + // `path` is like `:machStagePackage`. + standardOutput = new TaggedLogOutputStream("${path}>", logger) + errorOutput = standardOutput } afterEvaluate { diff --git a/mobile/android/build.mk b/mobile/android/build.mk index 1f2e1048eb8c..53289ed9a218 100644 --- a/mobile/android/build.mk +++ b/mobile/android/build.mk @@ -8,11 +8,10 @@ installer: @$(MAKE) -C mobile/android/installer installer package: - # Setting MOZ_GECKOVIEW_JAR makes the installer generate a separate GeckoView JAR - @$(MAKE) MOZ_GECKOVIEW_JAR=1 -C mobile/android/installer + @$(MAKE) -C mobile/android/installer stage-package: - $(MAKE) MOZ_GECKOVIEW_JAR=1 -C mobile/android/installer stage-package + $(MAKE) -C mobile/android/installer stage-package deb: package @$(MAKE) -C mobile/android/installer deb diff --git a/mobile/android/gradle/with_gecko_binaries.gradle b/mobile/android/gradle/with_gecko_binaries.gradle index f586c2663801..59036f5a5ce4 100644 --- a/mobile/android/gradle/with_gecko_binaries.gradle +++ b/mobile/android/gradle/with_gecko_binaries.gradle @@ -146,12 +146,8 @@ class SyncLibsAndUpdateGeneration extends DefaultTask { } ext.configureVariantWithGeckoBinaries = { variant -> - // :app needs the full Fennec omni.ja, whereas other projects need the - // GeckoView-specific omni.ja. - def omnijarDir = { "${topobjdir}/dist/${it}" }("app".equals(project.name) ? "fennec" : "geckoview") - // All projects take the same Gecko libraries, which (for historical - // reasons) are in "fennec". - def distDir = "${topobjdir}/dist/fennec" + def omnijarDir = "${topobjdir}/dist/geckoview" + def distDir = "${topobjdir}/dist/geckoview" def syncOmnijarFromDistDir = task("syncOmnijarFromDistDirFor${variant.name.capitalize()}", type: Sync) { onlyIf { @@ -208,15 +204,9 @@ ext.configureVariantWithGeckoBinaries = { variant -> // moz.build system, which can be re-entrant. Official builds are driven by // the moz.build system and should never be re-entrant in this way. if (!mozconfig.substs.MOZILLA_OFFICIAL) { - if ("app".equals(project.name)) { - syncOmnijarFromDistDir.dependsOn rootProject.machStagePackageForFennec - syncLibsFromDistDir.dependsOn rootProject.machStagePackageForFennec - syncAssetsFromDistDir.dependsOn rootProject.machStagePackageForFennec - } else { - syncOmnijarFromDistDir.dependsOn rootProject.machStagePackageForGeckoview - syncLibsFromDistDir.dependsOn rootProject.machStagePackageForGeckoview - syncAssetsFromDistDir.dependsOn rootProject.machStagePackageForGeckoview - } + syncOmnijarFromDistDir.dependsOn rootProject.machStagePackage + syncLibsFromDistDir.dependsOn rootProject.machStagePackage + syncAssetsFromDistDir.dependsOn rootProject.machStagePackage } def assetGenTask = tasks.findByName("generate${variant.name.capitalize()}Assets") diff --git a/mobile/android/installer/Makefile.in b/mobile/android/installer/Makefile.in index 7341a88db749..0a0577d42081 100644 --- a/mobile/android/installer/Makefile.in +++ b/mobile/android/installer/Makefile.in @@ -42,12 +42,7 @@ ifdef MOZ_ARTIFACT_BUILDS DEFINES += -DMOZ_ARTIFACT_BUILDS=1 endif -ifdef MOZ_GECKOVIEW_JAR -# Generate a GeckoView-specific omni.ja under dist/geckoview/omni.ja, -# alongside the full omni.ja used by Fennec under dist/fennec/omni.ja. -DEFINES += -DMOZ_GECKOVIEW_JAR=1 MOZ_PKG_DIR = geckoview -endif ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES DEFINES += -DMOZ_ANDROID_FAT_AAR_ARCHITECTURES=1 diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index 17d6471c4742..692ba016b6f2 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -24,13 +24,7 @@ @BINPATH@/hyphenation/* @BINPATH@/localization/* -; We want fennec/lib for both Fennec and GeckoView, so we turn -; geckoview/lib into fennec/lib. -#ifndef MOZ_GECKOVIEW_JAR [lib destdir="lib/@ANDROID_CPU_ARCH@"] -#else -[lib destdir="../fennec/lib/@ANDROID_CPU_ARCH@"] -#endif #ifdef MOZ_CLANG_RT_ASAN_LIB @BINPATH@/@MOZ_CLANG_RT_ASAN_LIB@ @@ -139,7 +133,6 @@ ; [Default Preferences] ; All the pref files must be part of base to prevent migration bugs -#ifdef MOZ_GECKOVIEW_JAR #ifndef MOZ_ANDROID_FAT_AAR_ARCHITECTURES @BINPATH@/@ANDROID_CPU_ARCH@/greprefs.js @BINPATH@/@PREF_DIR@/@ANDROID_CPU_ARCH@/geckoview-prefs.js @@ -147,10 +140,6 @@ @BINPATH@/*/greprefs.js @BINPATH@/@PREF_DIR@/*/geckoview-prefs.js #endif # !MOZ_ANDROID_FAT_AAR_ARCHITECTURES -#else -@BINPATH@/@ANDROID_CPU_ARCH@/greprefs.js -@BINPATH@/@PREF_DIR@/mobile.js -#endif # MOZ_GECKOVIEW_JAR @BINPATH@/@PREF_DIR@/channel-prefs.js @BINPATH@/defaults/autoconfig/prefcalls.js @@ -214,12 +203,7 @@ @BINPATH@/chrome/geckoview@JAREXT@ @BINPATH@/chrome/geckoview.manifest -#ifdef MOZ_GECKOVIEW_JAR @BINPATH@/components/GeckoView.manifest -#else -@BINPATH@/chrome/chrome@JAREXT@ -@BINPATH@/chrome/chrome.manifest -#endif ; Remote control protocol #ifdef ENABLE_MARIONETTE diff --git a/mobile/android/mach_commands.py b/mobile/android/mach_commands.py index 2ceee421aaf2..11d9494aaa83 100644 --- a/mobile/android/mach_commands.py +++ b/mobile/android/mach_commands.py @@ -98,16 +98,6 @@ class MachCommands(MachCommandBase): return ret - @SubCommand('android', 'generate-fennec-jni-wrappers', - """Generate Fennec-specific JNI wrappers used when building - Firefox for Android.""") - @CommandArgument('args', nargs=argparse.REMAINDER) - def android_generate_fennec_jni_wrappers(self, args): - ret = self.gradle( - self.substs['GRADLE_ANDROID_GENERATE_FENNEC_JNI_WRAPPERS_TASKS'] + args, verbose=True) - - return ret - @SubCommand('android', 'api-lint', """Run Android api-lint. REMOVED/DEPRECATED: Use 'mach lint --linter android-api-lint'.""") diff --git a/testing/testsuite-targets.mk b/testing/testsuite-targets.mk index be8a8db3732e..32d7c090e991 100644 --- a/testing/testsuite-targets.mk +++ b/testing/testsuite-targets.mk @@ -83,7 +83,7 @@ GARBAGE += $(addsuffix .log,$(MOCHITESTS) reftest crashtest jstestbrowser) REMOTE_CPPUNITTESTS = \ $(PYTHON3) -u $(topsrcdir)/testing/remotecppunittests.py \ --xre-path=$(DEPTH)/dist/bin \ - --localLib=$(DEPTH)/dist/fennec \ + --localLib=$(DEPTH)/dist/geckoview \ --deviceIP=${TEST_DEVICE} \ $(TEST_PATH) $(EXTRA_TEST_ARGS)