boot_jars_package_check.mk revision 46526ff69ea3e1a2a7ea11667924dcf942060ba1
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 whitelisted 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
25built_boot_jars := $(foreach j, $(PRODUCT_BOOT_JARS), \
26  $(call intermediates-dir-for, JAVA_LIBRARIES, $(j),,COMMON)/classes.jar)
27script := build/core/tasks/check_boot_jars/check_boot_jars.py
28whitelist_file := build/core/tasks/check_boot_jars/package_whitelist.txt
29
30$(stamp): PRIVATE_BOOT_JARS := $(built_boot_jars)
31$(stamp): PRIVATE_SCRIPT := $(script)
32$(stamp): PRIVATE_WHITELIST := $(whitelist_file)
33$(stamp) : $(built_boot_jars) $(script) $(whitelist_file)
34	@echo "Check package name for $(PRIVATE_BOOT_JARS)"
35	$(hide) $(PRIVATE_SCRIPT) $(PRIVATE_WHITELIST) $(PRIVATE_BOOT_JARS)
36	$(hide) mkdir -p $(dir $@) && touch $@
37
38.PHONY: check-boot-jars
39check-boot-jars : $(stamp)
40
41# Run check-boot-jars by default
42droidcore : check-boot-jars
43
44endif  # PRODUCT_BOOT_JARS
45endif  # TARGET_BUILD_PDK not true
46endif  # SKIP_BOOT_JARS_CHECK not true
47