diff --git a/configure.in b/configure.in index 4f0967538b7..aedfd392a0c 100644 --- a/configure.in +++ b/configure.in @@ -3758,7 +3758,6 @@ MOZ_SCTP= MOZ_ANDROID_OMX= MOZ_MEDIA_NAVIGATOR= MOZ_OMX_PLUGIN= -MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE= MOZ_VPX_ERROR_CONCEALMENT= MOZ_WEBSPEECH=1 MOZ_WEBSPEECH_MODELS= @@ -5367,26 +5366,8 @@ if test -n "$MOZ_OMX_PLUGIN"; then dnl Only allow building OMX plugin on Gonk (B2G) or Android AC_DEFINE(MOZ_OMX_PLUGIN) else - dnl fail if we're not building on Gonk or Android - AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android]) - fi -fi - -dnl ======================================================== -dnl = Enable building mobile/android with Gradle -dnl ======================================================== -MOZ_ARG_ENABLE_BOOL(gradle-mobile-android-builds, -[ --enable-gradle-mobile-android-builds Enable building mobile/android with Gradle], - MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE=1, - MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE=) - -if test -n "$MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE"; then - if test "$OS_TARGET" = "Android" -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then - dnl Only allow building mobile/android with Gradle. - AC_DEFINE(MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE) - else - dnl fail if we're not building mobile/android. - AC_MSG_ERROR([Can only build mobile/android with Gradle]) + dnl fail if we're not building on Gonk or Android + AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android]) fi fi @@ -8926,7 +8907,6 @@ AC_SUBST(MOZ_DIRECTSHOW) AC_SUBST(MOZ_ANDROID_OMX) AC_SUBST(MOZ_APPLEMEDIA) AC_SUBST(MOZ_OMX_PLUGIN) -AC_SUBST(MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE) AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT) AC_SUBST(VPX_AS) AC_SUBST_LIST(VPX_ASFLAGS) diff --git a/mobile/android/base/Makefile.in b/mobile/android/base/Makefile.in index ee2843a5265..0a455191c09 100644 --- a/mobile/android/base/Makefile.in +++ b/mobile/android/base/Makefile.in @@ -2,12 +2,6 @@ # 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/. -# We call mach -> Make -> gradle -> mach, which races to find and -# create .mozconfig files and to generate targets. -ifdef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE -.NOTPARALLEL: -endif - MOZ_BUILDID := $(shell cat $(DEPTH)/config/buildid) # Set the appropriate version code, based on the existance of the @@ -207,21 +201,9 @@ endif # MOZ_INSTALL_TRACKING library_jars := $(subst $(NULL) ,:,$(strip $(library_jars))) -gradle_dir := $(topobjdir)/gradle/build/mobile/android - -ifdef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE -.gradle.deps: .aapt.deps FORCE - @$(TOUCH) $@ - $(topsrcdir)/mach gradle --no-daemon --offline app:dexAutomationDebug app:assembleAutomationDebugAndroidTest -x lint - -classes.dex: .gradle.deps - $(REPORT_BUILD) - cp $(gradle_dir)/app/intermediates/dex/automation/debug/classes.dex $@ -else classes.dex: .proguard.deps $(REPORT_BUILD) $(DX) --dex --output=classes.dex jars-proguarded -endif ifdef MOZ_DISABLE_PROGUARD PROGUARD_PASSES=0 @@ -519,13 +501,8 @@ endef # .aapt.deps: $(all_resources) $(eval $(call aapt_command,.aapt.deps,$(all_resources),gecko.ap_,generated/,./)) -ifdef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE -.aapt.nodeps: FORCE - cp $(gradle_dir)/app/intermediates/res/resources-automation-debug.ap_ gecko-nodeps.ap_ -else -# .aapt.nodeps: $(CURDIR)/AndroidManifest.xml FORCE -$(eval $(call aapt_command,.aapt.nodeps,$(CURDIR)/AndroidManifest.xml FORCE,gecko-nodeps.ap_,gecko-nodeps/,gecko-nodeps/)) -endif +# .aapt.nodeps: $(abspath $(CURDIR)/AndroidManifest.xml) FORCE +$(eval $(call aapt_command,.aapt.nodeps,$(abspath $(CURDIR)/AndroidManifest.xml) FORCE,gecko-nodeps.ap_,gecko-nodeps/,gecko-nodeps/)) # Override the Java settings with some specific android settings include $(topsrcdir)/config/android-common.mk @@ -555,14 +532,7 @@ gradle-targets: $(foreach f,$(constants_PP_JAVAFILES),$(f)) gradle-targets: $(abspath AndroidManifest.xml) gradle-targets: $(ANDROID_GENERATED_RESFILES) -ifndef MOZILLA_OFFICIAL -# Local developers update omni.ja during their builds. There's a -# chicken-and-egg problem here. -gradle-omnijar: $(abspath $(DIST)/fennec/$(OMNIJAR_NAME)) -else -# In automation, omni.ja is built only during packaging. -gradle-omnijar: -endif +gradle-omnijar: $(ABS_DIST)/fennec/$(OMNIJAR_NAME) .PHONY: gradle-targets gradle-omnijar @@ -573,8 +543,8 @@ endif # GeneratedJNIWrappers.cpp target also generates # GeneratedJNIWrappers.h and GeneratedJNINatives.h -ifndef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE -libs:: jni-stubs.inc GeneratedJNIWrappers.cpp +libs:: classes.dex jni-stubs.inc GeneratedJNIWrappers.cpp $(CURDIR)/fennec_ids.txt + $(INSTALL) classes.dex $(FINAL_TARGET) @(diff jni-stubs.inc $(topsrcdir)/mozglue/android/jni-stubs.inc >/dev/null && \ diff GeneratedJNIWrappers.cpp $(topsrcdir)/widget/android/GeneratedJNIWrappers.cpp >/dev/null && \ diff GeneratedJNIWrappers.h $(topsrcdir)/widget/android/GeneratedJNIWrappers.h >/dev/null && \ @@ -588,9 +558,3 @@ libs:: jni-stubs.inc GeneratedJNIWrappers.cpp echo '* Repeat the build, and check in any changes. *' && \ echo '*****************************************************' && \ exit 1) -endif - -libs:: $(CURDIR)/fennec_ids.txt - -libs:: classes.dex - $(INSTALL) classes.dex $(FINAL_TARGET) diff --git a/mobile/android/mach_commands.py b/mobile/android/mach_commands.py index 11cafbdcbbb..329ca25e502 100644 --- a/mobile/android/mach_commands.py +++ b/mobile/android/mach_commands.py @@ -21,6 +21,16 @@ from mach.decorators import ( Command, ) +SUCCESS = ''' +You should be ready to build with Gradle and import into IntelliJ! Test with + + ./mach gradle build + +and in IntelliJ select File > Import project... and choose + + {topobjdir}/mobile/android/gradle +''' + # NOTE python/mach/mach/commands/commandinfo.py references this function # by name. If this function is renamed or removed, that file should diff --git a/mobile/android/moz.build b/mobile/android/moz.build index d7d6eb6f2af..049293ed682 100644 --- a/mobile/android/moz.build +++ b/mobile/android/moz.build @@ -31,9 +31,8 @@ if CONFIG['MOZ_ANDROID_PACKAGE_INSTALL_BOUNCER']: DIRS += ['../../xulrunner/tools/redit'] -if not CONFIG['MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE']: - TEST_DIRS += [ - 'tests', - ] +TEST_DIRS += [ + 'tests', +] SPHINX_TREES['fennec'] = 'docs' diff --git a/python/mozbuild/mozbuild/mozconfig.py b/python/mozbuild/mozbuild/mozconfig.py index a60b79774dd..2e829422d8d 100644 --- a/python/mozbuild/mozbuild/mozconfig.py +++ b/python/mozbuild/mozbuild/mozconfig.py @@ -107,7 +107,7 @@ class MozconfigLoader(ProcessExecutionMixin): if 'MOZ_MYCONFIG' in env: raise MozconfigFindException(MOZ_MYCONFIG_ERROR) - env_path = env.get('MOZCONFIG', None) or None + env_path = env.get('MOZCONFIG', None) if env_path is not None: if not os.path.isabs(env_path): potential_roots = [self.topsrcdir, os.getcwd()] diff --git a/testing/instrumentation/Makefile.in b/testing/instrumentation/Makefile.in index 0ccb15a2c8f..6b1c225c87b 100644 --- a/testing/instrumentation/Makefile.in +++ b/testing/instrumentation/Makefile.in @@ -14,12 +14,10 @@ include $(topsrcdir)/config/android-common.mk stage-package: $(NSINSTALL) -D $(_DEST_DIR) -ifndef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE $(call RELEASE_SIGN_ANDROID_APK,\ $(DEPTH)/mobile/android/tests/background/junit3/background-junit3-debug-unsigned-unaligned.apk,\ $(_DEST_DIR)/background-junit3.apk) $(call RELEASE_SIGN_ANDROID_APK,\ $(DEPTH)/mobile/android/tests/browser/junit3/browser-junit3-debug-unsigned-unaligned.apk,\ $(_DEST_DIR)/browser-junit3.apk) -endif @(cd $(DEPTH)/_tests/ && tar $(TAR_CREATE_FLAGS) - instrumentation) | (cd $(PKG_STAGE) && tar -xf -) diff --git a/testing/mochitest/Makefile.in b/testing/mochitest/Makefile.in index a0448dcd7bb..e4eedf120bf 100644 --- a/testing/mochitest/Makefile.in +++ b/testing/mochitest/Makefile.in @@ -107,15 +107,11 @@ $(_DEST_DIR): ifeq ($(MOZ_BUILD_APP),mobile/android) include $(topsrcdir)/config/android-common.mk -ifndef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE -robocop_apk := $(topobjdir)/mobile/android/tests/browser/robocop/robocop-debug-unsigned-unaligned.apk -else -robocop_apk := $(topobjdir)/gradle/build/mobile/android/app/outputs/apk/app-automation-debug-androidTest-unaligned.apk -endif - stage-package-android: $(NSINSTALL) -D $(_DEST_DIR) - $(call RELEASE_SIGN_ANDROID_APK,$(robocop_apk),$(_DEST_DIR)/robocop.apk) + $(call RELEASE_SIGN_ANDROID_APK,\ + $(DEPTH)/mobile/android/tests/browser/robocop/robocop-debug-unsigned-unaligned.apk,\ + $(_DEST_DIR)/robocop.apk) stage-package: stage-package-android endif diff --git a/toolkit/mozapps/installer/upload-files.mk b/toolkit/mozapps/installer/upload-files.mk index d4297fa3fd8..9cfe53c11c3 100644 --- a/toolkit/mozapps/installer/upload-files.mk +++ b/toolkit/mozapps/installer/upload-files.mk @@ -325,18 +325,13 @@ UPLOAD_EXTRA_FILES += geckoview_library/geckoview_assets.zip # Robocop/Robotium tests, Android Background tests, and Fennec need to # be signed with the same key, which means release signing them all. -ifndef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE -robocop_apk := $(topobjdir)/mobile/android/tests/browser/robocop/robocop-debug-unsigned-unaligned.apk -else -robocop_apk := $(topobjdir)/gradle/build/mobile/android/app/outputs/apk/app-automation-debug-androidTest-unaligned.apk -endif - +ROBOCOP_PATH = $(topobjdir)/mobile/android/tests/browser/robocop # Normally, $(NSINSTALL) would be used instead of cp, but INNER_ROBOCOP_PACKAGE # is used in a series of commands that run under a "cd something", while # $(NSINSTALL) is relative. INNER_ROBOCOP_PACKAGE= \ cp $(GECKO_APP_AP_PATH)/fennec_ids.txt $(ABS_DIST) && \ - $(call RELEASE_SIGN_ANDROID_APK,$(robocop_apk),$(ABS_DIST)/robocop.apk) + $(call RELEASE_SIGN_ANDROID_APK,$(ROBOCOP_PATH)/robocop-debug-unsigned-unaligned.apk,$(ABS_DIST)/robocop.apk) endif else INNER_ROBOCOP_PACKAGE=echo 'Testing is disabled - No Android Robocop for you' @@ -475,15 +470,6 @@ PKG_SUFFIX = .apk INNER_SZIP_LIBRARIES = \ $(if $(ALREADY_SZIPPED),,$(foreach lib,$(SZIP_LIBRARIES),host/bin/szip $(MOZ_SZIP_FLAGS) $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/$(lib) && )) true -ifdef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE -INNER_CHECK_R_TXT=echo 'No R.txt checking for you!' -else -INNER_CHECK_R_TXT=\ - ((test ! -f $(GECKO_APP_AP_PATH)/R.txt && echo "*** Warning: The R.txt that is being packaged might not agree with the R.txt that was built. This is normal during l10n repacks.") || \ - diff $(GECKO_APP_AP_PATH)/R.txt $(GECKO_APP_AP_PATH)/gecko-nodeps/R.txt >/dev/null || \ - (echo "*** Error: The R.txt that was built and the R.txt that is being packaged are not the same. Rebuild mobile/android/base and re-package." && exit 1)) -endif - # Insert $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/classes.dex into # $(ABS_DIST)/gecko.ap_, producing $(ABS_DIST)/gecko.apk. INNER_MAKE_APK = \ @@ -504,11 +490,13 @@ INNER_MAKE_APK = \ $(ZIPALIGN) -f -v 4 $(ABS_DIST)/gecko.apk $(PACKAGE) ifeq ($(MOZ_BUILD_APP),mobile/android) -INNER_MAKE_PACKAGE = \ +INNER_MAKE_PACKAGE = \ $(INNER_SZIP_LIBRARIES) && \ make -C $(GECKO_APP_AP_PATH) gecko-nodeps.ap_ && \ cp $(GECKO_APP_AP_PATH)/gecko-nodeps.ap_ $(ABS_DIST)/gecko.ap_ && \ - $(INNER_CHECK_R_TXT) && \ + ( (test ! -f $(GECKO_APP_AP_PATH)/R.txt && echo "*** Warning: The R.txt that is being packaged might not agree with the R.txt that was built. This is normal during l10n repacks.") || \ + diff $(GECKO_APP_AP_PATH)/R.txt $(GECKO_APP_AP_PATH)/gecko-nodeps/R.txt >/dev/null || \ + (echo "*** Error: The R.txt that was built and the R.txt that is being packaged are not the same. Rebuild mobile/android/base and re-package." && exit 1)) && \ $(INNER_MAKE_APK) && \ $(INNER_ROBOCOP_PACKAGE) && \ $(INNER_INSTALL_BOUNCER_PACKAGE) && \ @@ -517,7 +505,7 @@ INNER_MAKE_PACKAGE = \ endif ifeq ($(MOZ_BUILD_APP),mobile/android/b2gdroid) -INNER_MAKE_PACKAGE = \ +INNER_MAKE_PACKAGE = \ $(INNER_SZIP_LIBRARIES) && \ cp $(topobjdir)/mobile/android/b2gdroid/app/classes.dex $(ABS_DIST)/classes.dex && \ cp $(topobjdir)/mobile/android/b2gdroid/app/b2gdroid-unsigned-unaligned.apk $(ABS_DIST)/gecko.ap_ && \