forked from openkylin/platform_build
Add LOCAL_JAR_PROCESSOR
Allow using a host java library as an intermediate processor step after javac but before desugar, proguard, or dx. Test: manual Change-Id: I7fb843e10d96c0167f6e4371582fabcc1454521f
This commit is contained in:
parent
00e3bd93da
commit
f8a49c5a37
|
@ -115,6 +115,8 @@ LOCAL_JAR_EXCLUDE_PACKAGES:=
|
|||
LOCAL_JARJAR_RULES:=
|
||||
LOCAL_JAR_MANIFEST:=
|
||||
LOCAL_JAR_PACKAGES:=
|
||||
LOCAL_JAR_PROCESSOR:=
|
||||
LOCAL_JAR_PROCESSOR_ARGS:=
|
||||
LOCAL_JAVACFLAGS:=
|
||||
LOCAL_JAVA_LANGUAGE_VERSION:=
|
||||
LOCAL_JAVA_LAYERS_FILE:=
|
||||
|
|
28
core/java.mk
28
core/java.mk
|
@ -110,6 +110,7 @@ LOCAL_PROGUARD_ENABLED :=
|
|||
endif
|
||||
|
||||
full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
|
||||
full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar
|
||||
full_classes_desugar_jar := $(intermediates.COMMON)/classes-desugar.jar
|
||||
jarjar_leaf := classes-jarjar.jar
|
||||
full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf)
|
||||
|
@ -446,18 +447,41 @@ $(full_classes_compiled_jar): \
|
|||
javac-check : $(full_classes_compiled_jar)
|
||||
javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
|
||||
|
||||
ifdef LOCAL_JAR_PROCESSOR
|
||||
# LOCAL_JAR_PROCESSOR_ARGS must be evaluated here to set up the rule-local
|
||||
# PRIVATE_JAR_PROCESSOR_ARGS variable, but $< and $@ are not available yet.
|
||||
# Set ${in} and ${out} so they can be referenced by LOCAL_JAR_PROCESSOR_ARGS
|
||||
# using deferred evaluation (LOCAL_JAR_PROCESSOR_ARGS = instead of :=).
|
||||
in := $(full_classes_compiled_jar)
|
||||
out := $(full_classes_processed_jar).tmp
|
||||
$(full_classes_processed_jar): PRIVATE_JAR_PROCESSOR_ARGS := $(LOCAL_JAR_PROCESSOR_ARGS)
|
||||
$(full_classes_processed_jar): PRIVATE_JAR_PROCESSOR := $(HOST_OUT_JAVA_LIBRARIES)/$(LOCAL_JAR_PROCESSOR).jar
|
||||
$(full_classes_processed_jar): PRIVATE_TMP_OUT := $(out)
|
||||
in :=
|
||||
out :=
|
||||
|
||||
$(full_classes_processed_jar): $(full_classes_compiled_jar) $(LOCAL_JAR_PROCESSOR)
|
||||
@echo Processing $@ with $(PRIVATE_JAR_PROCESSOR)
|
||||
$(hide) rm -f $@ $(PRIVATE_TMP_OUT)
|
||||
$(hide) java -jar $(PRIVATE_JAR_PROCESSOR) $(PRIVATE_JAR_PROCESSOR_ARGS)
|
||||
$(hide) mv $(PRIVATE_TMP_OUT) $@
|
||||
|
||||
else
|
||||
full_classes_processed_jar := $(full_classes_compiled_jar)
|
||||
endif
|
||||
|
||||
my_desugaring :=
|
||||
ifndef LOCAL_JACK_ENABLED
|
||||
ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
|
||||
my_desugaring := true
|
||||
$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
||||
$(full_classes_desugar_jar): $(full_classes_compiled_jar) $(DESUGAR)
|
||||
$(full_classes_desugar_jar): $(full_classes_processed_jar) $(DESUGAR)
|
||||
$(desugar-classes-jar)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef my_desugaring
|
||||
full_classes_desugar_jar := $(full_classes_compiled_jar)
|
||||
full_classes_desugar_jar := $(full_classes_processed_jar)
|
||||
endif
|
||||
|
||||
# Run jarjar if necessary
|
||||
|
|
Loading…
Reference in New Issue