) \
)
# The arguments to jar that will include these files in a jar file.
+ # Quote the file name to handle special characters (such as #) correctly.
extra_jar_args := \
$(foreach group,$(java_resource_file_groups), \
- $(addprefix -C $(word 1,$(subst :,$(space),$(group))) , \
- $(wordlist 2,9999,$(subst :,$(space),$(group))) \
+ $(addprefix -C "$(word 1,$(subst :,$(space),$(group)))" , \
+ $(foreach w, $(wordlist 2,9999,$(subst :,$(space),$(group))), "$(w)" ) \
) \
)
java_resource_file_groups :=
endef
define add-java-resources-to-package
-$(hide) jar uf $@ $(PRIVATE_EXTRA_JAR_ARGS)
+$(call dump-words-to-file, $(PRIVATE_EXTRA_JAR_ARGS), $(dir $@)jar-arg-list)
+$(hide) jar uf $@ @$(dir $@)jar-arg-list
+@rm -f $(dir $@)jar-arg-list
endef
# Sign a package using the specified key/cert.
define transform-host-java-to-package
@echo "host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH))
-$(hide) if [ ! -z "$(PRIVATE_EXTRA_JAR_ARGS)" ]; then jar uf $@ $(PRIVATE_EXTRA_JAR_ARGS); fi
+$(if $(PRIVATE_EXTRA_JAR_ARGS), $(call add-java-resources-to-package))
endef
###########################################################