Home | History | Annotate | Download | only in core
      1 # Target Java.
      2 # Requires:
      3 # LOCAL_MODULE_SUFFIX
      4 # LOCAL_MODULE_CLASS
      5 # all_res_assets
      6 
      7 ifeq ($(TARGET_BUILD_PDK),true)
      8 ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
      9 # LOCAL_SDK not defined or set to current
     10 ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),)
     11 ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
     12 LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION)
     13 endif #!LOCAL_NO_STANDARD_LIBRARIES
     14 endif
     15 endif # !PDK_JAVA
     16 endif #PDK
     17 
     18 LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
     19 LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
     20 
     21 ifneq ($(LOCAL_SDK_VERSION),)
     22   ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
     23     $(error $(LOCAL_PATH): Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION)
     24   else
     25     ifeq ($(strip $(filter $(LOCAL_SDK_VERSION),$(TARGET_AVAILABLE_SDK_VERSIONS))),)
     26       $(error $(LOCAL_PATH): Invalid LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)' \
     27              Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS))
     28     else
     29       ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
     30         # Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
     31         LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES)
     32       else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
     33         LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES)
     34       else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
     35         LOCAL_JAVA_LIBRARIES := android_test_stubs_current $(LOCAL_JAVA_LIBRARIES)
     36       else
     37         LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
     38       endif
     39 
     40       ifeq ($(LOCAL_SDK_VERSION),current)
     41         my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
     42       else ifeq ($(LOCAL_SDK_VERSION),system_current)
     43         my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
     44       else ifeq ($(LOCAL_SDK_VERSION),test_current)
     45         my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
     46       else
     47         my_jack_min_sdk_version := $(LOCAL_SDK_VERSION)
     48       endif
     49     endif
     50   endif
     51 else
     52   my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
     53   ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
     54     LOCAL_JAVA_LIBRARIES := $(TARGET_DEFAULT_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)
     55   endif
     56 endif
     57 
     58 ifneq (,$(strip $(LOCAL_MIN_SDK_VERSION)))
     59   my_jack_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
     60 endif
     61 
     62 proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
     63 ifneq ($(proto_sources),)
     64 ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
     65     LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-micro
     66 else
     67   ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
     68     LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-nano
     69   else
     70     ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
     71       # No library for stream protobufs
     72     else
     73       LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-lite
     74     endif
     75   endif
     76 endif
     77 endif
     78 
     79 # LOCAL_STATIC_JAVA_AAR_LIBRARIES and LOCAL_STATIC_ANDROID_LIBRARIES are also LOCAL_STATIC_JAVA_LIBRARIES.
     80 LOCAL_STATIC_JAVA_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_LIBRARIES) \
     81     $(LOCAL_STATIC_JAVA_AAR_LIBRARIES) \
     82     $(LOCAL_STATIC_ANDROID_LIBRARIES))
     83 # LOCAL_SHARED_ANDROID_LIBRARIES are also LOCAL_JAVA_LIBRARIES.
     84 LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES) $(LOCAL_SHARED_ANDROID_LIBRARIES))
     85 
     86 LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM))
     87 ifeq ($(LOCAL_BUILT_MODULE_STEM),)
     88 $(error $(LOCAL_PATH): Target java template must define LOCAL_BUILT_MODULE_STEM)
     89 endif
     90 ifneq ($(filter classes-compiled.jar classes.jar,$(LOCAL_BUILT_MODULE_STEM)),)
     91 $(error LOCAL_BUILT_MODULE_STEM may not be "$(LOCAL_BUILT_MODULE_STEM)")
     92 endif
     93 
     94 
     95 ##############################################################################
     96 # Define the intermediate targets before including base_rules so they get
     97 # the correct environment.
     98 ##############################################################################
     99 
    100 intermediates := $(call local-intermediates-dir)
    101 intermediates.COMMON := $(call local-intermediates-dir,COMMON)
    102 
    103 # Choose leaf name for the compiled jar file.
    104 ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
    105 full_classes_compiled_jar_leaf := classes-no-debug-var.jar
    106 built_dex_intermediate_leaf := no-local
    107 else
    108 full_classes_compiled_jar_leaf := classes-full-debug.jar
    109 built_dex_intermediate_leaf := with-local
    110 endif
    111 
    112 ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
    113 LOCAL_PROGUARD_ENABLED :=
    114 endif
    115 
    116 full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
    117 full_classes_desugar_jar := $(intermediates.COMMON)/classes-desugar.jar
    118 jarjar_leaf := classes-jarjar.jar
    119 full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf)
    120 emma_intermediates_dir := $(intermediates.COMMON)/emma_out
    121 # emma is hardcoded to use the leaf name of its input for the output file --
    122 # only the output directory can be changed
    123 full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(jarjar_leaf)
    124 full_classes_proguard_jar := $(intermediates.COMMON)/classes-proguard.jar
    125 built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex
    126 full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
    127 
    128 ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
    129 # If this is an apk without any Java code (e.g. framework-res), we should skip compiling Java.
    130 full_classes_jar :=
    131 built_dex :=
    132 else
    133 full_classes_jar := $(intermediates.COMMON)/classes.jar
    134 built_dex := $(intermediates.COMMON)/classes.dex
    135 endif
    136 # final Jack library, shrinked and obfuscated if it must be
    137 full_classes_jack := $(intermediates.COMMON)/classes.jack
    138 # intermediate Jack library without shrink and obfuscation
    139 noshrob_classes_jack := $(intermediates.COMMON)/classes.noshrob.jack
    140 jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
    141 
    142 LOCAL_INTERMEDIATE_TARGETS += \
    143     $(full_classes_compiled_jar) \
    144     $(full_classes_desugar_jar) \
    145     $(full_classes_jarjar_jar) \
    146     $(full_classes_emma_jar) \
    147     $(full_classes_jar) \
    148     $(full_classes_proguard_jar) \
    149     $(built_dex_intermediate) \
    150     $(full_classes_jack) \
    151     $(noshrob_classes_jack) \
    152     $(jack_check_timestamp) \
    153     $(built_dex) \
    154     $(full_classes_stubs_jar)
    155 
    156 
    157 LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
    158 
    159 ###############################################################
    160 ## .rs files: RenderScript sources to .java files and .bc files
    161 ## .fs files: Filterscript sources to .java files and .bc files
    162 ###############################################################
    163 renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
    164 # Because names of the java files from RenderScript are unknown until the
    165 # .rs file(s) are compiled, we have to depend on a timestamp file.
    166 RenderScript_file_stamp :=
    167 rs_generated_res_dir :=
    168 rs_compatibility_jni_libs :=
    169 ifneq ($(renderscript_sources),)
    170 renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
    171 RenderScript_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/RenderScript.stamp
    172 renderscript_intermediate.COMMON := $(intermediates.COMMON)/renderscript
    173 
    174 # Defaulting to an empty string uses the latest available platform SDK.
    175 renderscript_target_api :=
    176 
    177 ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
    178   renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
    179 else
    180   ifneq (,$(LOCAL_SDK_VERSION))
    181     # Set target-api for LOCAL_SDK_VERSIONs other than current.
    182     ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
    183       renderscript_target_api := $(LOCAL_SDK_VERSION)
    184     endif
    185   endif  # LOCAL_SDK_VERSION is set
    186 endif  # LOCAL_RENDERSCRIPT_TARGET_API is set
    187 
    188 # For 64-bit, we always have to upgrade to at least 21 for compat build.
    189 ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
    190   ifeq ($(TARGET_IS_64_BIT),true)
    191     ifneq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
    192       renderscript_target_api := 21
    193     endif
    194   endif
    195 endif
    196 
    197 ifeq ($(LOCAL_RENDERSCRIPT_CC),)
    198 LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
    199 endif
    200 
    201 # Turn on all warnings and warnings as errors for RS compiles.
    202 # This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
    203 renderscript_flags := -Wall -Werror
    204 renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
    205 
    206 # prepend the RenderScript system include path
    207 ifneq ($(filter-out current system_current test_current,$(LOCAL_SDK_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current test_current,$(LOCAL_SDK_VERSION))),)
    208 # if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_APPS
    209 LOCAL_RENDERSCRIPT_INCLUDES := \
    210     $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \
    211     $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/include \
    212     $(LOCAL_RENDERSCRIPT_INCLUDES)
    213 else
    214 LOCAL_RENDERSCRIPT_INCLUDES := \
    215     $(TOPDIR)external/clang/lib/Headers \
    216     $(TOPDIR)frameworks/rs/script_api/include \
    217     $(LOCAL_RENDERSCRIPT_INCLUDES)
    218 endif
    219 
    220 ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
    221 LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
    222 endif
    223 
    224 bc_files := $(patsubst %.fs,%.bc, $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources))))
    225 bc_dep_files := $(addprefix $(renderscript_intermediate.COMMON)/,$(patsubst %.bc,%.d,$(bc_files)))
    226 
    227 $(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
    228 $(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
    229 $(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
    230 $(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
    231 # By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be
    232 # automatically found by the java compiling function transform-java-to-classes.jar.
    233 $(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate.COMMON)
    234 $(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
    235 $(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files)
    236 $(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
    237 	$(transform-renderscripts-to-java-and-bc)
    238 
    239 # include the dependency files (.d/.P) generated by llvm-rs-cc.
    240 $(call include-depfile,$(RenderScript_file_stamp).P,$(RenderScript_file_stamp))
    241 
    242 ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
    243 
    244 
    245 ifeq ($(filter $(RSCOMPAT_32BIT_ONLY_API_LEVELS),$(renderscript_target_api)),)
    246 ifeq ($(TARGET_IS_64_BIT),true)
    247 renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc64/
    248 else
    249 renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/bc32/
    250 endif
    251 else
    252 renderscript_intermediate.bc_folder := $(renderscript_intermediate.COMMON)/res/raw/
    253 endif
    254 
    255 rs_generated_bc := $(addprefix \
    256     $(renderscript_intermediate.bc_folder), $(bc_files))
    257 
    258 renderscript_intermediate := $(intermediates)/renderscript
    259 
    260 # We don't need the .so files in bundled branches
    261 # Prevent these from showing up on the device
    262 # One exception is librsjni.so, which is needed for
    263 # both native path and compat path.
    264 rs_jni_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/librsjni.so
    265 LOCAL_JNI_SHARED_LIBRARIES += librsjni
    266 
    267 ifneq (,$(TARGET_BUILD_APPS)$(FORCE_BUILD_RS_COMPAT))
    268 
    269 rs_compatibility_jni_libs := $(addprefix \
    270     $(renderscript_intermediate)/librs., \
    271     $(patsubst %.bc,%.so, $(bc_files)))
    272 
    273 $(rs_generated_bc) : $(RenderScript_file_stamp)
    274 
    275 rs_support_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupport.so
    276 LOCAL_JNI_SHARED_LIBRARIES += libRSSupport
    277 
    278 rs_support_io_lib :=
    279 # check if the target api level support USAGE_IO
    280 ifeq ($(filter $(RSCOMPAT_NO_USAGEIO_API_LEVELS),$(renderscript_target_api)),)
    281 rs_support_io_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupportIO.so
    282 LOCAL_JNI_SHARED_LIBRARIES += libRSSupportIO
    283 endif
    284 
    285 
    286 $(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(RS_PREBUILT_CLCORE) \
    287     $(rs_support_lib) $(rs_support_io_lib) $(rs_jni_lib) $(rs_compiler_rt)
    288 $(rs_compatibility_jni_libs): $(BCC_COMPAT)
    289 $(rs_compatibility_jni_libs): PRIVATE_CXX := $(CXX_WRAPPER) $(TARGET_CXX)
    290 $(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
    291     $(renderscript_intermediate.bc_folder)%.bc
    292 	$(transform-bc-to-so)
    293 
    294 endif
    295 
    296 endif
    297 
    298 LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
    299 # Make sure the generated resource will be added to the apk.
    300 rs_generated_res_dir := $(renderscript_intermediate.COMMON)/res
    301 LOCAL_RESOURCE_DIR := $(rs_generated_res_dir) $(LOCAL_RESOURCE_DIR)
    302 endif
    303 
    304 
    305 ###########################################################
    306 ## AIDL: Compile .aidl files to .java
    307 ###########################################################
    308 aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
    309 aidl_java_sources :=
    310 
    311 ifneq ($(strip $(aidl_sources)),)
    312 
    313 aidl_preprocess_import :=
    314 ifdef LOCAL_SDK_VERSION
    315 ifneq ($(filter current system_current test_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
    316   # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
    317   aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
    318 else
    319   aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl
    320 endif # not current or system_current
    321 else
    322 # build against the platform.
    323 LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
    324 endif # LOCAL_SDK_VERSION
    325 
    326 $(foreach s,$(aidl_sources),\
    327     $(eval $(call define-aidl-java-rule,$(s),$(intermediates.COMMON),aidl_java_sources)))
    328 $(foreach java,$(aidl_java_sources), \
    329     $(call include-depfile,$(java:%.java=%.P),$(java)))
    330 
    331 $(aidl_java_sources) : $(LOCAL_ADDITIONAL_DEPENDENCIES) $(aidl_preprocess_import)
    332 
    333 $(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
    334 $(aidl_java_sources): PRIVATE_MODULE := $(LOCAL_MODULE)
    335 
    336 endif
    337 
    338 ##########################################
    339 
    340 # All of the rules after full_classes_compiled_jar are very unlikely
    341 # to fail except for bugs in their respective tools.  If you would
    342 # like to run these rules, add the "all" modifier goal to the make
    343 # command line.
    344 ifndef LOCAL_CHECKED_MODULE
    345 ifdef full_classes_jar
    346 ifdef LOCAL_JACK_ENABLED
    347 ifeq ($(LOCAL_JACK_ENABLED),javac_frontend)
    348 LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
    349 else
    350 LOCAL_CHECKED_MODULE := $(jack_check_timestamp)
    351 endif
    352 else
    353 LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
    354 endif
    355 endif
    356 endif
    357 
    358 #######################################
    359 include $(BUILD_SYSTEM)/base_rules.mk
    360 #######################################
    361 
    362 ###########################################################
    363 ## logtags: emit java source
    364 ###########################################################
    365 ifneq ($(strip $(logtags_sources)),)
    366 
    367 logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
    368 logtags_sources := $(addprefix $(LOCAL_PATH)/, $(logtags_sources))
    369 
    370 $(logtags_java_sources): PRIVATE_MERGED_TAG := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
    371 $(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt $(JAVATAGS) build/tools/event_log_tags.py
    372 	$(transform-logtags-to-java)
    373 
    374 else
    375 logtags_java_sources :=
    376 endif
    377 
    378 ##########################################
    379 java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
    380                 $(filter %.java,$(LOCAL_GENERATED_SOURCES))
    381 all_java_sources := $(java_sources) $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
    382 
    383 include $(BUILD_SYSTEM)/java_common.mk
    384 
    385 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_RS_SOURCES := $(if $(renderscript_sources),true)
    386 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RS_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/renderscript
    387 
    388 #######################################
    389 # defines built_odex along with rule to install odex
    390 include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
    391 #######################################
    392 
    393 # Make sure there's something to build.
    394 ifdef full_classes_jar
    395 ifndef need_compile_java
    396 $(error $(LOCAL_PATH): Target java module does not define any source or resource files)
    397 endif
    398 endif
    399 
    400 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_MIN_SDK_VERSION := $(my_jack_min_sdk_version)
    401 my_jack_min_sdk_version :=
    402 
    403 # Since we're using intermediates.COMMON, make sure that it gets cleaned
    404 # properly.
    405 $(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
    406 
    407 ifdef full_classes_jar
    408 
    409 # Droiddoc isn't currently able to generate stubs for modules, so we're just
    410 # allowing it to use the classes.jar as the "stubs" that would be use to link
    411 # against, for the cases where someone needs the jar to link against.
    412 $(eval $(call copy-one-file,$(full_classes_jar),$(full_classes_stubs_jar)))
    413 ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar)
    414 
    415 # The layers file allows you to enforce a layering between java packages.
    416 # Run build/tools/java-layers.py for more details.
    417 layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
    418 $(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
    419 $(full_classes_compiled_jar): PRIVATE_WARNINGS_ENABLE := $(LOCAL_WARNINGS_ENABLE)
    420 
    421 # Compile the java files to a .jar file.
    422 # This intentionally depends on java_sources, not all_java_sources.
    423 # Deps for generated source files must be handled separately,
    424 # via deps on the target that generates the sources.
    425 
    426 # If error prone is enabled then add LOCAL_ERROR_PRONE_FLAGS to LOCAL_JAVACFLAGS
    427 ifeq ($(RUN_ERROR_PRONE),true)
    428 LOCAL_JAVACFLAGS += $(LOCAL_ERROR_PRONE_FLAGS)
    429 endif
    430 
    431 $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS)
    432 $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
    433 $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
    434 $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
    435 $(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
    436 $(full_classes_compiled_jar): \
    437         $(java_sources) \
    438         $(java_resource_sources) \
    439         $(full_java_lib_deps) \
    440         $(jar_manifest_file) \
    441         $(layers_file) \
    442         $(RenderScript_file_stamp) \
    443         $(proto_java_sources_file_stamp) \
    444         $(NORMALIZE_PATH) \
    445         $(LOCAL_ADDITIONAL_DEPENDENCIES)
    446 	$(transform-java-to-classes.jar)
    447 
    448 javac-check : $(full_classes_compiled_jar)
    449 javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
    450 
    451 my_desugaring :=
    452 ifndef LOCAL_JACK_ENABLED
    453 ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
    454 my_desugaring := true
    455 $(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
    456 $(full_classes_desugar_jar): $(full_classes_compiled_jar) $(DESUGAR)
    457 	$(desugar-classes-jar)
    458 endif
    459 endif
    460 
    461 ifndef my_desugaring
    462 full_classes_desugar_jar := $(full_classes_compiled_jar)
    463 endif
    464 
    465 # Run jarjar if necessary
    466 ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
    467 $(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
    468 $(full_classes_jarjar_jar): $(full_classes_desugar_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
    469 	@echo JarJar: $@
    470 	$(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
    471 else
    472 full_classes_jarjar_jar := $(full_classes_desugar_jar)
    473 endif
    474 
    475 ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
    476 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.emma.ignore
    477 $(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
    478 # module level coverage filter can be defined using LOCAL_EMMA_COVERAGE_FILTER
    479 # in Android.mk
    480 ifdef LOCAL_EMMA_COVERAGE_FILTER
    481 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := $(LOCAL_EMMA_COVERAGE_FILTER)
    482 else
    483 # by default, avoid applying emma instrumentation onto emma classes itself,
    484 # otherwise there will be exceptions thrown
    485 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := *,-emma,-emmarun,-com.vladium.*
    486 endif
    487 # this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and
    488 # $(full_classes_emma_jar)
    489 $(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(EMMA_JAR)
    490 	$(transform-classes.jar-to-emma)
    491 
    492 else
    493 full_classes_emma_jar := $(full_classes_jarjar_jar)
    494 endif
    495 
    496 # TODO: this should depend on full_classes_emma_jar once coverage works again
    497 full_classes_pre_proguard_jar := $(full_classes_jarjar_jar)
    498 
    499 # Keep a copy of the jar just before proguard processing.
    500 $(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),$(intermediates.COMMON)/classes-pre-proguard.jar))
    501 
    502 # Run proguard if necessary
    503 ifdef LOCAL_PROGUARD_ENABLED
    504 ifneq ($(filter-out full custom nosystem obfuscation optimization shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
    505     $(warning while processing: $(LOCAL_MODULE))
    506     $(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
    507 endif
    508 proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
    509 jack_dictionary := $(intermediates.COMMON)/jack_dictionary
    510 
    511 # Hack: see b/20667396
    512 # When an app's LOCAL_SDK_VERSION is lower than the support library's LOCAL_SDK_VERSION,
    513 # we artifically raises the "SDK version" "linked" by ProGuard, to
    514 # - suppress ProGuard warnings of referencing symbols unknown to the lower SDK version.
    515 # - prevent ProGuard stripping subclass in the support library that extends class added in the higher SDK version.
    516 my_support_library_sdk_raise :=
    517 ifneq (,$(filter android-support-%,$(LOCAL_STATIC_JAVA_LIBRARIES)))
    518 ifdef LOCAL_SDK_VERSION
    519 ifdef TARGET_BUILD_APPS
    520 ifeq (,$(filter current system_current test_current, $(LOCAL_SDK_VERSION)))
    521   my_support_library_sdk_raise := $(call java-lib-files, sdk_vcurrent)
    522 endif
    523 else
    524   # For platform build, we can't just raise to the "current" SDK,
    525   # that would break apps that use APIs removed from the current SDK.
    526   my_support_library_sdk_raise := $(call java-lib-files,$(TARGET_DEFAULT_JAVA_LIBRARIES))
    527 endif
    528 endif
    529 endif
    530 
    531 # jack already has the libraries in its classpath and doesn't support jars
    532 legacy_proguard_flags := $(addprefix -libraryjars ,$(my_support_library_sdk_raise) \
    533   $(filter-out $(my_support_library_sdk_raise),$(full_shared_java_libs)))
    534 
    535 legacy_proguard_flags += -printmapping $(proguard_dictionary)
    536 jack_proguard_flags := -printmapping $(jack_dictionary)
    537 
    538 common_proguard_flags := -forceprocessing
    539 
    540 common_proguard_flag_files :=
    541 ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),)
    542 common_proguard_flag_files += $(BUILD_SYSTEM)/proguard.flags
    543 ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
    544 ifdef LOCAL_JACK_ENABLED
    545 common_proguard_flag_files += $(BUILD_SYSTEM)/proguard.jacoco.flags
    546 else
    547 common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags
    548 endif # LOCAL_JACK_ENABLED
    549 endif
    550 # If this is a test package, add proguard keep flags for tests.
    551 ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
    552 common_proguard_flag_files += $(BUILD_SYSTEM)/proguard_tests.flags
    553 ifeq ($(filter shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
    554 common_proguard_flags += -dontshrink # don't shrink tests by default
    555 endif # shrinktests
    556 endif # test package
    557 ifneq ($(common_proguard_flag_files),)
    558 common_proguard_flags += $(addprefix -include , $(common_proguard_flag_files))
    559 # This is included from $(BUILD_SYSTEM)/proguard.flags
    560 common_proguard_flag_files += $(BUILD_SYSTEM)/proguard_basic_keeps.flags
    561 endif
    562 
    563 ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
    564 # By default no obfuscation
    565 common_proguard_flags += -dontobfuscate
    566 endif  # No obfuscation
    567 ifeq ($(filter optimization,$(LOCAL_PROGUARD_ENABLED)),)
    568 # By default no optimization
    569 common_proguard_flags += -dontoptimize
    570 endif  # No optimization
    571 
    572 ifdef LOCAL_INSTRUMENTATION_FOR
    573 ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
    574 # If no obfuscation, link in the instrmented package's classes.jar as a library.
    575 # link_instr_classes_jar is defined in base_rule.mk
    576 # jack already has this library in its classpath and doesn't support jars
    577 legacy_proguard_flags += -libraryjars $(link_instr_classes_jar)
    578 else # obfuscation
    579 # If obfuscation is enabled, the main app must be obfuscated too.
    580 # We need to run obfuscation using the main app's dictionary,
    581 # and treat the main app's class.jar as injars instead of libraryjars.
    582 legacy_proguard_flags := -injars  $(link_instr_classes_jar) \
    583     -outjars $(intermediates.COMMON)/proguard.$(LOCAL_INSTRUMENTATION_FOR).jar \
    584     -include $(link_instr_intermediates_dir.COMMON)/proguard_options \
    585     -applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
    586     -verbose \
    587     $(legacy_proguard_flags)
    588 ifdef LOCAL_JACK_ENABLED
    589 jack_proguard_flags += -applymapping $(link_instr_intermediates_dir.COMMON)/jack_dictionary
    590 full_jack_deps += $(link_instr_intermediates_dir.COMMON)/jack_dictionary
    591 endif
    592 
    593 # Sometimes (test + main app) uses different keep rules from the main app -
    594 # apply the main app's dictionary anyway.
    595 legacy_proguard_flags += -ignorewarnings
    596 
    597 # Make sure we run Proguard on the main app first
    598 $(full_classes_proguard_jar) : $(link_instr_intermediates_dir.COMMON)/proguard.classes.jar
    599 
    600 endif # no obfuscation
    601 endif # LOCAL_INSTRUMENTATION_FOR
    602 endif  # LOCAL_PROGUARD_ENABLED is not nosystem
    603 
    604 proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES))
    605 LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
    606 
    607 ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
    608 extra_input_jar := $(call intermediates-dir-for,APPS,$(LOCAL_TEST_MODULE_TO_PROGUARD_WITH),,COMMON)/classes.jar
    609 else
    610 extra_input_jar :=
    611 endif
    612 
    613 # If not using jack and building against the current SDK version then filter
    614 # out junit and android.test classes from the application that are to be
    615 # removed from the Android API as part of b/30188076 but which are still
    616 # present in the Android API. This is to allow changes to be made to the
    617 # build to statically include those classes into the application without
    618 # simultaneously removing those classes from the API.
    619 proguard_injar_filters :=
    620 ifndef LOCAL_JACK_ENABLED
    621 ifdef LOCAL_SDK_VERSION
    622 ifeq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
    623 proguard_injar_filters := (!junit/framework/**,!junit/runner/**,!android/test/**)
    624 endif
    625 endif
    626 endif
    627 
    628 $(full_classes_proguard_jar): PRIVATE_PROGUARD_INJAR_FILTERS := $(proguard_injar_filters)
    629 $(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
    630 $(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
    631 $(full_classes_proguard_jar) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) | $(PROGUARD)
    632 	$(call transform-jar-to-proguard)
    633 
    634 else  # LOCAL_PROGUARD_ENABLED not defined
    635 full_classes_proguard_jar := $(full_classes_pre_proguard_jar)
    636 endif # LOCAL_PROGUARD_ENABLED defined
    637 
    638 $(eval $(call copy-one-file,$(full_classes_proguard_jar),$(full_classes_jar)))
    639 
    640 $(call define-jar-to-toc-rule, $(full_classes_jar))
    641 
    642 ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
    643 ifndef LOCAL_JACK_ENABLED
    644 $(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
    645 # If you instrument class files that have local variable debug information in
    646 # them emma does not correctly maintain the local variable table.
    647 # This will cause an error when you try to convert the class files for Android.
    648 # The workaround here is to build different dex file here based on emma switch
    649 # then later copy into classes.dex. When emma is on, dx is run with --no-locals
    650 # option to remove local variable information
    651 ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
    652 $(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals
    653 endif
    654 $(built_dex_intermediate): $(full_classes_jar) $(DX)
    655 	$(transform-classes.jar-to-dex)
    656 endif # LOCAL_JACK_ENABLED is disabled
    657 
    658 $(built_dex): $(built_dex_intermediate)
    659 	@echo Copying: $@
    660 	$(hide) mkdir -p $(dir $@)
    661 	$(hide) rm -f $(dir $@)/classes*.dex
    662 	$(hide) cp -fp $(dir $<)/classes*.dex $(dir $@)
    663 
    664 java-dex: $(built_dex)
    665 
    666 endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
    667 
    668 findbugs_xml := $(intermediates.COMMON)/findbugs.xml
    669 $(findbugs_xml): PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \
    670     $(call normalize-path-list,$(filter %.jar,$(full_java_libs)))))
    671 $(findbugs_xml): PRIVATE_FINDBUGS_FLAGS := $(LOCAL_FINDBUGS_FLAGS)
    672 $(findbugs_xml) : $(full_classes_pre_proguard_jar) $(filter %.xml, $(LOCAL_FINDBUGS_FLAGS))
    673 	@echo Findbugs: $@
    674 	$(hide) $(FINDBUGS) -textui -effort:min -xml:withMessages \
    675 		$(PRIVATE_AUXCLASSPATH) $(PRIVATE_FINDBUGS_FLAGS) \
    676 		$< \
    677 		> $@
    678 
    679 ALL_FINDBUGS_FILES += $(findbugs_xml)
    680 
    681 findbugs_html := $(PRODUCT_OUT)/findbugs/$(LOCAL_MODULE).html
    682 $(findbugs_html) : PRIVATE_XML_FILE := $(findbugs_xml)
    683 $(LOCAL_MODULE)-findbugs : $(findbugs_html)
    684 $(findbugs_html) : $(findbugs_xml)
    685 	@mkdir -p $(dir $@)
    686 	@echo ConvertXmlToText: $@
    687 	$(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl $(PRIVATE_XML_FILE) \
    688 	> $@
    689 
    690 $(LOCAL_MODULE)-findbugs : $(findbugs_html)
    691 
    692 endif  # full_classes_jar is defined
    693 
    694 ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
    695 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
    696 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION)
    697 else
    698 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
    699 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION)
    700 endif
    701 
    702 ifdef LOCAL_JACK_ENABLED
    703 $(LOCAL_INTERMEDIATE_TARGETS): \
    704 	PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
    705 ifeq ($(LOCAL_JACK_ENABLED),incremental)
    706 $(LOCAL_INTERMEDIATE_TARGETS): \
    707 	PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental
    708 $(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-noshrob-incremental
    709 $(jack_check_timestamp): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-check-incremental
    710 else
    711 $(LOCAL_INTERMEDIATE_TARGETS): \
    712 	PRIVATE_JACK_INCREMENTAL_DIR :=
    713 $(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR :=
    714 $(jack_check_timestamp): PRIVATE_JACK_INCREMENTAL_DIR :=
    715 endif
    716 
    717 ifdef full_classes_jar
    718 ifdef LOCAL_PROGUARD_ENABLED
    719 
    720 ifndef LOCAL_JACK_PROGUARD_FLAGS
    721     LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)
    722 endif
    723 LOCAL_JACK_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
    724 ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
    725     $(error $(LOCAL_MODULE): Build with jack when LOCAL_TEST_MODULE_TO_PROGUARD_WITH is defined is not yet implemented)
    726 endif
    727 
    728 # $(jack_dictionary) is just by-product of $(built_dex_intermediate).
    729 # The dummy command was added because, without it, make misses the fact the $(built_dex) also
    730 # change $(jack_dictionary).
    731 $(jack_dictionary): $(full_classes_jack)
    732 	$(hide) touch $@
    733 
    734 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS := $(common_proguard_flags) $(jack_proguard_flags) $(LOCAL_JACK_PROGUARD_FLAGS)
    735 else  # LOCAL_PROGUARD_ENABLED not defined
    736 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS :=
    737 endif # LOCAL_PROGUARD_ENABLED defined
    738 
    739 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
    740 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
    741 
    742 jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
    743         $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) \
    744         $(common_proguard_flag_files) $(proguard_flag_files) \
    745         $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \
    746         $(NORMALIZE_PATH) $(JACK_DEFAULT_ARGS) $(JACK)
    747 
    748 $(jack_check_timestamp): $(jack_all_deps) | setup-jack-server
    749 	@echo Checking build with Jack: $@
    750 	$(jack-check-java)
    751 
    752 ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
    753 $(full_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
    754 $(full_classes_jack): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
    755 $(full_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
    756 	@echo Building with Jack: $@
    757 	$(java-to-jack)
    758 
    759 # Update timestamps of .toc files for static java libraries so
    760 # dependents will be always rebuilt.
    761 $(built_dex).toc: $(full_classes_jack)
    762 	touch $@
    763 
    764 else #LOCAL_IS_STATIC_JAVA_LIBRARY
    765 $(built_dex_intermediate): PRIVATE_CLASSES_JACK := $(full_classes_jack)
    766 
    767 ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
    768 LOCAL_JACK_PLUGIN_PATH += $(HOST_OUT_JAVA_LIBRARIES)/jack-coverage-plugin.jar
    769 LOCAL_JACK_PLUGIN += com.android.jack.coverage.CodeCoverage
    770 $(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS := \
    771     -D jack.coverage=true \
    772     -D jack.coverage.metadata.file=$(intermediates.COMMON)/coverage.em \
    773     -D jack.coverage.jacoco.package=$(JACOCO_PACKAGE_NAME) \
    774     $(addprefix -D jack.coverage.jacoco.include=,$(LOCAL_JACK_COVERAGE_INCLUDE_FILTER)) \
    775     $(addprefix -D jack.coverage.jacoco.exclude=,$(LOCAL_JACK_COVERAGE_EXCLUDE_FILTER))
    776 else
    777 $(built_dex_intermediate): PRIVATE_JACK_COVERAGE_OPTIONS :=
    778 endif
    779 
    780 # Compiling with javac to jar, then converting jar to dex with jack
    781 ifeq ($(LOCAL_JACK_ENABLED),javac_frontend)
    782 
    783 # PRIVATE_EXTRA_JAR_ARGS and source files were already handled during javac
    784 $(built_dex_intermediate): PRIVATE_EXTRA_JAR_ARGS :=
    785 $(built_dex_intermediate): PRIVATE_JAVA_SOURCES :=
    786 $(built_dex_intermediate): PRIVATE_SOURCE_INTERMEDIATES_DIR :=
    787 $(built_dex_intermediate): PRIVATE_HAS_PROTO_SOURCES :=
    788 $(built_dex_intermediate): PRIVATE_HAS_RS_SOURCES :=
    789 
    790 # Incremental compilation is not supported when mixing javac and jack
    791 $(built_dex_intermediate): PRIVATE_JACK_INCREMENTAL_DIR :=
    792 
    793 # Pass output of javac to jack
    794 $(built_dex_intermediate): PRIVATE_JACK_IMPORT_JAR := $(full_classes_compiled_jar)
    795 $(built_dex_intermediate): $(full_classes_compiled_jar)
    796 else # LOCAL_JACK_ENABLED != javac_frontend
    797 $(built_dex_intermediate): PRIVATE_JACK_IMPORT_JAR :=
    798 endif # LOCAL_JACK_ENABLED != javac_frontend
    799 
    800 $(built_dex_intermediate): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
    801 $(built_dex_intermediate): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
    802 $(built_dex_intermediate): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
    803 	@echo Building with Jack: $@
    804 	$(jack-java-to-dex)
    805 
    806 # $(full_classes_jack) is just by-product of $(built_dex_intermediate).
    807 # The dummy command was added because, without it, make misses the fact the $(built_dex) also
    808 # change $(full_classes_jack).
    809 $(full_classes_jack): $(built_dex_intermediate)
    810 	$(hide) touch $@
    811 
    812 $(call define-dex-to-toc-rule, $(intermediates.COMMON))
    813 
    814 endif #LOCAL_IS_STATIC_JAVA_LIBRARY
    815 
    816 $(noshrob_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
    817 $(noshrob_classes_jack): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
    818 $(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-noshrob-rsc
    819 $(noshrob_classes_jack): PRIVATE_JACK_PROGUARD_FLAGS :=
    820 $(noshrob_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
    821 	@echo Building with Jack: $@
    822 	$(java-to-jack)
    823 endif  # full_classes_jar is defined
    824 endif # LOCAL_JACK_ENABLED
    825