Bug 1254355 - Part 2: Make *Constants.java GENERATED_FILES. r?glandium
This has the slight cost of not displaying all of the -D preprocessor
options in the logs.
MozReview-Commit-ID: IinGqVWlYzW
--- a/mobile/android/base/AdjustConstants.java.in
+++ b/mobile/android/base/AdjustConstants.java.in
@@ -1,10 +1,9 @@
//#filter substitution
-//#include @OBJDIR@/adjust_sdk_app_token
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
package org.mozilla.gecko;
import org.mozilla.gecko.adjust.AdjustHelperInterface;
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -96,22 +96,18 @@ public class AppConstants {
// GRE_BUILDID is exactly the same as MOZ_APP_BUILDID unless you're running
// on XULRunner, which is never the case on Android.
public static final String MOZ_APP_BUILDID = "@MOZ_BUILDID@";
public static final String MOZ_APP_ID = "@MOZ_APP_ID@";
public static final String MOZ_APP_NAME = "@MOZ_APP_NAME@";
public static final String MOZ_APP_VENDOR = "@MOZ_APP_VENDOR@";
public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
public static final String MOZ_APP_DISPLAYNAME = "@MOZ_APP_DISPLAYNAME@";
- // MOZ_APP_UA_NAME is already quoted when it gets substituted, like MOZILLA_VERSION.
- public static final String MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@;
-
- // MOZILLA_VERSION is already quoted when it gets substituted in. If we
- // add additional quotes we end up with ""x.y"", which is a syntax error.
- public static final String MOZILLA_VERSION = @MOZILLA_VERSION@;
+ public static final String MOZ_APP_UA_NAME = "@MOZ_APP_UA_NAME@";
+ public static final String MOZILLA_VERSION = "@MOZILLA_VERSION@";
public static final String MOZ_MOZILLA_API_KEY = "@MOZ_MOZILLA_API_KEY@";
public static final boolean MOZ_STUMBLER_BUILD_TIME_ENABLED =
//#ifdef MOZ_ANDROID_MLS_STUMBLER
true;
//#else
false;
//#endif
@@ -129,17 +125,17 @@ public class AppConstants {
//#else
null;
//#endif
public static final String MOZ_CHILD_PROCESS_NAME = "@MOZ_CHILD_PROCESS_NAME@";
public static final String MOZ_UPDATE_CHANNEL = "@MOZ_UPDATE_CHANNEL@";
public static final String OMNIJAR_NAME = "@OMNIJAR_NAME@";
public static final String OS_TARGET = "@OS_TARGET@";
- public static final String TARGET_XPCOM_ABI = @TARGET_XPCOM_ABI@;
+ public static final String TARGET_XPCOM_ABI = "@TARGET_XPCOM_ABI@";
public static final String USER_AGENT_BOT_LIKE = "Redirector/" + AppConstants.MOZ_APP_VERSION +
" (Android; rv:" + AppConstants.MOZ_APP_VERSION + ")";
public static final String USER_AGENT_FENNEC_MOBILE = "Mozilla/5.0 (Android " +
Build.VERSION.RELEASE + "; Mobile; rv:" +
AppConstants.MOZ_APP_VERSION + ") Gecko/" +
AppConstants.MOZ_APP_VERSION + " Firefox/" +
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -3,38 +3,16 @@
# 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 awk '{print $$3}' $(DEPTH)/buildid.h)
-
-# Set the appropriate version code, based on the existance of the
-# MOZ_APP_ANDROID_VERSION_CODE variable.
-ifdef MOZ_APP_ANDROID_VERSION_CODE
- ANDROID_VERSION_CODE:=$(MOZ_APP_ANDROID_VERSION_CODE)
-else
- ANDROID_VERSION_CODE:=$(shell $(PYTHON) \
- $(topsrcdir)/python/mozbuild/mozbuild/android_version_code.py \
- --verbose \
- --with-android-cpu-arch=$(ANDROID_CPU_ARCH) \
- $(if $(MOZ_ANDROID_MIN_SDK_VERSION),--with-android-min-sdk=$(MOZ_ANDROID_MIN_SDK_VERSION)) \
- $(if $(MOZ_ANDROID_MAX_SDK_VERSION),--with-android-max-sdk=$(MOZ_ANDROID_MAX_SDK_VERSION)) \
- $(MOZ_BUILDID))
-endif
-
-DEFINES += \
- -DANDROID_VERSION_CODE=$(ANDROID_VERSION_CODE) \
- -DMOZ_ANDROID_SHARED_ID="$(MOZ_ANDROID_SHARED_ID)" \
- -DMOZ_BUILDID=$(MOZ_BUILDID) \
- $(NULL)
-
GARBAGE += \
classes.dex \
gecko.ap_ \
res/values/strings.xml \
res/raw/browsersearch.json \
res/raw/suggestedsites.json \
.aapt.deps \
javah.out \
@@ -302,34 +280,16 @@ jni-stubs.inc: gecko-browser.jar constan
ANNOTATION_PROCESSOR_JAR_FILES := $(DEPTH)/build/annotationProcessors/annotationProcessors.jar
# This annotation processing step also generates
# GeneratedJNIWrappers.h and GeneratedJNINatives.h
GeneratedJNIWrappers.cpp: $(ANNOTATION_PROCESSOR_JAR_FILES)
GeneratedJNIWrappers.cpp: $(ALL_JARS)
$(JAVA) -classpath constants.jar:$(JAVA_BOOTCLASSPATH):$(JAVA_CLASSPATH):$(ANNOTATION_PROCESSOR_JAR_FILES) org.mozilla.gecko.annotationProcessors.AnnotationProcessor $(ALL_JARS)
-# Certain source files need to be preprocessed. This special rule
-# generates these files into generated/org/mozilla/gecko for
-# consumption by the build system and IDEs.
-
-# The list in moz.build looks like
-# 'preprocessed/org/mozilla/gecko/AppConstants.java'. The list in
-# constants_PP_JAVAFILES looks like
-# 'generated/preprocessed/org/mozilla/gecko/AppConstants.java'. We
-# need to write AppConstants.java.in to
-# generated/preprocessed/org/mozilla/gecko.
-preprocessed := $(addsuffix .in,$(subst generated/preprocessed/org/mozilla/gecko/,,$(filter generated/preprocessed/org/mozilla/gecko/%,$(constants_PP_JAVAFILES))))
-
-preprocessed_PATH := generated/preprocessed/org/mozilla/gecko
-preprocessed_KEEP_PATH := 1
-preprocessed_FLAGS := --marker='//\\\#'
-
-PP_TARGETS += preprocessed
-
include $(topsrcdir)/config/rules.mk
not_android_res_files := \
*.mkdir.done* \
*.DS_Store* \
*\#* \
*.rej \
*.orig \
@@ -519,17 +479,17 @@ update-generated-wrappers:
$(REPORT_BUILD)
$(MAKE) -C ../../../faster
$(MAKE) -C ../installer stage-package
$(MKDIR) -p $(@D)
rsync --update $(DIST)/fennec/$(notdir $(OMNIJAR_NAME)) $@
$(RM) $(DIST)/fennec/$(notdir $(OMNIJAR_NAME))
# Targets built very early during a Gradle build.
-gradle-targets: $(foreach f,$(constants_PP_JAVAFILES),$(f))
+gradle-targets: $(constants_PP_JAVAFILES)
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
deleted file mode 100644
--- a/mobile/android/base/adjust_sdk_app_token.in
+++ /dev/null
@@ -1,3 +0,0 @@
-//#ifdef MOZ_INSTALL_TRACKING
-//#define MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN @MOZ_INSTALL_TRACKING_ADJUST_SDK_APP_TOKEN@
-//#endif
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -1,27 +1,33 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
DIRS += ['locales']
-CONFIGURE_SUBST_FILES += ['adjust_sdk_app_token']
GENERATED_FILES += ['AndroidManifest.xml']
manifest = GENERATED_FILES['AndroidManifest.xml']
manifest.script = '/python/mozbuild/mozbuild/action/generate_android.py:generate_android_manifest'
manifest.inputs = ['AndroidManifest.xml.in']
GENERATED_FILES += ['fennec_ids.txt']
fennec_ids = GENERATED_FILES['fennec_ids.txt']
fennec_ids.script = '/python/mozbuild/mozbuild/action/generate_android.py:generate_fennec_ids'
fennec_ids.inputs = ['fennec_ids.txt.in']
+for f in ['AdjustConstants.java', 'AppConstants.java']:
+ p = 'generated/preprocessed/org/mozilla/gecko/' + f
+ GENERATED_FILES += [p]
+ gf = GENERATED_FILES[p]
+ gf.script = '/python/mozbuild/mozbuild/action/generate_android.py:generate_preprocessed_java'
+ gf.inputs = [f + '.in']
+
include('android-services.mozbuild')
thirdparty_source_dir = TOPSRCDIR + '/mobile/android/thirdparty/'
constants_jar = add_java_jar('constants')
constants_jar.sources = ['java/org/mozilla/gecko/' + x for x in [
'adjust/AdjustHelperInterface.java',
'annotation/JNITarget.java',
@@ -936,52 +942,16 @@ if CONFIG['MOZ_ANDROID_DISTRIBUTION_DIRE
# If you change this, also change its equivalent in mobile/android/bouncer.
if not CONFIG['MOZ_ANDROID_PACKAGE_INSTALL_BOUNCER']:
# If we are packaging the bouncer, it will have the distribution, so don't put
# it in the main APK as well.
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]:
- DEFINES[var] = 1
-
-for var in ('MOZ_UPDATER', 'MOZ_PKG_SPECIAL', 'MOZ_ANDROID_GCM_SENDERID'):
- if CONFIG[var]:
- DEFINES[var] = CONFIG[var]
-
-for var in ('ANDROID_PACKAGE_NAME', 'ANDROID_CPU_ARCH',
- 'GRE_MILESTONE', 'MOZ_APP_BASENAME', 'MOZ_MOZILLA_API_KEY',
- 'MOZ_APP_DISPLAYNAME', 'MOZ_APP_UA_NAME', 'MOZ_APP_ID', 'MOZ_APP_NAME',
- 'MOZ_APP_VENDOR', 'MOZ_APP_VERSION', 'MOZ_CHILD_PROCESS_NAME',
- 'MOZ_ANDROID_APPLICATION_CLASS', 'MOZ_ANDROID_BROWSER_INTENT_CLASS', 'MOZ_ANDROID_SEARCH_INTENT_CLASS',
- 'MOZ_CRASHREPORTER', 'MOZ_UPDATE_CHANNEL', 'OMNIJAR_NAME',
- 'OS_TARGET', 'TARGET_XPCOM_ABI'):
- DEFINES[var] = CONFIG[var]
-
-# Mangle our package name to avoid Bug 750548.
-DEFINES['MANGLED_ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME'].replace('fennec', 'f3nn3c')
-DEFINES['MOZ_APP_ABI'] = CONFIG['TARGET_XPCOM_ABI']
-if not CONFIG['COMPILE_ENVIRONMENT']:
- # These should really come from the included binaries, but that's not easy.
- DEFINES['MOZ_APP_ABI'] = 'arm-eabi-gcc3' # Observe quote differences here ...
- DEFINES['TARGET_XPCOM_ABI'] = '"arm-eabi-gcc3"' # ... and here.
-
-if '-march=armv7' in CONFIG['OS_CFLAGS']:
- DEFINES['MOZ_MIN_CPU_VERSION'] = 7
-else:
- DEFINES['MOZ_MIN_CPU_VERSION'] = 5
-
if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
# The Search Activity is mostly independent of Fennec proper, but
# it does depend on Geckoview. Therefore, we build it as a jar
# that depends on the Geckoview jars.
search_source_dir = SRCDIR + '/../search'
include('../search/search_activity_sources.mozbuild')
search_activity = add_java_jar('search-activity')
@@ -994,12 +964,10 @@ if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']
'constants.jar',
'gecko-R.jar',
'gecko-browser.jar',
'gecko-mozglue.jar',
'gecko-thirdparty.jar',
'gecko-util.jar'
]
+DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME']
FINAL_TARGET_PP_FILES += ['package-name.txt.in']
-
-DEFINES['OBJDIR'] = OBJDIR
-DEFINES['TOPOBJDIR'] = TOPOBJDIR