mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1108782 - Part 1: straighten out Java classpaths. r=glandium
This commit is us getting out of our own way. We were specifying -classpath twice, once in $(JAVAC) and once in java-build.mk. Only the latter of these is active. This a problem for ANDROID_EXTRA_JARS -- those JARs should be on the classpath and input to $(DX) -- and JARs that should be on the classpath but *not* input to $(DX). This commit removes the global flags to $(JAVAC) and adds JAVA_{BOOT}CLASSPATH_JARS. This required some hijinkery moving wildcards to moz.build files, but everything seems to work. As well as clarifying some parts of the build, part 2 uses this work to modify the classpath.
This commit is contained in:
parent
363a11a07e
commit
ec3a0bb18c
@ -4,8 +4,6 @@
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar:$(ANDROID_TOOLS)/lib/lint.jar:$(ANDROID_TOOLS)/lib/lint-checks.jar
|
||||
|
||||
# Include Android specific java flags, instead of what's in rules.mk.
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
|
||||
|
@ -18,3 +18,7 @@ jar.sources += [
|
||||
'utils/GeneratableElementIterator.java',
|
||||
'utils/Utils.java',
|
||||
]
|
||||
jar.extra_jars += [
|
||||
CONFIG['ANDROID_TOOLS'] + '/lib/lint.jar',
|
||||
CONFIG['ANDROID_TOOLS'] + '/lib/lint-checks.jar',
|
||||
]
|
||||
|
@ -63,8 +63,9 @@ tools:: $(ANDROID_APK_NAME).apk
|
||||
# out of sync with base's build config.
|
||||
jars_dir := $(DEPTH)/mobile/android/base
|
||||
stumbler_jars_dir := $(DEPTH)/mobile/android/stumbler
|
||||
JAVA_BOOTCLASSPATH := $(JAVA_BOOTCLASSPATH):$(subst $(NULL) ,:,$(wildcard $(jars_dir)/*.jar)):$(subst $(NULL) ,:,$(wildcard $(stumbler_jars_dir)/*.jar)):$(ANDROID_COMPAT_LIB):$(ANDROID_RECYCLERVIEW_LIB)
|
||||
# We also want to re-compile classes.dex when the associated base
|
||||
# content changes.
|
||||
classes.dex: $(wildcard $(jars_dir)/*.jar)
|
||||
classes.dex: $(wildcard $(stumbler_jars_dir)/*.jar)
|
||||
ANDROID_CLASSPATH_JARS += \
|
||||
$(wildcard $(jars_dir)/*.jar) \
|
||||
$(wildcard $(stumbler_jars_dir)/*.jar) \
|
||||
$(ANDROID_COMPAT_LIB) \
|
||||
$(ANDROID_RECYCLERVIEW_LIB) \
|
||||
$(NULL)
|
||||
|
@ -30,11 +30,6 @@ RELEASE_SIGN_ANDROID_APK = \
|
||||
$(ZIPALIGN) -f -v 4 $(2)-unaligned.apk $(2) && \
|
||||
$(RM) $(2)-unaligned.apk
|
||||
|
||||
# For Android, this defaults to $(ANDROID_SDK)/android.jar
|
||||
ifndef JAVA_BOOTCLASSPATH
|
||||
JAVA_BOOTCLASSPATH = $(ANDROID_SDK)/android.jar
|
||||
endif
|
||||
|
||||
# For Android, we default to 1.7
|
||||
ifndef JAVA_VERSION
|
||||
JAVA_VERSION = 1.7
|
||||
@ -43,8 +38,6 @@ endif
|
||||
JAVAC_FLAGS = \
|
||||
-target $(JAVA_VERSION) \
|
||||
-source $(JAVA_VERSION) \
|
||||
$(if $(JAVA_CLASSPATH),-classpath $(JAVA_CLASSPATH),) \
|
||||
-bootclasspath $(JAVA_BOOTCLASSPATH) \
|
||||
-encoding UTF8 \
|
||||
-g:source,lines \
|
||||
-Werror \
|
||||
|
@ -14,6 +14,18 @@ export:: classes
|
||||
classes: $(call mkdir_deps,classes)
|
||||
endif #} JAVAFILES
|
||||
|
||||
default_bootclasspath_jars := \
|
||||
$(ANDROID_SDK)/android.jar \
|
||||
$(NULL)
|
||||
|
||||
default_classpath_jars := \
|
||||
$(NULL)
|
||||
|
||||
# Turn a possibly empty list of JAR files into a Java classpath, like a.jar:b.jar.
|
||||
# Arg 1: Possibly empty list of JAR files.
|
||||
define classpath_template
|
||||
$(subst $(NULL) ,:,$(strip $(1)))
|
||||
endef
|
||||
|
||||
ifdef ANDROID_APK_NAME #{
|
||||
$(if $(ANDROID_APK_PACKAGE),,$(error Missing ANDROID_APK_PACKAGE with ANDROID_APK_NAME))
|
||||
@ -30,10 +42,12 @@ generated_r_java := generated/$(subst .,/,$(ANDROID_APK_PACKAGE))/R.java
|
||||
classes.dex: $(call mkdir_deps,classes)
|
||||
classes.dex: $(generated_r_java)
|
||||
classes.dex: $(ANDROID_APK_NAME).ap_
|
||||
classes.dex: $(ANDROID_EXTRA_JARS)
|
||||
classes.dex: $(default_classpath_jars) $(ANDROID_CLASSPATH_JARS)
|
||||
classes.dex: $(default_bootclasspath_jars) $(ANDROID_BOOTCLASSPATH_JARS) $(ANDROID_EXTRA_JARS)
|
||||
classes.dex: $(JAVAFILES)
|
||||
$(JAVAC) $(JAVAC_FLAGS) -d classes $(filter %.java,$^) \
|
||||
$(if $(strip $(ANDROID_EXTRA_JARS)),-classpath $(subst $(NULL) ,:,$(strip $(ANDROID_EXTRA_JARS))))
|
||||
$(addprefix -bootclasspath ,$(call classpath_template,$(default_bootclasspath_jars) $(ANDROID_BOOTCLASSPATH_JARS))) \
|
||||
$(addprefix -classpath ,$(call classpath_template,$(default_classpath_jars) $(ANDROID_CLASSPATH_JARS) $(ANDROID_EXTRA_JARS)))
|
||||
$(DX) --dex --output=$@ classes $(ANDROID_EXTRA_JARS)
|
||||
|
||||
# R.java and $(ANDROID_APK_NAME).ap_ are both produced by aapt. To
|
||||
@ -93,8 +107,6 @@ GARBAGE += \
|
||||
$(ANDROID_APK_NAME).apk \
|
||||
$(NULL)
|
||||
|
||||
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar
|
||||
|
||||
# Include Android specific java flags, instead of what's in rules.mk.
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
endif #} ANDROID_APK_NAME
|
||||
@ -116,15 +128,16 @@ ifdef JAVA_JAR_TARGETS #{
|
||||
# existing jarfile-classes directory and start fresh.
|
||||
|
||||
define java_jar_template
|
||||
$(1): $(2) $(3)
|
||||
$(1): $(2) $(3) $(default_bootclasspath_jars) $(default_classpath_jars)
|
||||
$$(REPORT_BUILD)
|
||||
@$$(RM) -rf $(1:.jar=)-classes
|
||||
@$$(NSINSTALL) -D $(1:.jar=)-classes
|
||||
@$$(if $$(filter-out .,$$(@D)),$$(NSINSTALL) -D $$(@D))
|
||||
$$(JAVAC) $$(JAVAC_FLAGS)\
|
||||
$(4)\
|
||||
$(4)\
|
||||
-d $(1:.jar=)-classes\
|
||||
$(if $(strip $(3)),-classpath $(subst $(NULL) ,:,$(strip $(3))))\
|
||||
$(addprefix -bootclasspath ,$(call classpath_template,$(default_bootclasspath_jars)))\
|
||||
$(addprefix -classpath ,$(call classpath_template,$(default_classpath_jars) $(3)))\
|
||||
$$(filter %.java,$$^)
|
||||
$$(JAR) cMf $$@ -C $(1:.jar=)-classes .
|
||||
|
||||
|
@ -107,6 +107,7 @@ gujar.sources += [
|
||||
'util/WindowUtils.java',
|
||||
]
|
||||
gujar.extra_jars = [
|
||||
CONFIG['ANDROID_COMPAT_LIB'],
|
||||
'constants.jar',
|
||||
'gecko-mozglue.jar',
|
||||
]
|
||||
@ -585,6 +586,7 @@ gbjar.sources += [ thirdparty_source_dir + f for f in [
|
||||
android_package_dir = CONFIG['ANDROID_PACKAGE_NAME'].replace('.', '/')
|
||||
gbjar.generated_sources = [] # Keep it this way.
|
||||
gbjar.extra_jars += [
|
||||
CONFIG['ANDROID_COMPAT_LIB'],
|
||||
'constants.jar'
|
||||
]
|
||||
if CONFIG['MOZ_CRASHREPORTER']:
|
||||
@ -846,6 +848,7 @@ if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
|
||||
search_activity.sources += [search_source_dir + '/' + f for f in search_activity_sources]
|
||||
search_activity.javac_flags += ['-Xlint:all']
|
||||
search_activity.extra_jars = [
|
||||
CONFIG['ANDROID_COMPAT_LIB'],
|
||||
'constants.jar',
|
||||
'gecko-R.jar',
|
||||
'gecko-browser.jar',
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
|
||||
libs:: javaaddons-1.0.jar
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
|
||||
libs:: stumbler.jar
|
||||
|
@ -17,17 +17,6 @@ manifest_FLAGS += \
|
||||
$(NULL)
|
||||
ANDROID_MANIFEST_FILE := $(CURDIR)/AndroidManifest.xml
|
||||
|
||||
GARBAGE += AndroidManifest.xml
|
||||
|
||||
# The test APK needs to know the contents of the target APK while not
|
||||
# being linked against them. This is a best effort to avoid getting
|
||||
# out of sync with base's build config.
|
||||
JARS_DIR := $(DEPTH)/mobile/android/base
|
||||
JAVA_BOOTCLASSPATH := $(ANDROID_SDK)/android.jar:$(subst $(NULL) ,:,$(wildcard $(JARS_DIR)/*.jar))
|
||||
# We also want to re-compile classes.dex when the associated base
|
||||
# content changes.
|
||||
classes.dex: $(wildcard $(JARS_DIR)/*.jar)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
tools:: $(ANDROID_APK_NAME).apk
|
||||
|
@ -13,6 +13,21 @@ include('background_junit3_sources.mozbuild')
|
||||
|
||||
jar = add_java_jar('background-junit3')
|
||||
jar.sources += background_junit3_sources
|
||||
jar.extra_jars += [CONFIG['ANDROID_COMPAT_LIB']]
|
||||
jar.extra_jars += [
|
||||
CONFIG['ANDROID_COMPAT_LIB'],
|
||||
CONFIG['ANDROID_RECYCLERVIEW_LIB'],
|
||||
TOPOBJDIR + '/mobile/android/base/constants.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-R.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-browser.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-mozglue.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-thirdparty.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-util.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/sync-thirdparty.jar',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ANDROID_MLS_STUMBLER']:
|
||||
jar.extra_jars += [
|
||||
TOPOBJDIR + '/mobile/android/stumbler/stumbler.jar',
|
||||
]
|
||||
|
||||
ANDROID_INSTRUMENTATION_MANIFESTS += ['instrumentation.ini']
|
||||
|
@ -18,12 +18,3 @@ ANDROID_MANIFEST_FILE := $(CURDIR)/AndroidManifest.xml
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
tools:: $(ANDROID_APK_NAME).apk
|
||||
|
||||
# The test APK needs to know the contents of the target APK while not
|
||||
# being linked against them. This is a best effort to avoid getting
|
||||
# out of sync with base's build config.
|
||||
JARS_DIR := $(DEPTH)/mobile/android/base
|
||||
JAVA_BOOTCLASSPATH := $(JAVA_BOOTCLASSPATH):$(subst $(NULL) ,:,$(wildcard $(JARS_DIR)/*.jar))
|
||||
# We also want to re-compile classes.dex when the associated base
|
||||
# content changes.
|
||||
classes.dex: $(wildcard $(JARS_DIR)/*.jar)
|
||||
|
@ -28,4 +28,21 @@ jar.sources += [
|
||||
jar.generated_sources = [] # None yet -- try to keep it this way.
|
||||
jar.javac_flags += ['-Xlint:all']
|
||||
|
||||
jar.extra_jars += [
|
||||
CONFIG['ANDROID_COMPAT_LIB'],
|
||||
CONFIG['ANDROID_RECYCLERVIEW_LIB'],
|
||||
TOPOBJDIR + '/mobile/android/base/constants.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-R.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-browser.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-mozglue.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-thirdparty.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/gecko-util.jar',
|
||||
TOPOBJDIR + '/mobile/android/base/sync-thirdparty.jar',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ANDROID_MLS_STUMBLER']:
|
||||
jar.extra_jars += [
|
||||
TOPOBJDIR + '/mobile/android/stumbler/stumbler.jar',
|
||||
]
|
||||
|
||||
ANDROID_INSTRUMENTATION_MANIFESTS += ['instrumentation.ini']
|
||||
|
@ -10,7 +10,6 @@ include $(topsrcdir)/config/rules.mk
|
||||
# Fennec and all instrumentation tests need to be signed with the same
|
||||
# key, which means release signing them all.
|
||||
|
||||
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
|
||||
stage-package:
|
||||
|
@ -98,7 +98,6 @@ $(_DEST_DIR):
|
||||
|
||||
# On Android only, include a release signed Robocop APK in the test package.
|
||||
ifeq ($(MOZ_BUILD_APP),mobile/android)
|
||||
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
|
||||
include $(topsrcdir)/config/android-common.mk
|
||||
|
||||
stage-package-android:
|
||||
|
@ -264,7 +264,6 @@ endif #Create an RPM file
|
||||
|
||||
ifeq ($(MOZ_PKG_FORMAT),APK)
|
||||
|
||||
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
|
||||
include $(MOZILLA_DIR)/config/android-common.mk
|
||||
|
||||
DIST_FILES =
|
||||
|
Loading…
Reference in New Issue
Block a user