Merge changes from topic "manifest_fixer_targetSdkVersion"

am: 7b21221d2a

Change-Id: I23336d8a71e2b42877606989d330aa68efb57d5e
This commit is contained in:
Colin Cross 2018-07-26 15:10:59 -07:00 committed by android-build-merger
commit 1ef3c64906
3 changed files with 29 additions and 32 deletions

View File

@ -38,28 +38,36 @@ else
$(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(DEFAULT_APP_TARGET_SDK)
endif
# Set up rules to merge library manifest files
my_exported_sdk_libs_file := $(call local-intermediates-dir,COMMON)/exported-sdk-libs
$(full_android_manifest): PRIVATE_EXPORTED_SDK_LIBS_FILE := $(my_exported_sdk_libs_file)
$(full_android_manifest): $(my_exported_sdk_libs_file)
$(full_android_manifest): $(MANIFEST_FIXER)
ifneq (,$(strip $(my_full_libs_manifest_files)))
# Set up rules to merge library manifest files
fixed_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml.fixed
$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
$(full_android_manifest): $(ANDROID_MANIFEST_MERGER_DEPS)
$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_files)
$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
$(full_android_manifest): $(ANDROID_MANIFEST_MERGER_DEPS)
$(full_android_manifest) : $(fixed_android_manifest) $(my_full_libs_manifest_files)
@echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
@mkdir -p $(dir $@)
$(call fix-manifest,$<,$@.tmp,$(PRIVATE_MIN_SDK_VERSION),$(PRIVATE_EXPORTED_SDK_LIBS_FILE))
$(hide) $(ANDROID_MANIFEST_MERGER) --main $@.tmp \
$(hide) $(ANDROID_MANIFEST_MERGER) --main $< \
--libs $(call normalize-path-list,$(PRIVATE_LIBS_MANIFESTS)) \
--out $@
rm $@.tmp
else
$(full_android_manifest): $(main_android_manifest)
@echo "Fix manifest: $@"
$(call fix-manifest,$<,$@,$(PRIVATE_MIN_SDK_VERSION),$(PRIVATE_EXPORTED_SDK_LIBS_FILE))
fixed_android_manifest := $(full_android_manifest)
endif
my_exported_sdk_libs_file := $(call local-intermediates-dir,COMMON)/exported-sdk-libs
$(fixed_android_manifest): PRIVATE_EXPORTED_SDK_LIBS_FILE := $(my_exported_sdk_libs_file)
$(fixed_android_manifest): $(my_exported_sdk_libs_file)
$(fixed_android_manifest): PRIVATE_MANIFEST_FIXER_FLAGS :=
ifneq ($(LOCAL_MODULE_CLASS),APPS)
$(fixed_android_manifest): PRIVATE_MANIFEST_FIXER_FLAGS := --library
endif
$(fixed_android_manifest): $(MANIFEST_FIXER)
$(fixed_android_manifest): $(main_android_manifest)
@echo "Fix manifest: $@"
$(MANIFEST_FIXER) \
--minSdkVersion $(PRIVATE_MIN_SDK_VERSION) \
$(PRIVATE_MANIFEST_FIXER_FLAGS) \
$(if (PRIVATE_EXPORTED_SDK_LIBS_FILE),\
$$(cat $(PRIVATE_EXPORTED_SDK_LIBS_FILE) | sort -u | sed -e 's/^/\ --uses-library\ /' | tr '\n' ' ')) \
$< $@

View File

@ -742,18 +742,6 @@ define exported-sdk-libs-files
$(foreach lib,$(1),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/exported-sdk-libs)
endef
# Fix manifest
# $(1): input manifest path
# $(2): output manifest path
# $(3): min sdk version
# $(4): (optional) exported-sdk-libs file
define fix-manifest
$(MANIFEST_FIXER) \
--minSdkVersion $(3) \
$(if $(4),$$(cat $(4) | sort -u | sed -e 's/^/\ --uses-library\ /' | tr '\n' ' ')) \
$(1) $(2)
endef
###########################################################
## Returns true if $(1) and $(2) are equal. Returns
## the empty string if they are not equal.

View File

@ -464,14 +464,15 @@ legacy_proguard_flags := -injars $(link_instr_classes_jar) \
-applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
-verbose \
$(legacy_proguard_flags)
legacy_proguard_lib_deps += \
$(link_instr_classes_jar) \
$(link_instr_intermediates_dir.COMMON)/proguard_options \
$(link_instr_intermediates_dir.COMMON)/proguard_dictionary \
# Sometimes (test + main app) uses different keep rules from the main app -
# apply the main app's dictionary anyway.
legacy_proguard_flags += -ignorewarnings
# Make sure we run Proguard on the main app first
$(full_classes_proguard_jar) : $(link_instr_intermediates_dir.COMMON)/proguard.classes.jar
endif # no obfuscation
endif # LOCAL_INSTRUMENTATION_FOR