Change built module of static java libraries

Set LOCAL_BUILT_MODULE of static java libraries when Jack is enabled
to classes.jack instead of javalib.jar.
This allows that running mm in those libraries will build classes.jack
instead of the jar.

Change-Id: I96b4b227848e971df96331b3f0cc731e856be349
This commit is contained in:
Yohann Roussel 2015-02-05 16:10:58 +01:00
parent 1f382fa4f7
commit d2a76c14bf
10 changed files with 70 additions and 28 deletions

View file

@ -43,13 +43,6 @@ endif
my_module_tags := $(LOCAL_MODULE_TAGS)
LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED))
ifneq ($(LOCAL_JACK_ENABLED),full)
ifneq ($(LOCAL_JACK_ENABLED),incremental)
LOCAL_JACK_ENABLED :=
endif
endif
###########################################################
## Validate and define fallbacks for input LOCAL_* variables.
###########################################################

View file

@ -0,0 +1,22 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED))
ifneq ($(LOCAL_JACK_ENABLED),full)
ifneq ($(LOCAL_JACK_ENABLED),incremental)
LOCAL_JACK_ENABLED :=
endif
endif

View file

@ -21,6 +21,8 @@
#
ifeq ($(HOST_OS),linux)
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_IS_STATIC_JAVA_LIBRARY := true
USE_CORE_LIB_BOOTCLASSPATH := true
LOCAL_JAVA_LIBRARIES += core-libart-hostdex
@ -51,5 +53,5 @@ $(full_classes_jack): $(java_sources) $(java_resource_sources) $(full_jack_lib_d
$(java-to-jack)
USE_CORE_LIB_BOOTCLASSPATH :=
LOCAL_IS_STATIC_JAVA_LIBRARY :=
endif

View file

@ -58,13 +58,13 @@ endif
$(full_classes_emma_jar) : $(full_classes_compiled_jar) | $(EMMA_JAR)
$(transform-classes.jar-to-emma)
$(LOCAL_BUILT_MODULE) : $(full_classes_emma_jar)
$(built_javalib_jar) : $(full_classes_emma_jar)
@echo Copying: $@
$(hide) $(ACP) -fp $< $@
else # LOCAL_EMMA_INSTRUMENT
# Directly build into LOCAL_BUILT_MODULE.
full_classes_compiled_jar := $(LOCAL_BUILT_MODULE)
# Directly build into $(built_javalib_jar).
full_classes_compiled_jar := $(built_javalib_jar)
endif # LOCAL_EMMA_INSTRUMENT
$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g

View file

@ -23,6 +23,22 @@ LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_IS_HOST_MODULE := true
LOCAL_BUILT_MODULE_STEM := javalib.jar
intermediates := $(call local-intermediates-dir)
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
built_javalib_jar := $(intermediates)/javalib.jar
#################################
include $(BUILD_SYSTEM)/configure_local_jack.mk
#################################
ifdef LOCAL_JACK_ENABLED
ifdef LOCAL_IS_STATIC_JAVA_LIBRARY
LOCAL_BUILT_MODULE_STEM := classes.jack
LOCAL_INTERMEDIATE_TARGETS += $(built_javalib_jar)
endif
endif
# base_rules.mk looks at this
all_res_assets :=
@ -39,9 +55,6 @@ else
endif
endif
intermediates := $(call local-intermediates-dir)
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))

View file

@ -538,17 +538,14 @@ ifneq ($(GENERATE_DEX_DEBUG),)
endif
findbugs_xml := $(intermediates.COMMON)/findbugs.xml
$(findbugs_xml) : PRIVATE_JAR_FILE := $(full_classes_jar)
$(findbugs_xml) : PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \
$(call normalize-path-list,$(filter %.jar,\
$(full_java_libs)))))
# We can't depend directly on full_classes_jar because the PRIVATE_
# vars won't be set up correctly.
$(findbugs_xml) : $(LOCAL_BUILT_MODULE)
$(findbugs_xml) : $(full_classes_jar)
@echo Findbugs: $@
$(hide) $(FINDBUGS) -textui -effort:min -xml:withMessages \
$(PRIVATE_AUXCLASSPATH) \
$(PRIVATE_JAR_FILE) \
$< \
> $@
ALL_FINDBUGS_FILES += $(findbugs_xml)

View file

@ -24,10 +24,20 @@ endif
LOCAL_BUILT_MODULE_STEM := javalib.jar
#################################
include $(BUILD_SYSTEM)/configure_local_jack.mk
#################################
ifdef LOCAL_JACK_ENABLED
ifdef LOCAL_IS_STATIC_JAVA_LIBRARY
LOCAL_BUILT_MODULE_STEM := classes.jack
endif
endif
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
# This file will be the one that other modules should depend on.
common_javalib.jar := $(intermediates.COMMON)/$(LOCAL_BUILT_MODULE_STEM)
common_javalib.jar := $(intermediates.COMMON)/javalib.jar
LOCAL_INTERMEDIATE_TARGETS += $(common_javalib.jar)
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
@ -59,7 +69,11 @@ endif
@echo "target Static Jar: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
$(LOCAL_BUILT_MODULE): $(common_javalib.jar)
ifdef LOCAL_JACK_ENABLED
$(LOCAL_BUILT_MODULE) : $(full_classes_jack)
else
$(LOCAL_BUILT_MODULE) : $(common_javalib.jar)
endif
$(copy-file-to-target)
else # !LOCAL_IS_STATIC_JAVA_LIBRARY

View file

@ -43,7 +43,7 @@ else
# javalib.jar is the default name for the build module (and isn't meaningful)
# If that's what we have, substitute the module name instead. These files
# aren't included on the device, so this name is synthetic anyway.
ifeq ($(module_leaf),javalib.jar)
ifneq ($(filter javalib.jar classes.jack,$(module_leaf)),)
module_leaf := $(LOCAL_MODULE).jar
endif
module_installed_filename := \

View file

@ -57,12 +57,9 @@ $(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS)
endif
LOCAL_MODULE_CLASS := APPS
LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED))
ifneq ($(LOCAL_JACK_ENABLED),full)
ifneq ($(LOCAL_JACK_ENABLED),incremental)
LOCAL_JACK_ENABLED :=
endif
endif
#################################
include $(BUILD_SYSTEM)/configure_local_jack.mk
#################################
# Package LOCAL_MODULE_TAGS default to optional
LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS))

View file

@ -59,6 +59,10 @@ endif
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
#################################
include $(BUILD_SYSTEM)/configure_local_jack.mk
#################################
ifdef LOCAL_JACK_ENABLED
ifndef LOCAL_JACK_PROGUARD_FLAGS
LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS)