6 ifeq ($(TARGET_BUILD_PDK),true)
7 ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
8 # LOCAL_SDK not defined or set to current
9 ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),)
10 LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION)
15 LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
16 LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
18 ifneq ($(LOCAL_SDK_VERSION),)
19 ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
20 $(error $(LOCAL_PATH): Must not define both LOCAL_NO_STANDARD_LIBRARIES and LOCAL_SDK_VERSION)
22 ifeq ($(strip $(filter $(LOCAL_SDK_VERSION),$(TARGET_AVAILABLE_SDK_VERSIONS))),)
23 $(error $(LOCAL_PATH): Invalid LOCAL_SDK_VERSION '$(LOCAL_SDK_VERSION)' \
24 Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS))
26 ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
27 # Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
28 LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES)
29 else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
30 LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES)
32 LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
37 ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
38 LOCAL_JAVA_LIBRARIES := $(TARGET_DEFAULT_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)
42 proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
43 ifneq ($(proto_sources),)
44 ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
45 LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-2.3.0-micro
47 ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
48 LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-2.3.0-nano
50 LOCAL_STATIC_JAVA_LIBRARIES += libprotobuf-java-2.3.0-lite
55 # LOCAL_STATIC_JAVA_AAR_LIBRARIES are special LOCAL_STATIC_JAVA_LIBRARIES
56 LOCAL_STATIC_JAVA_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_LIBRARIES) $(LOCAL_STATIC_JAVA_AAR_LIBRARIES))
58 LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
60 LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM))
61 ifeq ($(LOCAL_BUILT_MODULE_STEM),)
62 $(error $(LOCAL_PATH): Target java template must define LOCAL_BUILT_MODULE_STEM)
64 ifneq ($(filter classes-compiled.jar classes.jar,$(LOCAL_BUILT_MODULE_STEM)),)
65 $(error LOCAL_BUILT_MODULE_STEM may not be "$(LOCAL_BUILT_MODULE_STEM)")
69 ##############################################################################
70 # Define the intermediate targets before including base_rules so they get
71 # the correct environment.
72 ##############################################################################
74 intermediates := $(call local-intermediates-dir)
75 intermediates.COMMON := $(call local-intermediates-dir,COMMON)
77 # Choose leaf name for the compiled jar file.
78 ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
79 full_classes_compiled_jar_leaf := classes-no-debug-var.jar
80 built_dex_intermediate_leaf := no-local
82 full_classes_compiled_jar_leaf := classes-full-debug.jar
83 built_dex_intermediate_leaf := with-local
86 ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
87 LOCAL_PROGUARD_ENABLED :=
90 ifdef LOCAL_PROGUARD_ENABLED
91 proguard_jar_leaf := proguard.classes.jar
93 proguard_jar_leaf := noproguard.classes.jar
96 full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
97 jarjar_leaf := classes-jarjar.jar
98 full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf)
99 emma_intermediates_dir := $(intermediates.COMMON)/emma_out
100 # emma is hardcoded to use the leaf name of its input for the output file --
101 # only the output directory can be changed
102 full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(jarjar_leaf)
103 full_classes_proguard_jar := $(intermediates.COMMON)/$(proguard_jar_leaf)
104 built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex
105 full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
107 ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
108 # If this is an apk without any Java code (e.g. framework-res), we should skip compiling Java.
112 full_classes_jar := $(intermediates.COMMON)/classes.jar
113 built_dex := $(intermediates.COMMON)/classes.dex
116 LOCAL_INTERMEDIATE_TARGETS += \
117 $(full_classes_compiled_jar) \
118 $(full_classes_jarjar_jar) \
119 $(full_classes_emma_jar) \
120 $(full_classes_jar) \
121 $(full_classes_proguard_jar) \
122 $(built_dex_intermediate) \
124 $(full_classes_stubs_jar)
127 LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
129 ###############################################################
130 ## .rs files: RenderScript sources to .java files and .bc files
131 ## .fs files: Filterscript sources to .java files and .bc files
132 ###############################################################
133 renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
134 # Because names of the java files from RenderScript are unknown until the
135 # .rs file(s) are compiled, we have to depend on a timestamp file.
136 RenderScript_file_stamp :=
137 rs_compatibility_jni_libs :=
138 ifneq ($(renderscript_sources),)
139 renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
140 RenderScript_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/RenderScript.stamp
141 renderscript_intermediate.COMMON := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/renderscript
143 renderscript_target_api :=
145 ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
146 renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
148 ifneq (,$(LOCAL_SDK_VERSION))
149 # Set target-api for LOCAL_SDK_VERSIONs other than current.
150 ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION)))
151 renderscript_target_api := $(LOCAL_SDK_VERSION)
153 endif # LOCAL_SDK_VERSION is set
154 endif # LOCAL_RENDERSCRIPT_TARGET_API is set
156 ifeq ($(LOCAL_RENDERSCRIPT_CC),)
157 LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
160 # Turn on all warnings and warnings as errors for RS compiles.
161 # This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
162 renderscript_flags := -Wall -Werror
163 renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
165 # prepend the RenderScript system include path
166 ifneq ($(filter-out current system_current,$(LOCAL_SDK_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current system_current,$(LOCAL_SDK_VERSION))),)
167 # if a numeric LOCAL_SDK_VERSION, or current LOCAL_SDK_VERSION with TARGET_BUILD_APPS
168 LOCAL_RENDERSCRIPT_INCLUDES := \
169 $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/clang-include \
170 $(HISTORICAL_SDK_VERSIONS_ROOT)/renderscript/include \
171 $(LOCAL_RENDERSCRIPT_INCLUDES)
173 LOCAL_RENDERSCRIPT_INCLUDES := \
174 $(TOPDIR)external/clang/lib/Headers \
175 $(TOPDIR)frameworks/rs/scriptc \
176 $(LOCAL_RENDERSCRIPT_INCLUDES)
179 ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
180 LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
183 $(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
184 $(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
185 $(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
186 $(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
187 # By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be
188 # automatically found by the java compiling function transform-java-to-classes.jar.
189 $(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate.COMMON)
190 $(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
191 $(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
192 $(transform-renderscripts-to-java-and-bc)
194 ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
195 bc_files := $(patsubst %.fs,%.bc, $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources))))
196 rs_generated_bc := $(addprefix \
197 $(renderscript_intermediate.COMMON)/res/raw/, $(bc_files))
199 renderscript_intermediate := $(intermediates)/renderscript
201 # We don't need the .so files in bundled branches
202 # Prevent these from showing up on the device
203 ifneq (,$(TARGET_BUILD_APPS)$(FORCE_BUILD_RS_COMPAT))
205 rs_compatibility_jni_libs := $(addprefix \
206 $(renderscript_intermediate)/librs., \
207 $(patsubst %.bc,%.so, $(bc_files)))
209 $(rs_generated_bc) : $(RenderScript_file_stamp)
211 rs_support_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupport.so
212 rs_jni_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/librsjni.so
213 LOCAL_JNI_SHARED_LIBRARIES += libRSSupport librsjni
217 $(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(RS_PREBUILT_CLCORE) \
218 $(rs_support_lib) $(rs_jni_lib) $(rs_compiler_rt)
219 $(rs_compatibility_jni_libs): $(BCC_COMPAT)
220 $(rs_compatibility_jni_libs): PRIVATE_CXX := $(TARGET_CXX)
221 $(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
222 $(renderscript_intermediate.COMMON)/res/raw/%.bc
223 $(transform-bc-to-so)
229 # include the dependency files (.d) generated by llvm-rs-cc.
230 renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate.COMMON)/, \
231 $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
232 -include $(renderscript_generated_dep_files)
234 LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
235 # Make sure the generated resource will be added to the apk.
236 LOCAL_RESOURCE_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/renderscript/res $(LOCAL_RESOURCE_DIR)
239 # All of the rules after full_classes_compiled_jar are very unlikely
240 # to fail except for bugs in their respective tools. If you would
241 # like to run these rules, add the "all" modifier goal to the make
243 ifdef full_classes_jar
244 java_alternative_checked_module := $(full_classes_compiled_jar)
246 java_alternative_checked_module :=
249 # TODO: It looks like the only thing we need from base_rules is
250 # all_java_sources. See if we can get that by adding a
251 # common_java.mk, and moving the include of base_rules.mk to
252 # after all the declarations.
254 #######################################
255 include $(BUILD_SYSTEM)/base_rules.mk
256 #######################################
258 java_alternative_checked_module :=
260 #######################################
261 # defines built_odex along with rule to install odex
262 include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
263 #######################################
265 # Make sure there's something to build.
266 ifdef full_classes_jar
267 ifndef need_compile_java
268 $(error $(LOCAL_PATH): Target java module does not define any source or resource files)
272 # Install the RS compatibility libraries to /system/lib/ if necessary
273 ifdef rs_compatibility_jni_libs
274 installed_rs_compatibility_jni_libs := $(addprefix $(TARGET_OUT_SHARED_LIBRARIES)/,\
275 $(notdir $(rs_compatibility_jni_libs)))
276 # Provide a way to skip sources included in multiple projects.
277 ifdef LOCAL_RENDERSCRIPT_SKIP_INSTALL
278 skip_install_rs_libs := $(patsubst %.rs,%.so, \
279 $(addprefix $(TARGET_OUT_SHARED_LIBRARIES)/librs., \
280 $(notdir $(LOCAL_RENDERSCRIPT_SKIP_INSTALL))))
281 installed_rs_compatibility_jni_libs := \
282 $(filter-out $(skip_install_rs_libs),$(installed_rs_compatibility_jni_libs))
284 ifneq (,$(strip $(installed_rs_compatibility_jni_libs)))
285 $(installed_rs_compatibility_jni_libs) : $(TARGET_OUT_SHARED_LIBRARIES)/lib%.so : \
286 $(renderscript_intermediate)/lib%.so
287 $(hide) mkdir -p $(dir $@) && cp -f $< $@
289 # Install them only if the current module is installed.
290 $(LOCAL_INSTALLED_MODULE) : $(installed_rs_compatibility_jni_libs)
294 # We use intermediates.COMMON because the classes.jar/.dex files will be
295 # common even if LOCAL_BUILT_MODULE isn't.
297 # Override some target variables that base_rules set up for us.
298 $(LOCAL_INTERMEDIATE_TARGETS): \
299 PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
300 $(LOCAL_INTERMEDIATE_TARGETS): \
301 PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
303 # Since we're using intermediates.COMMON, make sure that it gets cleaned
305 $(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
307 ifdef full_classes_jar
309 # Droiddoc isn't currently able to generate stubs for modules, so we're just
310 # allowing it to use the classes.jar as the "stubs" that would be use to link
311 # against, for the cases where someone needs the jar to link against.
312 # - Use the classes.jar instead of the handful of other intermediates that
313 # we have, because it's the most processed, but still hasn't had dex run on
314 # it, so it's closest to what's on the device.
315 # - This extra copy, with the dependency on LOCAL_BUILT_MODULE allows the
316 # PRIVATE_ vars to be preserved.
317 $(full_classes_stubs_jar): PRIVATE_SOURCE_FILE := $(full_classes_jar)
318 $(full_classes_stubs_jar) : $(LOCAL_BUILT_MODULE) | $(ACP)
319 @echo Copying $(PRIVATE_SOURCE_FILE)
320 $(hide) $(ACP) -fp $(PRIVATE_SOURCE_FILE) $@
321 ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar)
323 # The layers file allows you to enforce a layering between java packages.
324 # Run build/tools/java-layers.py for more details.
325 layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
326 $(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
327 $(full_classes_compiled_jar): PRIVATE_WARNINGS_ENABLE := $(LOCAL_WARNINGS_ENABLE)
329 ifdef LOCAL_RMTYPEDEFS
330 $(full_classes_compiled_jar): | $(RMTYPEDEFS)
333 # Compile the java files to a .jar file.
334 # This intentionally depends on java_sources, not all_java_sources.
335 # Deps for generated source files must be handled separately,
336 # via deps on the target that generates the sources.
337 $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
338 $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := $(LOCAL_JAR_EXCLUDE_FILES)
339 $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := $(LOCAL_JAR_PACKAGES)
340 $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := $(LOCAL_JAR_EXCLUDE_PACKAGES)
341 $(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS)
342 $(full_classes_compiled_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
343 $(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \
344 $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) \
345 $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES)
346 $(transform-java-to-classes.jar)
348 $(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
350 # Run jarjar if necessary, otherwise just copy the file.
351 ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
352 $(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
353 $(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
355 $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
357 $(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
359 $(hide) $(ACP) -fp $< $@
362 ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
363 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em
364 $(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
365 # module level coverage filter can be defined using LOCAL_EMMA_COVERAGE_FILTER
367 ifdef LOCAL_EMMA_COVERAGE_FILTER
368 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := $(LOCAL_EMMA_COVERAGE_FILTER)
370 # by default, avoid applying emma instrumentation onto emma classes itself,
371 # otherwise there will be exceptions thrown
372 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := *,-emma,-emmarun,-com.vladium.*
374 # this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and
375 # $(full_classes_emma_jar)
376 $(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(EMMA_JAR)
377 $(transform-classes.jar-to-emma)
380 $(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(ACP)
382 $(copy-file-to-target)
385 # Keep a copy of the jar just before proguard processing.
386 $(full_classes_jar): $(full_classes_emma_jar) | $(ACP)
388 $(hide) $(ACP) -fp $< $@
390 # Run proguard if necessary, otherwise just copy the file.
391 ifdef LOCAL_PROGUARD_ENABLED
392 ifneq ($(filter-out full custom nosystem obfuscation optimization shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
393 $(warning while processing: $(LOCAL_MODULE))
394 $(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED))
396 proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
397 proguard_flags := $(addprefix -libraryjars ,$(full_shared_java_libs)) \
399 -printmapping $(proguard_dictionary)
401 ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),)
402 proguard_flags += -include $(BUILD_SYSTEM)/proguard.flags
403 ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
404 proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags
406 # If this is a test package, add proguard keep flags for tests.
407 ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),)
408 proguard_flags += -include $(BUILD_SYSTEM)/proguard_tests.flags
409 ifeq ($(filter shrinktests,$(LOCAL_PROGUARD_ENABLED)),)
410 proguard_flags += -dontshrink # don't shrink tests by default
413 ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
414 # By default no obfuscation
415 proguard_flags += -dontobfuscate
416 endif # No obfuscation
417 ifeq ($(filter optimization,$(LOCAL_PROGUARD_ENABLED)),)
418 # By default no optimization
419 proguard_flags += -dontoptimize
420 endif # No optimization
422 ifdef LOCAL_INSTRUMENTATION_FOR
423 ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
424 # If no obfuscation, link in the instrmented package's classes.jar as a library.
425 # link_instr_classes_jar is defined in base_rule.mk
426 proguard_flags += -libraryjars $(link_instr_classes_jar)
428 # If obfuscation is enabled, the main app must be obfuscated too.
429 # We need to run obfuscation using the main app's dictionary,
430 # and treat the main app's class.jar as injars instead of libraryjars.
431 proguard_flags := -injars $(link_instr_classes_jar) \
432 -outjars $(intermediates.COMMON)/proguard.$(LOCAL_INSTRUMENTATION_FOR).jar \
433 -include $(link_instr_intermediates_dir.COMMON)/proguard_options \
434 -applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
438 # Sometimes (test + main app) uses different keep rules from the main app -
439 # apply the main app's dictionary anyway.
440 proguard_flags += -ignorewarnings
442 # Make sure we run Proguard on the main app first
443 $(full_classes_proguard_jar) : $(link_instr_intermediates_dir.COMMON)/proguard.classes.jar
445 endif # no obfuscation
446 endif # LOCAL_INSTRUMENTATION_FOR
447 endif # LOCAL_PROGUARD_ENABLED is not nosystem
449 proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES))
450 LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
452 ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
453 extra_input_jar := $(call intermediates-dir-for,APPS,$(LOCAL_TEST_MODULE_TO_PROGUARD_WITH),,COMMON)/classes.jar
457 $(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
458 $(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(proguard_flags) $(LOCAL_PROGUARD_FLAGS)
459 $(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(proguard_flag_files) | $(ACP) $(PROGUARD)
460 $(call transform-jar-to-proguard)
462 else # LOCAL_PROGUARD_ENABLED not defined
463 $(full_classes_proguard_jar) : $(full_classes_jar)
465 $(hide) $(ACP) -fp $< $@
467 endif # LOCAL_PROGUARD_ENABLED defined
470 # Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug
471 # will work even when intermediates != intermediates.COMMON.
472 $(built_dex_intermediate): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
473 $(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
474 # If you instrument class files that have local variable debug information in
475 # them emma does not correctly maintain the local variable table.
476 # This will cause an error when you try to convert the class files for Android.
477 # The workaround here is to build different dex file here based on emma switch
478 # then later copy into classes.dex. When emma is on, dx is run with --no-locals
479 # option to remove local variable information
480 ifeq ($(LOCAL_EMMA_INSTRUMENT),true)
481 $(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals
483 $(built_dex_intermediate): $(full_classes_proguard_jar) $(DX)
484 $(transform-classes.jar-to-dex)
485 $(built_dex): $(built_dex_intermediate) | $(ACP)
487 $(hide) mkdir -p $(dir $@)
488 $(hide) rm -f $(dir $@)/classes*.dex
489 $(hide) $(ACP) -fp $(dir $<)/classes*.dex $(dir $@)
490 ifneq ($(GENERATE_DEX_DEBUG),)
494 findbugs_xml := $(intermediates.COMMON)/findbugs.xml
495 $(findbugs_xml) : PRIVATE_JAR_FILE := $(full_classes_jar)
496 $(findbugs_xml) : PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \
497 $(call normalize-path-list,$(filter %.jar,\
498 $(full_java_libs)))))
499 # We can't depend directly on full_classes_jar because the PRIVATE_
500 # vars won't be set up correctly.
501 $(findbugs_xml) : $(LOCAL_BUILT_MODULE)
503 $(hide) $(FINDBUGS) -textui -effort:min -xml:withMessages \
504 $(PRIVATE_AUXCLASSPATH) \
505 $(PRIVATE_JAR_FILE) \
508 ALL_FINDBUGS_FILES += $(findbugs_xml)
510 findbugs_html := $(PRODUCT_OUT)/findbugs/$(LOCAL_MODULE).html
511 $(findbugs_html) : PRIVATE_XML_FILE := $(findbugs_xml)
512 $(LOCAL_MODULE)-findbugs : $(findbugs_html)
513 $(findbugs_html) : $(findbugs_xml)
515 @echo ConvertXmlToText: $@
516 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl $(PRIVATE_XML_FILE) \
519 $(LOCAL_MODULE)-findbugs : $(findbugs_html)
521 endif # full_classes_jar is defined