Skip to content

Commit

Permalink
Bug 1440433 - Part 2: Remove ANDROID_APK_{NAME,PACKAGE}. r=jchen
Browse files Browse the repository at this point in the history
The last APK produced using the ANDROID_APK_* moz.build/Makefile.in
mechanism was Robocop, so we can get rid of these now.

MozReview-Commit-ID: 9b08ZvvOAoC

--HG--
extra : rebase_source : ac4fea057bf6e731b0f26a1b6902f17a7362076d
  • Loading branch information
ncalexan committed Feb 22, 2018
1 parent 9ec8750 commit 1ff0250
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 106 deletions.
92 changes: 0 additions & 92 deletions config/makefiles/java-build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@

ifndef INCLUDED_JAVA_BUILD_MK #{

ifdef JAVAFILES #{
GENERATED_DIRS += classes

export:: classes
classes: $(call mkdir_deps,classes)
endif #} JAVAFILES

default_bootclasspath_jars := \
$(ANDROID_SDK)/android.jar \
$(NULL)
Expand All @@ -27,91 +20,6 @@ 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))

android_res_dirs := $(or $(ANDROID_RES_DIRS),$(srcdir)/res)
_ANDROID_RES_FLAG := $(addprefix -S ,$(android_res_dirs))
_ANDROID_ASSETS_FLAG := $(if $(ANDROID_ASSETS_DIRS),$(addprefix -A ,$(ANDROID_ASSETS_DIRS)))
android_manifest := $(or $(ANDROID_MANIFEST_FILE),AndroidManifest.xml)

GENERATED_DIRS += classes generated

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: $(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,$^) \
$(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
# save an aapt invocation, we produce them both at the same time. The
# trailing semi-colon defines an empty recipe; defining no recipe at
# all causes Make to treat the target differently, in a way that
# defeats our dependencies.

$(generated_r_java): .aapt.deps ;
$(ANDROID_APK_NAME).ap_: .aapt.deps ;

# This uses the fact that Android resource directories list all
# resource files one subdirectory below the parent resource directory.
android_res_files := $(wildcard $(addsuffix /*,$(wildcard $(addsuffix /*,$(android_res_dirs)))))

# An extra package like org.example.app generates dependencies like:
# generated/org/example/app/R.java: .aapt.deps ;
# classes.dex: generated/org/example/app/R.java
# GARBAGE: generated/org/example/app/R.java
$(foreach extra_package,$(ANDROID_EXTRA_PACKAGES), \
$(eval generated/$(subst .,/,$(extra_package))/R.java: .aapt.deps ;) \
$(eval classes.dex: generated/$(subst .,/,$(extra_package))/R.java) \
$(eval GARBAGE: generated/$(subst .,/,$(extra_package))/R.java) \
)

# aapt flag -m: 'make package directories under location specified by -J'.
# The --extra-package list is colon separated.
.aapt.deps: $(android_manifest) $(android_res_files) $(wildcard $(ANDROID_ASSETS_DIRS))
@$(TOUCH) $@
$(AAPT) package -f -M $< -I $(ANDROID_SDK)/android.jar $(_ANDROID_RES_FLAG) $(_ANDROID_ASSETS_FLAG) \
--custom-package $(ANDROID_APK_PACKAGE) \
--non-constant-id \
--auto-add-overlay \
$(if $(ANDROID_EXTRA_PACKAGES),--extra-packages $(subst $(NULL) ,:,$(strip $(ANDROID_EXTRA_PACKAGES)))) \
$(if $(ANDROID_EXTRA_RES_DIRS),$(addprefix -S ,$(ANDROID_EXTRA_RES_DIRS))) \
-m \
-J ${@D}/generated \
-F $(ANDROID_APK_NAME).ap_

$(ANDROID_APK_NAME)-unsigned-unaligned.apk: $(ANDROID_APK_NAME).ap_ classes.dex
cp $< $@
$(ZIP) -0 $@ classes.dex

$(ANDROID_APK_NAME)-unaligned.apk: $(ANDROID_APK_NAME)-unsigned-unaligned.apk
cp $< $@
$(DEBUG_JARSIGNER) $@

$(ANDROID_APK_NAME).apk: $(ANDROID_APK_NAME)-unaligned.apk
$(ZIPALIGN) -f 4 $< $@

GARBAGE += \
$(generated_r_java) \
classes.dex \
$(ANDROID_APK_NAME).ap_ \
$(ANDROID_APK_NAME)-unsigned-unaligned.apk \
$(ANDROID_APK_NAME)-unaligned.apk \
$(ANDROID_APK_NAME).apk \
$(NULL)

# Include Android specific java flags, instead of what's in rules.mk.
include $(topsrcdir)/config/android-common.mk
endif #} ANDROID_APK_NAME


ifdef JAVA_JAR_TARGETS #{
# Arg 1: Output target name with .jar suffix, like jars/jarfile.jar.
# Intermediate class files are generated in jars/jarfile-classes.
Expand Down
2 changes: 1 addition & 1 deletion config/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ endif
###############################################################################
# Java rules
###############################################################################
ifneq (,$(JAVAFILES)$(ANDROID_RESFILES)$(ANDROID_APKNAME)$(JAVA_JAR_TARGETS))
ifneq (,$(JAVA_JAR_TARGETS))
include $(MOZILLA_DIR)/config/makefiles/java-build.mk
endif

Expand Down
3 changes: 0 additions & 3 deletions python/mozbuild/mozbuild/backend/recursivemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@
from mozbuild.shellutil import quote as shell_quote

MOZBUILD_VARIABLES = [
b'ANDROID_APK_NAME',
b'ANDROID_APK_PACKAGE',
b'ANDROID_ASSETS_DIRS',
b'ANDROID_EXTRA_PACKAGES',
b'ANDROID_EXTRA_RES_DIRS',
Expand Down Expand Up @@ -143,7 +141,6 @@
]

DEPRECATED_VARIABLES = [
b'ANDROID_RESFILES',
b'EXPORT_LIBRARY',
b'EXTRA_LIBS',
b'HOST_LIBS',
Expand Down
8 changes: 0 additions & 8 deletions python/mozbuild/mozbuild/frontend/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,14 +1216,6 @@ def aggregate(files):
file.
"""),

'ANDROID_APK_NAME': (unicode, unicode,
"""The name of an Android APK file to generate.
"""),

'ANDROID_APK_PACKAGE': (unicode, unicode,
"""The name of the Android package to generate R.java for, like org.mozilla.gecko.
"""),

'ANDROID_EXTRA_PACKAGES': (StrictOrderingOnAppendList, list,
"""The name of extra Android packages to generate R.java for, like ['org.mozilla.other'].
"""),
Expand Down
2 changes: 0 additions & 2 deletions python/mozbuild/mozbuild/frontend/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,8 +1054,6 @@ def emit_from_context(self, context):
# desired abstraction of the build definition away from makefiles.
passthru = VariablePassthru(context)
varlist = [
'ANDROID_APK_NAME',
'ANDROID_APK_PACKAGE',
'ANDROID_GENERATED_RESFILES',
'EXTRA_DSO_LDOPTS',
'RCFILE',
Expand Down

0 comments on commit 1ff0250

Please sign in to comment.