1# Copyright (C) 2014 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# 16# Rules to check if classes in the boot jars are from the list of allowed packages. 17# 18 19ifneq ($(SKIP_BOOT_JARS_CHECK),true) 20ifneq ($(TARGET_BUILD_PDK),true) 21ifdef PRODUCT_BOOT_JARS 22 23intermediates := $(call intermediates-dir-for, PACKAGING, boot-jars-package-check,,COMMON) 24stamp := $(intermediates)/stamp 25 26# The actual names for the updatable jars are <jar_name>.<apex_name> e.g., updatable-media.com.android.media 27updatable_boot_jars := $(foreach pair,$(PRODUCT_UPDATABLE_BOOT_JARS),\ 28 $(eval apex := $(call word-colon,1,$(pair)))\ 29 $(eval jar := $(call word-colon,2,$(pair)))\ 30 $(jar).$(apex)\ 31) 32#TODO(jiyong) merge art_boot_jars into updatable_boot_jars 33art_boot_jars := $(addsuffix .com.android.art.release,$(filter $(ART_APEX_JARS),$(PRODUCT_BOOT_JARS))) 34 35platform_boot_jars := $(filter-out $(ART_APEX_JARS),$(PRODUCT_BOOT_JARS)) 36 37built_boot_jars := $(foreach j, $(updatable_boot_jars) $(art_boot_jars) $(platform_boot_jars), \ 38 $(call intermediates-dir-for, JAVA_LIBRARIES, $(j),,COMMON)/classes.jar) 39script := build/make/core/tasks/check_boot_jars/check_boot_jars.py 40allowed_file := build/make/core/tasks/check_boot_jars/package_allowed_list.txt 41 42$(stamp): PRIVATE_BOOT_JARS := $(built_boot_jars) 43$(stamp): PRIVATE_SCRIPT := $(script) 44$(stamp): PRIVATE_ALLOWED := $(allowed_file) 45$(stamp) : $(built_boot_jars) $(script) $(allowed_file) 46 @echo "Check package name for $(PRIVATE_BOOT_JARS)" 47 $(hide) $(PRIVATE_SCRIPT) $(PRIVATE_ALLOWED) $(PRIVATE_BOOT_JARS) 48 $(hide) mkdir -p $(dir $@) && touch $@ 49 50.PHONY: check-boot-jars 51check-boot-jars : $(stamp) 52 53# Run check-boot-jars by default 54droidcore : check-boot-jars 55 56endif # PRODUCT_BOOT_JARS 57endif # TARGET_BUILD_PDK not true 58endif # SKIP_BOOT_JARS_CHECK not true 59