From 536ef4e35a7355490670d285c1ab526d4da6f4e2 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 21 Feb 2017 16:14:55 -0800 Subject: [PATCH] Pass min sdk version to dx and desugar Test: make checkbuild Change-Id: Idde9712508571ea623126c7d25d2fa67eccf4833 --- core/definitions.mk | 4 +++- core/host_dalvik_java_library.mk | 9 +++++++++ core/java.mk | 8 ++++++++ core/package_internal.mk | 7 ------- core/static_java_library.mk | 6 ------ 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index e9ec26a23..0be983add 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2545,7 +2545,8 @@ $(hide) rm -f $@ $@.tmp $(hide) java -jar $(DESUGAR) \ $(addprefix --bootclasspath_entry ,$(call desugar-bootclasspath,$(PRIVATE_BOOTCLASSPATH))) \ $(addprefix --classpath_entry ,$(PRIVATE_ALL_JAVA_LIBRARIES)) \ - --min_sdk_version 24 --allow_empty_bootclasspath \ + --min_sdk_version $(PRIVATE_SDK_VERSION) \ + --allow_empty_bootclasspath \ $(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \ -i $< -o $@.tmp mv $@.tmp $@ @@ -2561,6 +2562,7 @@ $(hide) rm -f $(dir $@)classes*.dex $(hide) $(DX) \ -JXms16M -JXmx2048M \ --dex --output=$(dir $@) \ + --min-sdk-version=$(PRIVATE_SDK_VERSION) \ $(if $(NO_OPTIMIZE_DX), \ --no-optimize) \ $(if $(GENERATE_DEX_DEBUG), \ diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index 503f67bdf..72dfceed8 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -133,6 +133,15 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources) $(add-dex-to-package) endif # !LOCAL_IS_STATIC_JAVA_LIBRARY + +ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION) +else +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION) +endif + else # LOCAL_JACK_ENABLED $(LOCAL_INTERMEDIATE_TARGETS): \ PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc diff --git a/core/java.mk b/core/java.mk index d1ac6c7cc..b9f64f7d7 100644 --- a/core/java.mk +++ b/core/java.mk @@ -678,6 +678,14 @@ $(LOCAL_MODULE)-findbugs : $(findbugs_html) endif # full_classes_jar is defined +ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION) +else +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION) +endif + ifdef LOCAL_JACK_ENABLED $(LOCAL_INTERMEDIATE_TARGETS): \ PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc diff --git a/core/package_internal.mk b/core/package_internal.mk index 2e4878d6c..c9b681481 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -308,13 +308,6 @@ endif $(LOCAL_INTERMEDIATE_TARGETS): \ PRIVATE_ANDROID_MANIFEST := $(full_android_manifest) -ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) -$(LOCAL_INTERMEDIATE_TARGETS): \ - PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) -else -$(LOCAL_INTERMEDIATE_TARGETS): \ - PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) -endif ifeq ($(LOCAL_DATA_BINDING),true) data_binding_stamp := $(data_binding_intermediates)/data-binding.stamp diff --git a/core/static_java_library.mk b/core/static_java_library.mk index eeef4ce64..bf72a8227 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -141,12 +141,6 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_PUBLICS_OUTPUT := $(intermediate $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_INCLUDES := $(framework_res_package_export) -ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) -else -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) -endif - $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MANIFEST_PACKAGE_NAME :=