diff options
43 files changed, 875 insertions, 105 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk index edf0179..74e7c43 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -329,6 +329,11 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*) # instead. $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop) +# On to MNC +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*) + # Adding dalvik.vm.usejit $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop) diff --git a/core/Makefile b/core/Makefile index 741d19c..d13d325 100644 --- a/core/Makefile +++ b/core/Makefile @@ -503,7 +503,22 @@ bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER) $(BOOT_SIGNER) /boot $(INSTALLED_BOOTIMAGE_TARGET) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(INSTALLED_BOOTIMAGE_TARGET) $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE)) -else # PRODUCT_SUPPORTS_VERITY != true +else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_VERITY != true + +$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) + $(call pretty,"Target boot image: $@") + $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned + $(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $@.keyblock $@ + $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE)) + +.PHONY: bootimage-nodeps +bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) + @echo "make $@: ignoring dependencies" + $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned + $(VBOOT_SIGNER) $(FUTILITY) $(INSTALLED_BOOTIMAGE_TARGET).unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(INSTALLED_BOOTIMAGE_TARGET).keyblock $(INSTALLED_BOOTIMAGE_TARGET) + $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE)) + +else # PRODUCT_SUPPORTS_VBOOT != true $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(call pretty,"Target boot image: $@") @@ -1273,16 +1288,19 @@ $(BUILT_OTATOOLS_PACKAGE): \ $(BUILT_OTATOOLS_PACKAGE): \ zip_root := $(intermediate)/otatools +otatools_lib_path := $(notdir $(HOST_OUT_SHARED_LIBRARIES)) $(BUILT_OTATOOLS_PACKAGE): \ - $(OTATOOLS) + $(OTATOOLS) \ + $(HOST_OUT_SHARED_LIBRARIES)/libc++.so @echo "Package OTA tools: $@" $(hide) rm -rf $@ $(zip_root) - $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools + $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools $(zip_root)/$(otatools_lib_path) $(hide) $(ACP) -p $(OTATOOLS) $(zip_root)/bin $(hide) mv $(zip_root)/bin/*.jar $(zip_root)/framework/ + $(hide) $(ACP) $(HOST_OUT_SHARED_LIBRARIES)/libc++.so $(zip_root)/$(otatools_lib_path) $(hide) $(ACP) -r -d -p build/tools/releasetools/* $(zip_root)/releasetools $(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc - $(hide) (cd $(zip_root) && zip -qry $(abspath $@) bin framework releasetools) + $(hide) (cd $(zip_root) && zip -qry $(abspath $@) bin framework releasetools $(otatools_lib_path)) $(hide) zip -qry $(abspath $@) build/target/product/security/ $(hide) find device vendor -name \*.pk8 -o -name \*.x509.pem -o -name oem.prop | xargs zip -qry $(abspath $@) @@ -1444,7 +1462,7 @@ endif $(hide) echo "use_set_metadata=1" >> $(zip_root)/META/misc_info.txt $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt $(hide) echo "update_rename_support=1" >> $(zip_root)/META/misc_info.txt - $(hide) echo "blockimgdiff_versions=1,2" >> $(zip_root)/META/misc_info.txt + $(hide) echo "blockimgdiff_versions=1,2,3" >> $(zip_root)/META/misc_info.txt ifneq ($(OEM_THUMBPRINT_PROPERTIES),) # OTA scripts are only interested in fingerprint related properties $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt diff --git a/core/base_rules.mk b/core/base_rules.mk index 99107ab..1a2dc5e 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -381,7 +381,7 @@ endif # java_resource_file_groups # LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files, # but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR. # You have to set up the dependency in some other way. -need_compile_java := $(strip $(all_java_sources)$(all_res_assets))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED)) +need_compile_java := $(strip $(all_java_sources)$(all_res_assets)$(java_resource_sources))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED)) ifdef need_compile_java full_static_java_libs := \ @@ -419,10 +419,11 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_ja # be up-to-date. ifdef LOCAL_IS_HOST_MODULE ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true) -$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-deps,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE)) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE)) full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) -full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) +full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) \ + $(full_shared_java_libs) else $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := @@ -681,6 +682,86 @@ endif endif ########################################################### +# JACK +########################################################### +ifdef LOCAL_JACK_ENABLED +ifdef need_compile_java + +full_static_jack_libs := \ + $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \ + $(call intermediates-dir-for, \ + JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/classes.jack) + +ifeq ($(my_prefix),TARGET_) +ifeq ($(LOCAL_SDK_VERSION),) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,core-libart) +else +ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) +# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS. +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,android_stubs_current) +else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,android_system_stubs_current) +else +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,sdk_v$(LOCAL_SDK_VERSION)) +endif # current or system_current +endif # LOCAL_SDK_VERSION +endif # TARGET_ + +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JACK_LIBRARIES := $(full_static_jack_libs) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VM_ARGS := $(LOCAL_JACK_VM_ARGS) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_EXTRA_ARGS := $(LOCAL_JACK_EXTRA_ARGS) + +ifdef LOCAL_IS_HOST_MODULE +ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(call jack-lib-files,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE)) +full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) +full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) +else +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := +full_shared_jack_libs := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) +full_jack_lib_deps := $(full_shared_jack_libs) +endif # USE_CORE_LIB_BOOTCLASSPATH +else # !LOCAL_IS_HOST_MODULE +full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) +full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) +endif # !LOCAL_IS_HOST_MODULE +full_jack_libs := $(full_shared_jack_libs) $(full_static_jack_libs) $(LOCAL_JACK_CLASSPATH) +full_jack_lib_deps += $(full_static_jack_libs) $(LOCAL_JACK_CLASSPATH) + +# This is set by packages that are linking to other packages that export +# shared libraries, allowing them to make use of the code in the linked apk. +ifneq ($(apk_libraries),) + link_apk_jack_libraries := \ + $(foreach lib,$(apk_libraries), \ + $(call intermediates-dir-for, \ + APPS,$(lib),,COMMON)/classes.jack) + + # link against the jar with full original names (before proguard processing). + full_shared_jack_libs += $(link_apk_jack_libraries) + full_jack_libs += $(link_apk_jack_libraries) + full_jack_lib_deps += $(link_apk_jack_libraries) +endif + +# This is set by packages that contain instrumentation, allowing them to +# link against the package they are instrumenting. Currently only one such +# package is allowed. +ifdef LOCAL_INSTRUMENTATION_FOR + + # link against the jar with full original names (before proguard processing). + link_instr_classes_jack := $(link_instr_intermediates_dir.COMMON)/classes.noshrob.jack + full_jack_libs += $(link_instr_classes_jack) + full_jack_lib_deps += $(link_instr_classes_jack) +endif + +endif # need_compile_java + +# Propagate local configuration options to this target. +$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JACK_LIBRARIES:= $(full_jack_libs) +$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES) + +endif # LOCAL_JACK_ENABLED + +########################################################### ## NOTICE files ########################################################### diff --git a/core/binary.mk b/core/binary.mk index 92b08fa..d0b4496 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -483,6 +483,7 @@ rs_generated_cpps := $(addprefix \ # This is just a dummy rule to make sure gmake doesn't skip updating the dependents. $(rs_generated_cpps) : $(RenderScript_file_stamp) @echo "Updated RS generated cpp file $@." + $(hide) touch $@ my_c_includes += $(renderscript_intermediate) my_generated_sources += $(rs_generated_cpps) @@ -535,6 +536,7 @@ $(proto_generated_cc_sources): $(proto_generated_cc_sources_dir)/%.pb.cc: %.prot # This is just a dummy rule to make sure gmake doesn't skip updating the dependents. $(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc @echo "Updated header file $@." + $(hide) touch $@ $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined := true endif # transform-proto-to-cc rule included only once diff --git a/core/build_id.mk b/core/build_id.mk index f94b224..0e8e2cf 100644 --- a/core/build_id.mk +++ b/core/build_id.mk @@ -18,6 +18,4 @@ # (like "CRB01"). It must be a single word, and is # capitalized by convention. -BUILD_ID := AOSP - -DISPLAY_BUILD_NUMBER := true +export BUILD_ID=MASTER diff --git a/core/clang/config.mk b/core/clang/config.mk index 72a880f..a39095e 100644 --- a/core/clang/config.mk +++ b/core/clang/config.mk @@ -60,8 +60,12 @@ CLANG_CONFIG_UNKNOWN_CFLAGS := \ -fno-tree-sra \ -fprefetch-loop-arrays \ -funswitch-loops \ + -Werror=unused-but-set-variable \ + -Werror=unused-but-set-parameter \ -Wmaybe-uninitialized \ -Wno-error=maybe-uninitialized \ + -Wno-error=unused-but-set-variable \ + -Wno-error=unused-but-set-parameter \ -Wno-free-nonheap-object \ -Wno-literal-suffix \ -Wno-maybe-uninitialized \ diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk index cf980d8..159d66d 100644 --- a/core/cleanbuild.mk +++ b/core/cleanbuild.mk @@ -247,3 +247,22 @@ ifeq "$(force_installclean)" "true" $(info *** Done with the cleaning, now starting the real build.) endif force_installclean := + +.PHONY: clean-jack-files +clean-jack-files: clean-dex-files + $(hide) find $(OUT_DIR) -name "*.jack" | xargs rm -f + $(hide) find $(OUT_DIR) -type d -name "jack" | xargs rm -rf + @echo "All jack files have been removed." + +.PHONY: clean-dex-files +clean-dex-files: + $(hide) find $(OUT_DIR) -name "*.dex" ! -path "*/jack-incremental/*" | xargs rm -f + $(hide) for i in `find $(OUT_DIR) -name "*.jar" -o -name "*.apk"` ; do ((unzip -l $$i 2> /dev/null | \ + grep -q "\.dex$$" && rm -f $$i) || continue ) ; done + @echo "All dex files and archives containing dex files have been removed." + +.PHONY: clean-jack-incremental +clean-jack-incremental: + $(hide) find $(OUT_DIR) -name "jack-incremental" -type d | xargs rm -rf + @echo "All jack incremental dirs have been removed." + diff --git a/core/clear_vars.mk b/core/clear_vars.mk index ed7771d..876698a 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -74,6 +74,7 @@ LOCAL_JAVA_LIBRARIES:= LOCAL_JAVA_LAYERS_FILE:= LOCAL_NO_STANDARD_LIBRARIES:= LOCAL_CLASSPATH:= +LOCAL_JACK_CLASSPATH:= LOCAL_DROIDDOC_USE_STANDARD_DOCLET:= LOCAL_DROIDDOC_SOURCE_PATH:= LOCAL_DROIDDOC_TEMPLATE_DIR:= @@ -108,6 +109,11 @@ LOCAL_JARJAR_RULES:= LOCAL_ADDITIONAL_JAVA_DIR:= LOCAL_ALLOW_UNDEFINED_SYMBOLS:= LOCAL_DX_FLAGS:= +LOCAL_JACK_ENABLED:=$(DEFAULT_JACK_ENABLED) # '' (ie disabled), disabled, full, incremental +LOCAL_JACK_VM_ARGS := $(DEFAULT_JACK_VM_ARGS) +LOCAL_JACK_EXTRA_ARGS := $(DEFAULT_JACK_EXTRA_ARGS) +LOCAL_JACK_FLAGS:= +LOCAL_JILL_FLAGS:= LOCAL_CERTIFICATE:= LOCAL_SDK_VERSION:= LOCAL_SDK_RES_VERSION:= @@ -115,6 +121,7 @@ LOCAL_NDK_STL_VARIANT:= LOCAL_EMMA_INSTRUMENT:= LOCAL_PROGUARD_ENABLED:= # '',full,custom,nosystem,disabled,obfuscation,optimization LOCAL_PROGUARD_FLAGS:= +LOCAL_JACK_PROGUARD_FLAGS:= LOCAL_PROGUARD_FLAG_FILES:= LOCAL_TEST_MODULE_TO_PROGUARD_WITH:= LOCAL_EMMA_COVERAGE_FILTER:= diff --git a/core/combo/javac.mk b/core/combo/javac.mk index fb43ea4..82cbb43 100644 --- a/core/combo/javac.mk +++ b/core/combo/javac.mk @@ -9,6 +9,11 @@ # COMMON_JAVAC -- Java compiler command with common arguments # +ifndef ANDROID_COMPILE_WITH_JACK +# Defines if compilation with jack is enabled by default. +ANDROID_COMPILE_WITH_JACK := true +endif + common_jdk_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999 # Use the indexer wrapper to index the codebase instead of the javac compiler diff --git a/core/config.mk b/core/config.mk index 0b76b53..c3877ee 100644 --- a/core/config.mk +++ b/core/config.mk @@ -134,6 +134,12 @@ TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=addre # TODO: do symbol compression TARGET_COMPRESS_MODULE_SYMBOLS := false +ifdef TMPDIR +JAVA_TMPDIR_ARG := -Djava.io.tmpdir=$(TMPDIR) +else +JAVA_TMPDIR_ARG := +endif + # ############################################################### # Include sub-configuration files # ############################################################### @@ -368,6 +374,9 @@ endif # --------------------------------------------------------------- # Generic tools. +JACK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/jack.jar +JILL_JAR := $(HOST_OUT_JAVA_LIBRARIES)/jill.jar +JACK_MULTIDEX_DEFAULT_PREPROCESSOR := frameworks/multidex/library/resources/JACK-INF/legacyMultidexInstallation.jpp LEX := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/flex/flex-2.5.39 # The default PKGDATADIR built in the prebuilt bison is a relative path @@ -411,6 +420,39 @@ MKTARBALL := build/tools/mktarball.sh TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX) E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX) JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar + +ifeq ($(ANDROID_COMPILE_WITH_JACK),true) +DEFAULT_JACK_ENABLED:=full +else +DEFAULT_JACK_ENABLED:= +endif +ifneq ($(strip $(ANDROID_JACK_VM)),) +JACK_VM := $(ANDROID_JACK_VM) +else +JACK_VM := java +endif +# call jack +# +# $(1): vm arguments +# $(2): jack perf arguments +define call-jack +$(JACK_VM) $(1) $(JAVA_TMPDIR_ARG) -jar $(JACK_JAR) $(2) +endef +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VM_ARGS := $(DEFAULT_JACK_VM_ARGS) +ifneq ($(ANDROID_JACK_VM_ARGS),) +DEFAULT_JACK_VM_ARGS := $(ANDROID_JACK_VM_ARGS) +else +DEFAULT_JACK_VM_ARGS := -Dfile.encoding=UTF-8 -Xmx3584m -Xms2560m -XX:+TieredCompilation +endif +ifneq ($(ANDROID_JACK_EXTRA_ARGS),) +DEFAULT_JACK_EXTRA_ARGS := $(ANDROID_JACK_EXTRA_ARGS) +else +DEFAULT_JACK_EXTRA_ARGS := --sanity-checks off +endif +# Turn off jack warnings by default. +DEFAULT_JACK_EXTRA_ARGS += --verbose error + +JILL := java -Xmx3500m -jar $(JILL_JAR) PROGUARD := external/proguard/bin/proguard.sh JAVATAGS := build/tools/java-event-log-tags.py LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc$(HOST_EXECUTABLE_SUFFIX) @@ -421,6 +463,8 @@ APPEND2SIMG := $(HOST_OUT_EXECUTABLES)/append2simg VERITY_SIGNER := $(HOST_OUT_EXECUTABLES)/verity_signer BUILD_VERITY_TREE := $(HOST_OUT_EXECUTABLES)/build_verity_tree BOOT_SIGNER := $(HOST_OUT_EXECUTABLES)/boot_signer +FUTILITY := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/futility/futility +VBOOT_SIGNER := prebuilts/misc/scripts/vboot_signer/vboot_signer.sh # ACP is always for the build OS, not for the host OS ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX) diff --git a/core/configure_local_jack.mk b/core/configure_local_jack.mk new file mode 100644 index 0000000..98b13d2 --- /dev/null +++ b/core/configure_local_jack.mk @@ -0,0 +1,30 @@ +# +# 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. +# + +ifdef ANDROID_FORCE_JACK_ENABLED +LOCAL_JACK_ENABLED := $(ANDROID_FORCE_JACK_ENABLED) +endif +LOCAL_JACK_ENABLED := $(strip $(LOCAL_JACK_ENABLED)) +ifneq ($(LOCAL_JACK_ENABLED),full) +ifneq ($(LOCAL_JACK_ENABLED),incremental) +ifdef LOCAL_JACK_ENABLED +ifneq ($(LOCAL_JACK_ENABLED),disabled) +$(error $(LOCAL_PATH): invalid LOCAL_JACK_ENABLED "$(LOCAL_JACK_ENABLED)" for $(LOCAL_MODULE)) +endif +endif +LOCAL_JACK_ENABLED := +endif +endif diff --git a/core/definitions.mk b/core/definitions.mk index f59b78e..a833edc 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -403,6 +403,14 @@ $(1): $(2) endef ########################################################### +## Reverse order of a list +########################################################### + +define reverse-list +$(if $(1),$(call reverse-list,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1)) +endef + +########################################################### ## The intermediates directory. Where object files go for ## a given target. We could technically get away without ## the "_intermediates" suffix on the directory, but it's @@ -602,6 +610,36 @@ $(foreach lib,$(1),$(call _java-lib-full-dep,$(lib),$(2))) endef ########################################################### +## Convert "core ext framework" to "out/.../classes.jack ..." +## $(1): library list +## $(2): Non-empty if IS_HOST_MODULE +########################################################### + +# $(1): library name +# $(2): Non-empty if IS_HOST_MODULE +define _jack-lib-full-classes +$(call _java-lib-dir,$(1),$(2))/classes.jack +endef + +# $(1): library name list +# $(2): Non-empty if IS_HOST_MODULE +define jack-lib-files +$(foreach lib,$(1),$(call _jack-lib-full-classes,$(lib),$(2))) +endef + +# $(1): library name +# $(2): Non-empty if IS_HOST_MODULE +define _jack-lib-full-dep +$(call _jack-lib-full-classes,$(1),$(2)) +endef + +# $(1): library name list +# $(2): Non-empty if IS_HOST_MODULE +define jack-lib-deps +$(foreach lib,$(1),$(call _jack-lib-full-dep,$(lib),$(2))) +endef + +########################################################### ## Run rot13 on a string ## $(1): the string. Must be one line. ########################################################### @@ -1743,6 +1781,146 @@ define transform-java-to-classes.jar $(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH)) endef +# Invoke Jack to compile java from source to dex and jack files. +# +# Some historical notes: +# - below we write the list of java files to java-source-list to avoid argument +# list length problems with Cygwin +# - we filter out duplicate java file names because Jack doesn't like them. +# TODO (yroussel) PRIVATE_RMTYPEDEFS +define jack-java-to-dex +$(hide) rm -f $@ +$(hide) rm -f $(PRIVATE_CLASSES_JACK) +$(hide) rm -rf $(PRIVATE_JACK_INTERMEDIATES_DIR) +$(hide) mkdir -p $(dir $@) +$(hide) mkdir -p $(dir $(PRIVATE_CLASSES_JACK)) +$(hide) mkdir -p $(PRIVATE_JACK_INTERMEDIATES_DIR) +$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR)) +$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list) +$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \ + find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \ +fi +$(hide) tr ' ' '\n' < $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list \ + | sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq +$(if $(PRIVATE_JACK_PROGUARD_FLAGS), \ + $(hide) echo -basedirectory $(CURDIR) > $@.flags; \ + echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \ +) +$(if $(PRIVATE_EXTRA_JAR_ARGS), + $(hide) mkdir -p $@.res.tmp + $(hide) $(call create-empty-package-at,$@.res.tmp.zip) + $(hide) $(call add-java-resources-to,$@.res.tmp.zip) + $(hide) $(call unzip-jar-files,$@.res.tmp.zip,$@.res.tmp) + $(hide) rm $@.res.tmp.zip) +$(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \ + export tmpEcjArg="@$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq"; \ +else \ + export tmpEcjArg=""; \ +fi; \ +$(call call-jack,$(PRIVATE_JACK_VM_ARGS),$(PRIVATE_JACK_EXTRA_ARGS)) \ + $(strip $(PRIVATE_JACK_FLAGS)) \ + $(strip $(PRIVATE_JACK_DEBUG_FLAGS)) \ + $(if $(NO_OPTIMIZE_DX), \ + -D jack.dex.optimize="false") \ + $(addprefix --classpath ,$(strip \ + $(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \ + $(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \ + $(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \ + -D jack.import.resource.policy=keep-first \ + -D jack.import.type.policy=keep-first \ + --output-jack $(PRIVATE_CLASSES_JACK) \ + -D jack.java.source.version=1.7 \ + $(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \ + --output-dex $(PRIVATE_JACK_INTERMEDIATES_DIR) \ + $(addprefix --config-jarjar ,$(strip $(PRIVATE_JARJAR_RULES))) \ + $(if $(PRIVATE_JACK_PROGUARD_FLAGS),--config-proguard $@.flags) \ + $$tmpEcjArg \ + || ( rm -rf $(PRIVATE_CLASSES_JACK); rm -rf $(PRIVATE_JACK_INTERMEDIATES_DIR); exit 41 ) +$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/classes*.dex $(dir $@) +$(hide) rm -f $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list +$(if $(PRIVATE_EXTRA_JAR_ARGS),$(hide) rm -rf $@.res.tmp) +$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq $(PRIVATE_JACK_INTERMEDIATES_DIR).java-source-list +$(if $(PRIVATE_JAR_PACKAGES), $(hide) echo unsupported options PRIVATE_JAR_PACKAGES in $@; exit 53) +$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) echo unsupported options JAR_EXCLUDE_PACKAGES in $@; exit 53) +$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53) +endef + +define transform-jar-to-jack + $(hide) mkdir -p $(dir $@) + $(JILL) $(PRIVATE_JILL_FLAGS) --output $@.tmpjill.jack $< + $(hide) mkdir -p $@.tmpjill.res + $(hide) $(call unzip-jar-files,$<,$@.tmpjill.res) + $(hide) find $@.tmpjill.res -iname "*.class" -delete + $(hide) $(call call-jack,$(PRIVATE_JACK_VM_ARGS),$(PRIVATE_JACK_EXTRA_ARGS)) \ + -D jack.import.resource.policy=keep-first \ + -D jack.import.type.policy=keep-first \ + --import $@.tmpjill.jack \ + --import-resource $@.tmpjill.res \ + --output-jack $@ + $(hide) rm -rf $@.tmpjill.res + $(hide) rm $@.tmpjill.jack +endef + + +# Invoke Jack to compile java from source to jack files without shrink or obfuscation. +# +# Some historical notes: +# - below we write the list of java files to java-source-list to avoid argument +# list length problems with Cygwin +# - we filter out duplicate java file names because Jack doesn't like them. +define java-to-jack +$(hide) rm -f $@ +$(hide) rm -rf $(PRIVATE_JACK_INTERMEDIATES_DIR) +$(hide) mkdir -p $(dir $@) +$(hide) mkdir -p $(PRIVATE_JACK_INTERMEDIATES_DIR) +$(if $(PRIVATE_JACK_INCREMENTAL_DIR),$(hide) mkdir -p $(PRIVATE_JACK_INCREMENTAL_DIR)) +$(call dump-words-to-file,$(PRIVATE_JAVA_SOURCES),$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list) +$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \ + find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' >> $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list; \ +fi +$(hide) tr ' ' '\n' < $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list \ + | sort -u > $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq +$(if $(PRIVATE_JACK_PROGUARD_FLAGS), \ + $(hide) echo -basedirectory $(CURDIR) > $@.flags; \ + echo $(PRIVATE_JACK_PROGUARD_FLAGS) >> $@.flags; \ +) +$(if $(PRIVATE_EXTRA_JAR_ARGS), + $(hide) mkdir -p $@.res.tmp + $(hide) $(call create-empty-package-at,$@.res.tmp.zip) + $(hide) $(call add-java-resources-to,$@.res.tmp.zip) + $(hide) unzip -qo $@.res.tmp.zip -d $@.res.tmp + $(hide) rm $@.res.tmp.zip) +$(hide) if [ -s $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \ + export tmpEcjArg="@$(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq"; \ +else \ + export tmpEcjArg=""; \ +fi; \ +$(call call-jack,$(PRIVATE_JACK_VM_ARGS),$(PRIVATE_JACK_EXTRA_ARGS)) \ + $(strip $(PRIVATE_JACK_FLAGS)) \ + $(strip $(PRIVATE_JACK_DEBUG_FLAGS)) \ + $(if $(NO_OPTIMIZE_DX), \ + -D jack.dex.optimize="false") \ + $(addprefix --classpath ,$(strip \ + $(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \ + $(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \ + $(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \ + -D jack.import.resource.policy=keep-first \ + -D jack.import.type.policy=keep-first \ + -D jack.java.source.version=1.7 \ + $(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \ + --output-jack $@ \ + $(addprefix --config-jarjar ,$(strip $(PRIVATE_JARJAR_RULES))) \ + $(if $(PRIVATE_JACK_PROGUARD_FLAGS),--config-proguard $@.flags) \ + $$tmpEcjArg \ + || ( rm -f $@ ; exit 41 ) +$(hide) rm -f $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list +$(if $(PRIVATE_EXTRA_JAR_ARGS),$(hide) rm -rf $@.res.tmp) +$(hide) mv $(PRIVATE_JACK_INTERMEDIATES_DIR)/java-source-list-uniq $(PRIVATE_JACK_INTERMEDIATES_DIR).java-source-list +$(if $(PRIVATE_JAR_PACKAGES), $(hide) echo unsupported options PRIVATE_JAR_PACKAGES in $@; exit 53) +$(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) echo unsupported options JAR_EXCLUDE_PACKAGES in $@; exit 53) +$(if $(PRIVATE_JAR_MANIFEST), $(hide) echo unsupported options JAR_MANIFEST in $@; exit 53) +endef + # Override the above definitions if we want to do incremetal javac ifeq (true, $(ENABLE_INCREMENTALJAVAC)) define compile-java @@ -1836,12 +2014,20 @@ endef # Create a mostly-empty .jar file that we'll add to later. # The MacOS jar tool doesn't like creating empty jar files, # so we need to give it something. +# $(1) package to create +define create-empty-package-at +@mkdir -p $(dir $(1)) +$(hide) touch $(dir $(1))zipdummy +$(hide) (cd $(dir $(1)) && jar cf $(notdir $(1)) zipdummy) +$(hide) zip -qd $(1) zipdummy +$(hide) rm $(dir $(1))zipdummy +endef + +# Create a mostly-empty .jar file that we'll add to later. +# The MacOS jar tool doesn't like creating empty jar files, +# so we need to give it something. define create-empty-package -@mkdir -p $(dir $@) -$(hide) touch $(dir $@)zipdummy -$(hide) (cd $(dir $@) && jar cf $(notdir $@) zipdummy) -$(hide) zip -qd $@ zipdummy -$(hide) rm $(dir $@)zipdummy +$(call create-empty-package-at,$@) endef # Copy an arhchive file and delete any class files and empty folders inside. @@ -1914,6 +2100,19 @@ $(hide) jar uf $(1) @$(1).jar-arg-list @rm -f $(1).jar-arg-list endef +# Add resources carried by static Jack libraries. +# +define add-carried-jack-resources + $(hide) if [ -d $(PRIVATE_JACK_INTERMEDIATES_DIR) ] ; then \ + jack_res_jar_flags=$$(find $(PRIVATE_JACK_INTERMEDIATES_DIR) -type f \ + | sed -e "s?^$(PRIVATE_JACK_INTERMEDIATES_DIR)/? -C $(PRIVATE_JACK_INTERMEDIATES_DIR) ?"); \ + if [ -n "$$jack_res_jar_flags" ] ; then \ + echo $$jack_res_jar_flags >$(dir $@)jack_res_jar_flags; \ + jar uf $@ $$jack_res_jar_flags; \ + fi; \ +fi +endef + # Sign a package using the specified key/cert. # define sign-package diff --git a/core/dpi_specific_apk.mk b/core/dpi_specific_apk.mk index 0e8cbdf..3790744 100644 --- a/core/dpi_specific_apk.mk +++ b/core/dpi_specific_apk.mk @@ -25,34 +25,44 @@ $(built_dpi_apk): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME $(built_dpi_apk): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_INSTRUMENTATION_FOR) $(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis) $(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis) -$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex) -# Note that PRIVATE_CLASS_INTERMEDIATES_DIR points to the base apk's intermediate dir. -$(built_dpi_apk): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes -$(built_dpi_apk): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args) $(built_dpi_apk): PRIVATE_PRIVATE_KEY := $(private_key) $(built_dpi_apk): PRIVATE_CERTIFICATE := $(certificate) $(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\ $(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8) +$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := +ifneq ($(full_classes_jar),) +$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex) +ifndef LOCAL_JACK_ENABLED +# Use the jarjar processed arhive as the initial package file. +$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar) +else +$(built_dpi_apk): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc +endif # LOCAL_JACK_ENABLED +$(built_dpi_apk): $(built_dex) +else +$(built_dpi_apk): PRIVATE_DEX_FILE := +endif # full_classes_jar + # Set up dependenncies and the build recipe. $(built_dpi_apk) : $(R_file_stamp) $(built_dpi_apk) : $(all_library_res_package_export_deps) -$(built_dpi_apk) : $(built_dex) $(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR) $(built_dpi_apk) : $(AAPT) | $(ZIPALIGN) $(built_dpi_apk) : $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest) @echo "target Package: $(PRIVATE_MODULE) ($@)" - $(create-empty-package) + $(if $(PRIVATE_SOURCE_ARCHIVE),\ + $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\ + $(create-empty-package)) $(add-assets-to-package) ifneq ($(jni_shared_libraries),) $(add-jni-shared-libs-to-package) endif ifneq ($(full_classes_jar),) $(add-dex-to-package) +ifdef LOCAL_JACK_ENABLED + $(add-carried-jack-resources) endif - $(add-carried-java-resources) -ifneq ($(extra_jar_args),) - $(add-java-resources-to-package) endif $(sign-package) $(align-package) diff --git a/core/executable_prefer_symlink.mk b/core/executable_prefer_symlink.mk index 2326e83..fc97ad3 100644 --- a/core/executable_prefer_symlink.mk +++ b/core/executable_prefer_symlink.mk @@ -39,7 +39,10 @@ $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32) endif endif -$(my_symlink): $(LOCAL_INSTALLED_MODULE) $(LOCAL_MODULE_MAKEFILE) +# $(my_symlink) doesn't need to depend on $(PRIVATE_SRC_BINARY_NAME): we can generate symlink to nonexistent file. +# If you add the dependency, make would compare the timestamp of a file against that of its symlink: +# they are always equal, because make follows symlink. +$(my_symlink): $(LOCAL_MODULE_MAKEFILE) @echo "Symlink: $@ -> $(PRIVATE_SRC_BINARY_NAME)" @mkdir -p $(dir $@) @rm -rf $@ diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk index f8264ee..9ee1183 100644 --- a/core/host_dalvik_java_library.mk +++ b/core/host_dalvik_java_library.mk @@ -34,11 +34,13 @@ endif full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar full_classes_jar := $(intermediates.COMMON)/classes.jar +full_classes_jack := $(intermediates.COMMON)/classes.jack built_dex := $(intermediates.COMMON)/classes.dex LOCAL_INTERMEDIATE_TARGETS += \ $(full_classes_compiled_jar) \ $(full_classes_jarjar_jar) \ + $(full_classes_jack) \ $(full_classes_jar) \ $(built_dex) @@ -96,6 +98,7 @@ $(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP) @echo Copying: $@ $(hide) $(ACP) -fp $< $@ +ifndef LOCAL_JACK_ENABLED $(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON) $(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS) $(built_dex): $(full_classes_jar) $(DX) @@ -109,6 +112,42 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources) $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@) $(add-dex-to-package) +else # LOCAL_JACK_ENABLED +$(LOCAL_INTERMEDIATE_TARGETS): \ + PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc + +ifeq ($(LOCAL_JACK_ENABLED),incremental) +$(LOCAL_INTERMEDIATE_TARGETS): \ + PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental +else +$(LOCAL_INTERMEDIATE_TARGETS): \ + PRIVATE_JACK_INCREMENTAL_DIR := +endif +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_DEBUG_FLAGS := -g + +$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack) +$(built_dex): PRIVATE_JACK_FLAGS := $(LOCAL_JACK_FLAGS) +$(built_dex): $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ + $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK_JAR) + @echo Building with Jack: $@ + $(jack-java-to-dex) + +# $(full_classes_jack) is just by-product of $(built_dex). +# The dummy command was added because, without it, make misses the fact the $(built_dex) also +# change $(full_classes_jack). +$(full_classes_jack): $(built_dex) + $(hide) touch $@ + +$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex) +$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources) + @echo "Host Jar: $(PRIVATE_MODULE) ($@)" + $(create-empty-package) + $(add-dex-to-package) + $(add-carried-jack-resources) + +endif # LOCAL_JACK_ENABLED + USE_CORE_LIB_BOOTCLASSPATH := endif diff --git a/core/host_dalvik_static_java_library.mk b/core/host_dalvik_static_java_library.mk index 9e5aaa3..410b251 100644 --- a/core/host_dalvik_static_java_library.mk +++ b/core/host_dalvik_static_java_library.mk @@ -21,11 +21,37 @@ # 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 +intermediates.COMMON := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),true,COMMON,) +full_classes_jack := $(intermediates.COMMON)/classes.jack +LOCAL_INTERMEDIATE_TARGETS += \ + $(full_classes_jack) + include $(BUILD_SYSTEM)/host_java_library.mk +# proguard is not supported +# *.proto files are not supported +$(full_classes_jack): PRIVATE_JACK_FLAGS := $(LOCAL_JACK_FLAGS) +$(full_classes_jack): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES) +$(full_classes_jack): \ + PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc +ifeq ($(LOCAL_JACK_ENABLED),incremental) +$(full_classes_jack): \ + PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental +else +$(full_classes_jack): \ + PRIVATE_JACK_INCREMENTAL_DIR := +endif +$(full_classes_jack): $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ + $(jar_manifest_file) $(layers_file) $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \ + $(JACK_JAR) + @echo Building with Jack: $@ + $(java-to-jack) USE_CORE_LIB_BOOTCLASSPATH := - +LOCAL_IS_STATIC_JAVA_LIBRARY := endif diff --git a/core/host_java_library.mk b/core/host_java_library.mk index b751c5f..513d185 100644 --- a/core/host_java_library.mk +++ b/core/host_java_library.mk @@ -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 diff --git a/core/host_java_library_common.mk b/core/host_java_library_common.mk index cd9e679..35a6e28 100644 --- a/core/host_java_library_common.mk +++ b/core/host_java_library_common.mk @@ -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 := @@ -34,14 +50,15 @@ else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano) LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-nano else - LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-lite + ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full) + LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-full + else + LOCAL_JAVA_LIBRARIES += host-libprotobuf-java-lite + endif endif 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)) diff --git a/core/java.mk b/core/java.mk index cd90f03..1494c4b 100644 --- a/core/java.mk +++ b/core/java.mk @@ -7,7 +7,9 @@ ifeq ($(TARGET_BUILD_PDK),true) ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),) # LOCAL_SDK not defined or set to current ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),) +ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION) +endif #!LOCAL_NO_STANDARD_LIBRARIES endif endif # !PDK_JAVA endif #PDK @@ -112,6 +114,10 @@ else full_classes_jar := $(intermediates.COMMON)/classes.jar built_dex := $(intermediates.COMMON)/classes.dex endif +# final Jack library, shrinked and obfuscated if it must be +full_classes_jack := $(intermediates.COMMON)/classes.jack +# intermediate Jack library without shrink and obfuscation +noshrob_classes_jack := $(intermediates.COMMON)/classes.noshrob.jack LOCAL_INTERMEDIATE_TARGETS += \ $(full_classes_compiled_jar) \ @@ -120,6 +126,8 @@ LOCAL_INTERMEDIATE_TARGETS += \ $(full_classes_jar) \ $(full_classes_proguard_jar) \ $(built_dex_intermediate) \ + $(full_classes_jack) \ + $(noshrob_classes_jack) \ $(built_dex) \ $(full_classes_stubs_jar) @@ -337,7 +345,7 @@ ifdef full_classes_jar # - This extra copy, with the dependency on LOCAL_BUILT_MODULE allows the # PRIVATE_ vars to be preserved. $(full_classes_stubs_jar): PRIVATE_SOURCE_FILE := $(full_classes_jar) -$(full_classes_stubs_jar) : $(LOCAL_BUILT_MODULE) | $(ACP) +$(full_classes_stubs_jar) : $(full_classes_jar) | $(ACP) @echo Copying $(PRIVATE_SOURCE_FILE) $(hide) $(ACP) -fp $(PRIVATE_SOURCE_FILE) $@ ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar) @@ -423,50 +431,57 @@ ifneq ($(filter-out full custom nosystem obfuscation optimization shrinktests,$( $(error invalid value for LOCAL_PROGUARD_ENABLED: $(LOCAL_PROGUARD_ENABLED)) endif proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary -proguard_flags := $(addprefix -libraryjars ,$(full_shared_java_libs)) \ +# jack already has the libraries in its classpath and doesn't support jars +legacy_proguard_flags := $(addprefix -libraryjars ,$(full_shared_java_libs)) +common_proguard_flags := \ -forceprocessing \ -printmapping $(proguard_dictionary) ifeq ($(filter nosystem,$(LOCAL_PROGUARD_ENABLED)),) -proguard_flags += -include $(BUILD_SYSTEM)/proguard.flags +common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.flags ifeq ($(LOCAL_EMMA_INSTRUMENT),true) -proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags +common_proguard_flags += -include $(BUILD_SYSTEM)/proguard.emma.flags endif # If this is a test package, add proguard keep flags for tests. ifneq ($(LOCAL_INSTRUMENTATION_FOR)$(filter tests,$(LOCAL_MODULE_TAGS)),) -proguard_flags += -include $(BUILD_SYSTEM)/proguard_tests.flags +common_proguard_flags += -include $(BUILD_SYSTEM)/proguard_tests.flags ifeq ($(filter shrinktests,$(LOCAL_PROGUARD_ENABLED)),) -proguard_flags += -dontshrink # don't shrink tests by default +common_proguard_flags += -dontshrink # don't shrink tests by default endif # shrinktests endif # test package ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),) # By default no obfuscation -proguard_flags += -dontobfuscate +common_proguard_flags += -dontobfuscate endif # No obfuscation ifeq ($(filter optimization,$(LOCAL_PROGUARD_ENABLED)),) # By default no optimization -proguard_flags += -dontoptimize +common_proguard_flags += -dontoptimize endif # No optimization ifdef LOCAL_INSTRUMENTATION_FOR ifeq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),) # If no obfuscation, link in the instrmented package's classes.jar as a library. # link_instr_classes_jar is defined in base_rule.mk -proguard_flags += -libraryjars $(link_instr_classes_jar) +# jack already has this library in its classpath and doesn't support jars +legacy_proguard_flags += -libraryjars $(link_instr_classes_jar) else # obfuscation # If obfuscation is enabled, the main app must be obfuscated too. # We need to run obfuscation using the main app's dictionary, # and treat the main app's class.jar as injars instead of libraryjars. -proguard_flags := -injars $(link_instr_classes_jar) \ +legacy_proguard_flags := -injars $(link_instr_classes_jar) \ -outjars $(intermediates.COMMON)/proguard.$(LOCAL_INSTRUMENTATION_FOR).jar \ -include $(link_instr_intermediates_dir.COMMON)/proguard_options \ -applymapping $(link_instr_intermediates_dir.COMMON)/proguard_dictionary \ -verbose \ - $(proguard_flags) + $(legacy_proguard_flags) +# not supported with jack +ifdef LOCAL_JACK_ENABLED + $(error $(LOCAL_MODULE): Build with jack of instrumentation when obfuscating is not yet supported) +endif # Sometimes (test + main app) uses different keep rules from the main app - # apply the main app's dictionary anyway. -proguard_flags += -ignorewarnings +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 @@ -484,7 +499,7 @@ else extra_input_jar := endif $(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar) -$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(proguard_flags) $(LOCAL_PROGUARD_FLAGS) +$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS) $(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(proguard_flag_files) | $(ACP) $(PROGUARD) $(call transform-jar-to-proguard) @@ -495,7 +510,7 @@ $(full_classes_proguard_jar) : $(full_classes_jar) endif # LOCAL_PROGUARD_ENABLED defined - +ifndef LOCAL_JACK_ENABLED # Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug # will work even when intermediates != intermediates.COMMON. $(built_dex_intermediate): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON) @@ -511,6 +526,8 @@ $(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals endif $(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(transform-classes.jar-to-dex) +endif # LOCAL_JACK_ENABLED is disabled + $(built_dex): $(built_dex_intermediate) | $(ACP) @echo Copying: $@ $(hide) mkdir -p $(dir $@) @@ -521,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) @@ -548,3 +562,72 @@ $(findbugs_html) : $(findbugs_xml) $(LOCAL_MODULE)-findbugs : $(findbugs_html) endif # full_classes_jar is defined + +ifdef LOCAL_JACK_ENABLED +$(LOCAL_INTERMEDIATE_TARGETS): \ + PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc +ifeq ($(LOCAL_JACK_ENABLED),incremental) +$(LOCAL_INTERMEDIATE_TARGETS): \ + PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental +else +$(LOCAL_INTERMEDIATE_TARGETS): \ + PRIVATE_JACK_INCREMENTAL_DIR := +endif + +ifdef full_classes_jar +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_DEBUG_FLAGS := -g + +ifdef LOCAL_PROGUARD_ENABLED + +ifndef LOCAL_JACK_PROGUARD_FLAGS + LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS) +endif +LOCAL_JACK_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files)) +ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH + $(error $(LOCAL_MODULE): Build with jack when LOCAL_TEST_MODULE_TO_PROGUARD_WITH is defined is not yet implemented) +endif + +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS := $(common_proguard_flags) $(LOCAL_JACK_PROGUARD_FLAGS) +else # LOCAL_PROGUARD_ENABLED not defined +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_PROGUARD_FLAGS := +endif # LOCAL_PROGUARD_ENABLED defined + +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(LOCAL_JACK_FLAGS) + +jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \ + $(jar_manifest_file) $(layers_file) $(RenderScript_file_stamp) $(proguard_flag_files) \ + $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(LOCAL_JARJAR_RULES) \ + $(LOCAL_MODULE_MAKEFILE) $(JACK_JAR) + +ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true) +$(full_classes_jack): $(jack_all_deps) + @echo Building with Jack: $@ + $(java-to-jack) + +else #LOCAL_IS_STATIC_JAVA_LIBRARY +$(built_dex_intermediate): PRIVATE_CLASSES_JACK := $(full_classes_jack) + +$(built_dex_intermediate): $(jack_all_deps) + @echo Building with Jack: $@ + $(jack-java-to-dex) + +# $(full_classes_jack) is just by-product of $(built_dex_intermediate). +# The dummy command was added because, without it, make misses the fact the $(built_dex) also +# change $(full_classes_jack). +$(full_classes_jack): $(built_dex_intermediate) + $(hide) touch $@ + +endif #LOCAL_IS_STATIC_JAVA_LIBRARY + +$(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-noshrob-rsc +ifeq ($(LOCAL_JACK_ENABLED),incremental) +$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-noshrob-incremental +else +$(noshrob_classes_jack): PRIVATE_JACK_INCREMENTAL_DIR := +endif +$(noshrob_classes_jack): PRIVATE_JACK_PROGUARD_FLAGS := +$(noshrob_classes_jack): $(jack_all_deps) + @echo Building with Jack: $@ + $(java-to-jack) +endif # full_classes_jar is defined +endif # LOCAL_JACK_ENABLED diff --git a/core/java_library.mk b/core/java_library.mk index b4e3eaa..5a2d19b 100644 --- a/core/java_library.mk +++ b/core/java_library.mk @@ -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 @@ -69,8 +83,15 @@ $(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar) $(common_javalib.jar): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS) $(common_javalib.jar) : $(built_dex) $(java_resource_sources) @echo "target Jar: $(PRIVATE_MODULE) ($@)" +ifdef LOCAL_JACK_ENABLED + $(create-empty-package) +else $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@) +endif $(add-dex-to-package) +ifdef LOCAL_JACK_ENABLED + $(add-carried-jack-resources) +endif ifdef LOCAL_DEX_PREOPT ifneq ($(dexpreopt_boot_jar_module),) # boot jar diff --git a/core/main.mk b/core/main.mk index 13465e3..7350f99 100644 --- a/core/main.mk +++ b/core/main.mk @@ -914,7 +914,9 @@ ifneq ($(TARGET_BUILD_APPS),) # For uninstallable modules such as static Java library, we have to dist the built file, # as <module_name>.<suffix> apps_only_dist_built_files := $(foreach m,$(unbundled_build_modules),$(if $(ALL_MODULES.$(m).INSTALLED),,\ - $(if $(ALL_MODULES.$(m).BUILT),$(ALL_MODULES.$(m).BUILT):$(m)$(suffix $(ALL_MODULES.$(m).BUILT))))) + $(if $(ALL_MODULES.$(m).BUILT),$(ALL_MODULES.$(m).BUILT):$(m)$(suffix $(ALL_MODULES.$(m).BUILT)))\ + $(if $(ALL_MODULES.$(m).AAR),$(ALL_MODULES.$(m).AAR):$(m).aar)\ + )) $(call dist-for-goals,apps_only, $(apps_only_dist_built_files)) ifeq ($(EMMA_INSTRUMENT),true) diff --git a/core/notice_files.mk b/core/notice_files.mk index e63cd84..43a5435 100644 --- a/core/notice_files.mk +++ b/core/notice_files.mk @@ -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 := \ diff --git a/core/package_internal.mk b/core/package_internal.mk index e389b04..134445b 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -57,6 +57,10 @@ $(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS) endif LOCAL_MODULE_CLASS := APPS +################################# +include $(BUILD_SYSTEM)/configure_local_jack.mk +################################# + # Package LOCAL_MODULE_TAGS default to optional LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS)) ifeq ($(LOCAL_MODULE_TAGS),) @@ -162,6 +166,13 @@ endif # need_compile_res endif # !custom LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS) +ifdef LOCAL_JACK_ENABLED +ifndef LOCAL_JACK_PROGUARD_FLAGS + LOCAL_JACK_PROGUARD_FLAGS := $(LOCAL_PROGUARD_FLAGS) +endif +LOCAL_JACK_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_JACK_PROGUARD_FLAGS) +endif # LOCAL_JACK_ENABLED + ifeq (true,$(EMMA_INSTRUMENT)) ifndef LOCAL_EMMA_INSTRUMENT # No emma for test apks. @@ -271,6 +282,18 @@ endif # they want to use this module's R.java file. $(LOCAL_BUILT_MODULE): $(R_file_stamp) +ifdef LOCAL_JACK_ENABLED +ifneq ($(built_dex_intermediate),) +$(built_dex_intermediate): $(R_file_stamp) +endif +ifneq ($(noshrob_classes_jack),) +$(noshrob_classes_jack): $(R_file_stamp) +endif +ifneq ($(full_classes_jack),) +$(full_classes_jack): $(R_file_stamp) +endif +endif # LOCAL_JACK_ENABLED + ifneq ($(full_classes_jar),) # If full_classes_jar is non-empty, we're building sources. # If we're building sources, the initial javac step (which @@ -389,9 +412,13 @@ endif $(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS) $(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest) @echo "target Package: $(PRIVATE_MODULE) ($@)" +ifdef LOCAL_JACK_ENABLED + $(create-empty-package) +else $(if $(PRIVATE_SOURCE_ARCHIVE),\ $(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@),\ $(create-empty-package)) +endif $(add-assets-to-package) ifneq ($(jni_shared_libraries),) $(add-jni-shared-libs-to-package) @@ -399,6 +426,9 @@ endif ifneq ($(full_classes_jar),) $(add-dex-to-package) endif +ifdef LOCAL_JACK_ENABLED + $(add-carried-jack-resources) +endif $(sign-package) ifdef LOCAL_DEX_PREOPT ifneq (nostripping,$(LOCAL_DEX_PREOPT)) diff --git a/core/pathmap.mk b/core/pathmap.mk index 2532707..c4dc525 100644 --- a/core/pathmap.mk +++ b/core/pathmap.mk @@ -105,6 +105,7 @@ FRAMEWORKS_BASE_JAVA_SRC_DIRS := \ # FRAMEWORKS_SUPPORT_SUBDIRS := \ annotations \ + media/protocols \ v4 \ v7/gridlayout \ v7/appcompat \ diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index 47e21ef..59e3816 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -117,7 +117,7 @@ $(LOCAL_BUILT_MODULE) : $(my_built_shared_libraries) endif endif -# We need to enclose the above export_includes and built_shared_libraries in +# We need to enclose the above export_includes and my_built_shared_libraries in # "LOCAL_STRIP_MODULE not true" because otherwise the rules are defined in dynamic_binary.mk. endif # LOCAL_STRIP_MODULE not true @@ -300,6 +300,14 @@ $(common_javalib_jar) : $(common_classes_jar) | $(ACP) $(built_module) : $(common_javalib_jar) endif # TARGET JAVA_LIBRARIES +ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) +$(intermediates.COMMON)/classes.jack : PRIVATE_JILL_FLAGS:=$(LOCAL_JILL_FLAGS) +$(intermediates.COMMON)/classes.jack : $(my_prebuilt_src_file) $(LOCAL_MODULE_MAKEFILE) \ + $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JILL_JAR) $(JACK_JAR) + $(transform-jar-to-jack) + +endif # JAVA_LIBRARIES + $(built_module) : $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES) my_prebuilt_src_file := diff --git a/core/product.mk b/core/product.mk index d3df582..77e053f 100644 --- a/core/product.mk +++ b/core/product.mk @@ -97,10 +97,12 @@ _product_var_list := \ PRODUCT_RESTRICT_VENDOR_FILES \ PRODUCT_VENDOR_KERNEL_HEADERS \ PRODUCT_BOOT_JARS \ + PRODUCT_SUPPORTS_VBOOT \ PRODUCT_SUPPORTS_VERITY \ PRODUCT_OEM_PROPERTIES \ PRODUCT_SYSTEM_PROPERTY_BLACKLIST \ PRODUCT_SYSTEM_SERVER_JARS \ + PRODUCT_VBOOT_SIGNING_KEY \ PRODUCT_VERITY_SIGNING_KEY \ PRODUCT_SYSTEM_VERITY_PARTITION \ PRODUCT_VENDOR_VERITY_PARTITION \ diff --git a/core/static_java_library.mk b/core/static_java_library.mk index 02078e0..9b7b46a 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -56,8 +56,20 @@ intermediates.COMMON := $(call local-intermediates-dir,COMMON) ifneq ($(LOCAL_PROGUARD_ENABLED),custom) proguard_options_file := $(intermediates.COMMON)/proguard_options 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) +endif +LOCAL_JACK_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_JACK_PROGUARD_FLAGS) +endif # LOCAL_JACK_ENABLED + endif # LOCAL_RESOURCE_DIR all_res_assets := $(all_resources) @@ -92,7 +104,8 @@ endif $(R_file_stamp): PRIVATE_MODULE := $(LOCAL_MODULE) # add --non-constant-id to prevent inlining constants. -$(R_file_stamp): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --non-constant-id +# AAR needs text symbol file R.txt. +$(R_file_stamp): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --non-constant-id --output-text-symbols $(LOCAL_INTERMEDIATE_SOURCE_DIR) $(R_file_stamp): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR) $(R_file_stamp): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest) $(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := $(intermediates.COMMON)/public_resources.xml @@ -114,9 +127,32 @@ $(R_file_stamp) : $(all_resources) $(full_android_manifest) $(AAPT) $(framework_ $(hide) find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name R.java | xargs cat > $@ $(LOCAL_BUILT_MODULE): $(R_file_stamp) -ifneq ($(full_classes_jar),) +ifdef LOCAL_JACK_ENABLED +$(noshrob_classes_jack): $(R_file_stamp) +$(full_classes_jack): $(R_file_stamp) +endif # LOCAL_JACK_ENABLED $(full_classes_compiled_jar): $(R_file_stamp) -endif + +# Rule to build AAR, archive including classes.jar, resource, etc. +built_aar := $(intermediates.COMMON)/javalib.aar +$(built_aar): PRIVATE_MODULE := $(LOCAL_MODULE) +$(built_aar): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest) +$(built_aar): PRIVATE_CLASSES_JAR := $(LOCAL_BUILT_MODULE) +$(built_aar): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR) +$(built_aar): PRIVATE_R_TXT := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/R.txt +$(built_aar) : $(LOCAL_BUILT_MODULE) + @echo "target AAR: $(PRIVATE_MODULE) ($@)" + $(hide) rm -rf $(dir $@)aar && mkdir -p $(dir $@)aar/res + $(hide) cp $(PRIVATE_ANDROID_MANIFEST) $(dir $@)aar/AndroidManifest.xml + $(hide) cp $(PRIVATE_CLASSES_JAR) $(dir $@)aar/classes.jar + # Note: Use "cp -n" to honor the resource overlay rules, if multiple res dirs exist. + $(hide) $(foreach res,$(PRIVATE_RESOURCE_DIR),cp -Rfn $(res)/* $(dir $@)aar/res;) + $(hide) cp $(PRIVATE_R_TXT) $(dir $@)aar/R.txt + $(hide) jar -cMf $@ \ + -C $(dir $@)aar . + +# Register the aar file. +ALL_MODULES.$(LOCAL_MODULE).AAR := $(built_aar) endif # need_compile_res diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk index 2ce5dbc..2506766 100644 --- a/core/tasks/cts.mk +++ b/core/tasks/cts.mk @@ -21,7 +21,7 @@ JUNIT_HOST_JAR := $(HOST_OUT_JAVA_LIBRARIES)/junit.jar HOSTTESTLIB_JAR := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/tradefed-prebuilt.jar CTS_TF_JAR := $(HOST_OUT_JAVA_LIBRARIES)/cts-tradefed.jar -CTS_TF_EXEC_PATH := $(HOST_OUT_EXECUTABLES)/cts-tradefed +CTS_TF_EXEC_PATH ?= $(HOST_OUT_EXECUTABLES)/cts-tradefed CTS_TF_README_PATH := $(cts_tools_src_dir)/tradefed-host/README VMTESTSTF_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,vm-tests-tf,HOST) @@ -60,7 +60,7 @@ CTS_CORE_CASE_LIST += \ CTS_TEST_JAR_LIST := \ - cts-junit \ + cts-junit \ CtsJdwp # Depend on the full package paths rather than the phony targets to avoid @@ -69,21 +69,28 @@ CTS_CORE_CASES := $(foreach pkg,$(CTS_CORE_CASE_LIST),$(call intermediates-dir-f CTS_TEST_JAR_FILES := $(foreach c,$(CTS_TEST_JAR_LIST),$(call intermediates-dir-for,JAVA_LIBRARIES,$(c))/javalib.jar) -include cts/CtsTestCaseList.mk -CTS_CASE_LIST := $(CTS_CORE_CASE_LIST) $(CTS_TEST_CASE_LIST) # A module may have mutliple installed files (e.g. split apks) CTS_CASE_LIST_APKS := -CTS_CASE_LIST_APKS_DIR := $(cts_dir)/$(cts_name)/repository/testcases/ -$(foreach m, $(CTS_CASE_LIST),\ +$(foreach m, $(CTS_TEST_CASE_LIST),\ + $(foreach fp, $(ALL_MODULES.$(m).BUILT_INSTALLED),\ + $(eval pair := $(subst :,$(space),$(fp)))\ + $(eval CTS_CASE_LIST_APKS += $(CTS_TESTCASES_OUT)/$(notdir $(word 2,$(pair))))))\ +$(foreach m, $(CTS_CORE_CASE_LIST),\ $(foreach fp, $(ALL_MODULES.$(m).BUILT_INSTALLED),\ $(eval pair := $(subst :,$(space),$(fp)))\ $(eval built := $(word 1,$(pair)))\ - $(eval installed := $(CTS_CASE_LIST_APKS_DIR)/$(notdir $(word 2,$(pair))))\ + $(eval installed := $(CTS_TESTCASES_OUT)/$(notdir $(word 2,$(pair))))\ $(eval $(call copy-one-file, $(built), $(installed)))\ $(eval CTS_CASE_LIST_APKS += $(installed)))) +CTS_CASE_LIST_JARS := +$(foreach m, $(CTS_TEST_JAR_LIST),\ + $(eval CTS_CASE_LIST_JARS += $(CTS_TESTCASES_OUT)/$(m).jar)) + DEFAULT_TEST_PLAN := $(cts_dir)/$(cts_name)/resource/plans -$(cts_dir)/all_cts_files_stamp: $(CTS_CORE_CASES) $(CTS_TEST_CASES) $(CTS_CASE_LIST_APKS) $(JUNIT_HOST_JAR) $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(VMTESTSTF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(CTS_TF_README_PATH) $(ACP) $(CTS_TEST_JAR_FILES) +$(cts_dir)/all_cts_files_stamp: $(CTS_CORE_CASES) $(CTS_TEST_JAR_FILES) $(CTS_TEST_CASES) $(CTS_CASE_LIST_APKS) $(CTS_CASE_LIST_JARS) $(JUNIT_HOST_JAR) $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(VMTESTSTF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(CTS_TF_README_PATH) $(ADDITIONAL_TF_JARS) $(ACP) + # Make necessary directory for CTS $(hide) mkdir -p $(TMP_DIR) $(hide) mkdir -p $(PRIVATE_DIR)/docs @@ -91,11 +98,8 @@ $(cts_dir)/all_cts_files_stamp: $(CTS_CORE_CASES) $(CTS_TEST_CASES) $(CTS_CASE_L $(hide) mkdir -p $(PRIVATE_DIR)/repository/testcases $(hide) mkdir -p $(PRIVATE_DIR)/repository/plans # Copy executable and JARs to CTS directory - $(hide) $(ACP) -fp $(VMTESTSTF_JAR) $(PRIVATE_DIR)/repository/testcases - $(hide) $(ACP) -fp $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(CTS_TF_README_PATH) $(PRIVATE_DIR)/tools -# Change mode of the executables - $(foreach jar,$(CTS_TEST_JAR_LIST),$(call copy-testcase-jar,$(jar))) - $(foreach testcase,$(CTS_TEST_CASES),$(call copy-testcase,$(testcase))) + $(hide) $(ACP) -fp $(VMTESTSTF_JAR) $(CTS_TESTCASES_OUT) + $(hide) $(ACP) -fp $(HOSTTESTLIB_JAR) $(CTS_HOST_LIBRARY_JARS) $(TF_JAR) $(CTS_TF_JAR) $(CTS_TF_EXEC_PATH) $(ADDITIONAL_TF_JARS) $(CTS_TF_README_PATH) $(PRIVATE_DIR)/tools $(hide) touch $@ # Generate the test descriptions for the core-tests @@ -341,8 +345,7 @@ $(CORE_VM_TEST_TF_DESC): $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(JUNIT_HOST_JAR # Generate the default test plan for User. # Usage: buildCts.py <testRoot> <ctsOutputDir> <tempDir> <androidRootDir> <docletPath> -$(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_tools_src_dir)/utils/buildCts.py $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(CTS_CORE_XMLS) $(CTS_TEST_XMLS) $(CORE_VM_TEST_TF_DESC) | $(ACP) - $(hide) $(ACP) -fp $(CTS_CORE_XMLS) $(CTS_TEST_XMLS) $(CORE_VM_TEST_TF_DESC) $(PRIVATE_DIR)/repository/testcases +$(DEFAULT_TEST_PLAN): $(cts_dir)/all_cts_files_stamp $(cts_tools_src_dir)/utils/buildCts.py $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(CTS_CORE_XMLS) $(CTS_TEST_XMLS) $(CORE_VM_TEST_TF_DESC) $(hide) $(cts_tools_src_dir)/utils/buildCts.py cts/tests/tests/ $(PRIVATE_DIR) $(TMP_DIR) \ $(TOP) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(hide) mkdir -p $(dir $@) && touch $@ @@ -364,16 +367,3 @@ $(INTERNAL_CTS_TARGET): $(cts_dir)/all_cts_files_stamp $(DEFAULT_TEST_PLAN) cts: $(INTERNAL_CTS_TARGET) adb $(call dist-for-goals,cts,$(INTERNAL_CTS_TARGET)) - -define copy-testcase - -$(hide) $(ACP) -fp $(1) $(PRIVATE_DIR)/repository/testcases/$(notdir $1) - -endef - -define copy-testcase-jar - -$(hide) $(ACP) -fp $(call intermediates-dir-for,JAVA_LIBRARIES,$(1))/javalib.jar \ - $(PRIVATE_DIR)/repository/testcases/$(1).jar - -endef diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk index d8e8ec7..efed1e8 100644 --- a/core/tasks/vendor_module_check.mk +++ b/core/tasks/vendor_module_check.mk @@ -22,6 +22,7 @@ _vendor_owner_whitelist := \ broadcom \ csr \ elan \ + fpc \ google \ htc \ imgtec \ diff --git a/core/version_defaults.mk b/core/version_defaults.mk index d87a032..c36d690 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -41,7 +41,7 @@ ifeq "" "$(PLATFORM_VERSION)" # which is the version that we reveal to the end user. # Update this value when the platform version changes (rather # than overriding it somewhere else). Can be an arbitrary string. - PLATFORM_VERSION := 5.1 + PLATFORM_VERSION := MNC endif ifeq "" "$(PLATFORM_SDK_VERSION)" @@ -59,7 +59,7 @@ endif ifeq "" "$(PLATFORM_VERSION_CODENAME)" # This is the current development code-name, if the build is not a final # release build. If this is a final release build, it is simply "REL". - PLATFORM_VERSION_CODENAME := REL + PLATFORM_VERSION_CODENAME := MNC # This is all of the development codenames that are active. Should be either # the same as PLATFORM_VERSION_CODENAME or a comma-separated list of additional diff --git a/envsetup.sh b/envsetup.sh index f93c07d..d91b0b3 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -761,7 +761,7 @@ function mmm() MAKEFILE="$MAKEFILE $MFILE" else case $DIR in - showcommands | snod | dist | incrementaljavac) ARGS="$ARGS $DIR";; + showcommands | snod | dist | incrementaljavac | *=*) ARGS="$ARGS $DIR";; GET-INSTALL-PATH) GET_INSTALL_PATH=$DIR;; *) echo "No Android.mk in $DIR."; return 1;; esac @@ -817,7 +817,7 @@ function mmma() fi else case $DIR in - showcommands | snod | dist | incrementaljavac) ARGS="$ARGS $DIR";; + showcommands | snod | dist | incrementaljavac | *=*) ARGS="$ARGS $DIR";; *) echo "Couldn't find directory $DIR"; return 1;; esac fi @@ -1102,6 +1102,11 @@ function sepgrep() find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -name sepolicy -type d -print0 | xargs -0 grep --color -n -r --exclude-dir=\.git "$@" } +function rcgrep() +{ + find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.rc*" -print0 | xargs -0 grep --color -n "$@" +} + case `uname -s` in Darwin) function mgrep() diff --git a/target/product/base.mk b/target/product/base.mk index 85c01a2..2d72961 100644 --- a/target/product/base.mk +++ b/target/product/base.mk @@ -18,6 +18,7 @@ PRODUCT_PACKAGES += \ 20-dns.conf \ 95-configured \ + org.apache.http.legacy \ appwidget \ appops \ am \ @@ -65,6 +66,9 @@ PRODUCT_PACKAGES += \ libnetlink \ libnetutils \ libpdfium \ + libradio \ + libradioservice \ + libradio_metadata \ libreference-ril \ libreverbwrapper \ libril \ @@ -107,6 +111,7 @@ PRODUCT_PACKAGES += \ sdcard \ services \ settings \ + sgdisk \ svc \ tc \ vdc \ diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk index 33b49a6..d1e5d81 100644 --- a/target/product/core_minimal.mk +++ b/target/product/core_minimal.mk @@ -92,8 +92,8 @@ PRODUCT_BOOT_JARS := \ voip-common \ ims-common \ mms-common \ - android.policy \ apache-xml \ + org.apache.http.legacy # The order of PRODUCT_SYSTEM_SERVER_JARS matters. PRODUCT_SYSTEM_SERVER_JARS := \ diff --git a/target/product/core_tiny.mk b/target/product/core_tiny.mk index 39789d9..3547641 100644 --- a/target/product/core_tiny.mk +++ b/target/product/core_tiny.mk @@ -92,9 +92,9 @@ PRODUCT_BOOT_JARS := \ voip-common \ ims-common \ mms-common \ - android.policy \ apache-xml \ nullwebview \ + org.apache.http.legacy # The order of PRODUCT_SYSTEM_SERVER_JARS matters. PRODUCT_SYSTEM_SERVER_JARS := \ @@ -112,6 +112,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ $(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk) $(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk) +$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk) # Overrides PRODUCT_BRAND := tiny diff --git a/target/product/emulator.mk b/target/product/emulator.mk index 3a8a4aa..d9ff62e 100644 --- a/target/product/emulator.mk +++ b/target/product/emulator.mk @@ -40,11 +40,13 @@ PRODUCT_PACKAGES += \ camera.goldfish.jpeg \ lights.goldfish \ gps.goldfish \ + fingerprint.goldfish \ sensors.goldfish \ e2fsck \ audio.primary.goldfish \ vibrator.goldfish \ power.goldfish \ + fingerprint.ranchu \ sensors.ranchu diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk index dd18fab..91d856d 100644 --- a/target/product/generic_no_telephony.mk +++ b/target/product/generic_no_telephony.mk @@ -63,6 +63,7 @@ $(call inherit-product-if-exists, external/google-fonts/cutive-mono/fonts.mk) $(call inherit-product-if-exists, external/lohit-fonts/fonts.mk) $(call inherit-product-if-exists, external/noto-fonts/fonts.mk) $(call inherit-product-if-exists, external/naver-fonts/fonts.mk) +$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk) $(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk) $(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk) diff --git a/target/product/sdk_base.mk b/target/product/sdk_base.mk index 451c0b7..0fa6e08 100644 --- a/target/product/sdk_base.mk +++ b/target/product/sdk_base.mk @@ -83,6 +83,7 @@ $(call inherit-product-if-exists, external/google-fonts/coming-soon/fonts.mk) $(call inherit-product-if-exists, external/google-fonts/cutive-mono/fonts.mk) $(call inherit-product-if-exists, external/noto-fonts/fonts.mk) $(call inherit-product-if-exists, external/naver-fonts/fonts.mk) +$(call inherit-product-if-exists, external/roboto-fonts/fonts.mk) $(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk) $(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk) diff --git a/target/product/telephony.mk b/target/product/telephony.mk index da1497d..6852084 100644 --- a/target/product/telephony.mk +++ b/target/product/telephony.mk @@ -19,6 +19,7 @@ PRODUCT_PACKAGES := \ Dialer \ + CallLogBackup \ Mms \ rild diff --git a/target/product/vboot.mk b/target/product/vboot.mk new file mode 100644 index 0000000..e4b1144 --- /dev/null +++ b/target/product/vboot.mk @@ -0,0 +1,24 @@ +# +# Copyright (C) 2015 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. +# + +# Provides dependencies necessary for verified boot + +PRODUCT_SUPPORTS_VBOOT := true + +# The dev key is used to sign boot and recovery images. +# We expect this file to exist with the suffixes ".vbprivk" and ".vbpupk". +# TODO: find a proper location for this +PRODUCT_VBOOT_SIGNING_KEY := external/vboot_reference/tests/devkeys/kernel_data_key diff --git a/tools/droiddoc/templates-pdk/assets/images/android_logo.png b/tools/droiddoc/templates-pdk/assets/images/android_logo.png Binary files differnew file mode 100644 index 0000000..4040f3f --- /dev/null +++ b/tools/droiddoc/templates-pdk/assets/images/android_logo.png diff --git a/tools/droiddoc/templates-pdk/components/masthead.cs b/tools/droiddoc/templates-pdk/components/masthead.cs index 05437f3..874c11c 100644 --- a/tools/droiddoc/templates-pdk/components/masthead.cs +++ b/tools/droiddoc/templates-pdk/components/masthead.cs @@ -1,10 +1,9 @@ -<?cs +<?cs def:custom_masthead() ?> <div id="header"> <div id="headerLeft"> <a href="<?cs var:toroot ?>guide/index.html"><img - src="<?cs var:toroot ?>assets/images/android-partner-logo.png" alt="Android Platform Development Kit" /></a> - + src="<?cs var:toroot ?>assets/images/android_logo.png" alt="Android Platform Development Kit" /></a> </div> <div id="headerRight"> <div id="headerLinks"> diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py index f031078..5b5c4cc 100644 --- a/tools/releasetools/blockimgdiff.py +++ b/tools/releasetools/blockimgdiff.py @@ -193,14 +193,14 @@ class Transfer(object): # original image. class BlockImageDiff(object): - def __init__(self, tgt, src=None, threads=None, version=2): + def __init__(self, tgt, src=None, threads=None, version=3): if threads is None: threads = multiprocessing.cpu_count() // 2 if threads == 0: threads = 1 self.threads = threads self.version = version - assert version in (1, 2) + assert version in (1, 2, 3) self.tgt = tgt if src is None: @@ -247,6 +247,15 @@ class BlockImageDiff(object): self.ComputePatches(prefix) self.WriteTransfers(prefix) + def HashBlocks(self, source, ranges): + data = source.ReadRangeSet(ranges) + ctx = sha1() + + for p in data: + ctx.update(p) + + return ctx.hexdigest() + def WriteTransfers(self, prefix): out = [] @@ -275,7 +284,15 @@ class BlockImageDiff(object): next_stash_id += 1 stashes[s] = sid stashed_blocks += sr.size() - out.append("stash %d %s\n" % (sid, sr.to_string_raw())) + if self.version == 2: + out.append("stash %d %s\n" % (sid, sr.to_string_raw())) + else: + sh = self.HashBlocks(self.src, sr) + if sh in stashes: + stashes[sh] += 1 + else: + stashes[sh] = 1 + out.append("stash %s %s\n" % (sh, sr.to_string_raw())) if stashed_blocks > max_stashed_blocks: max_stashed_blocks = stashed_blocks @@ -284,7 +301,7 @@ class BlockImageDiff(object): if self.version == 1: src_string = xf.src_ranges.to_string_raw() - elif self.version == 2: + elif self.version >= 2: # <# blocks> <src ranges> # OR @@ -301,9 +318,18 @@ class BlockImageDiff(object): sid = stashes.pop(s) stashed_blocks -= sr.size() unstashed_src_ranges = unstashed_src_ranges.subtract(sr) + sh = self.HashBlocks(self.src, sr) sr = xf.src_ranges.map_within(sr) mapped_stashes.append(sr) - src_string.append("%d:%s" % (sid, sr.to_string_raw())) + if self.version == 2: + src_string.append("%d:%s" % (sid, sr.to_string_raw())) + else: + assert sh in stashes + src_string.append("%s:%s" % (sh, sr.to_string_raw())) + stashes[sh] -= 1 + if stashes[sh] == 0: + free_string.append("free %s\n" % (sh)) + stashes.pop(sh) heapq.heappush(free_stash_ids, sid) if unstashed_src_ranges: @@ -319,7 +345,7 @@ class BlockImageDiff(object): src_string = " ".join(src_string) - # both versions: + # all versions: # zero <rangeset> # new <rangeset> # erase <rangeset> @@ -333,6 +359,11 @@ class BlockImageDiff(object): # bsdiff patchstart patchlen <tgt rangeset> <src_string> # imgdiff patchstart patchlen <tgt rangeset> <src_string> # move <tgt rangeset> <src_string> + # + # version 3: + # bsdiff patchstart patchlen srchash tgthash <tgt rangeset> <src_string> + # imgdiff patchstart patchlen srchash tgthash <tgt rangeset> <src_string> + # move hash <tgt rangeset> <src_string> tgt_size = xf.tgt_ranges.size() @@ -353,6 +384,11 @@ class BlockImageDiff(object): out.append("%s %s %s\n" % ( xf.style, xf.tgt_ranges.to_string_raw(), src_string)) + elif self.version >= 3: + out.append("%s %s %s %s\n" % ( + xf.style, + self.HashBlocks(self.tgt, xf.tgt_ranges), + xf.tgt_ranges.to_string_raw(), src_string)) total += tgt_size elif xf.style in ("bsdiff", "imgdiff"): performs_read = True @@ -366,6 +402,13 @@ class BlockImageDiff(object): out.append("%s %d %d %s %s\n" % ( xf.style, xf.patch_start, xf.patch_len, xf.tgt_ranges.to_string_raw(), src_string)) + elif self.version >= 3: + out.append("%s %d %d %s %s %s %s\n" % ( + xf.style, + xf.patch_start, xf.patch_len, + self.HashBlocks(self.src, xf.src_ranges), + self.HashBlocks(self.tgt, xf.tgt_ranges), + xf.tgt_ranges.to_string_raw(), src_string)) total += tgt_size elif xf.style == "zero": assert xf.tgt_ranges @@ -376,6 +419,9 @@ class BlockImageDiff(object): else: raise ValueError, "unknown transfer style '%s'\n" % (xf.style,) + if free_string: + out.append("".join(free_string)) + # sanity check: abort if we're going to need more than 512 MB if # stash space diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 6903dc6..0c0da77 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -56,6 +56,7 @@ OPTIONS.java_path = "java" # Use the one on the path by default. OPTIONS.java_args = "-Xmx2048m" # JVM Args OPTIONS.public_key_suffix = ".x509.pem" OPTIONS.private_key_suffix = ".pk8" +OPTIONS.boot_signer_path = "boot_signer" # use otatools built boot_signer by default OPTIONS.verbose = False OPTIONS.tempfiles = [] OPTIONS.device_specific = None @@ -347,7 +348,7 @@ def BuildBootableImage(sourcedir, fs_config_file, info_dict=None): if info_dict.get("verity_key", None): path = "/" + os.path.basename(sourcedir).lower() - cmd = ["boot_signer", path, img.name, info_dict["verity_key"] + ".pk8", info_dict["verity_key"] + ".x509.pem", img.name] + cmd = [OPTIONS.boot_signer_path, path, img.name, info_dict["verity_key"] + ".pk8", info_dict["verity_key"] + ".x509.pem", img.name] p = Run(cmd, stdout=subprocess.PIPE) p.communicate() assert p.returncode == 0, "boot_signer of %s image failed" % path @@ -620,7 +621,8 @@ def ParseOptions(argv, argv, "hvp:s:x:" + extra_opts, ["help", "verbose", "path=", "signapk_path=", "extra_signapk_args=", "java_path=", "java_args=", "public_key_suffix=", - "private_key_suffix=", "device_specific=", "extra="] + + "private_key_suffix=", "boot_signer_path=", "device_specific=", + "extra="] + list(extra_long_opts)) except getopt.GetoptError, err: Usage(docstring) @@ -649,6 +651,8 @@ def ParseOptions(argv, OPTIONS.public_key_suffix = a elif o in ("--private_key_suffix",): OPTIONS.private_key_suffix = a + elif o in ("--boot_signer_path",): + OPTIONS.boot_signer_path = a elif o in ("-s", "--device_specific"): OPTIONS.device_specific = a elif o in ("-x", "--extra"): |