1#
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# This package provides the 'glue' layer between Chromium and WebView.
18
19LOCAL_PATH := $(call my-dir)
20CHROMIUM_PATH := external/chromium_org
21
22ifeq (,$(wildcard $(CHROMIUM_PATH)))
23# Some branches don't have the chromium sources; they shouldn't depend on
24# webview, but just in case this is a mistake, warn about it.
25$(warning Chromium sources missing, skipping webview package build)
26else
27# Chromium sources exist, build the package.
28
29# Java glue layer JAR, calls directly into the chromium AwContents Java API.
30include $(CLEAR_VARS)
31
32LOCAL_PACKAGE_NAME := webview
33
34LOCAL_MANIFEST_FILE := AndroidManifest.xml
35
36LOCAL_MODULE_TAGS := optional
37
38LOCAL_SDK_VERSION := system_current
39
40LOCAL_STATIC_JAVA_LIBRARIES += android_webview_java_with_new_resources
41
42LOCAL_SRC_FILES := $(call all-java-files-under, java)
43LOCAL_SRC_FILES += $(extra_java_files)
44
45LOCAL_JARJAR_RULES := $(CHROMIUM_PATH)/android_webview/build/jarjar-rules.txt
46
47include $(CHROMIUM_PATH)/android_webview/build/resources_config.mk
48LOCAL_RESOURCE_DIR := \
49    $(res_overrides) \
50    $(LOCAL_PATH)/res \
51    $(android_webview_resources_dirs)
52
53LOCAL_AAPT_FLAGS := $(android_webview_aapt_flags)
54LOCAL_AAPT_FLAGS += --extra-packages com.android.webview.chromium
55LOCAL_AAPT_FLAGS += --shared-lib
56
57include $(LOCAL_PATH)/version.mk
58LOCAL_AAPT_FLAGS += --version-code "$(version_code)" --version-name "$(version_name)"
59
60LOCAL_JNI_SHARED_LIBRARIES += libwebviewchromium
61
62LOCAL_MULTILIB := both
63
64# See Bug 17409149.
65LOCAL_DEX_PREOPT := false
66
67# TODO: filter webviewchromium_webkit_strings based on PRODUCT_LOCALES.
68LOCAL_REQUIRED_MODULES := \
69        libwebviewchromium \
70        libwebviewchromium_loader \
71        libwebviewchromium_plat_support
72
73LOCAL_PROGUARD_ENABLED := full
74LOCAL_PROGUARD_FLAG_FILES := proguard.flags
75
76LOCAL_JAVACFLAGS := -Xlint:unchecked -Werror
77
78include $(BUILD_PACKAGE)
79
80$(LOCAL_BUILT_MODULE): $(android_webview_intermediates_pak_additional_deps)
81$(LOCAL_BUILT_MODULE): PRIVATE_ASSET_DIR += $(android_webview_asset_dirs)
82# This is needed to force the grd->string.xml conversion to run before we
83# attempt to generate the R.java file.
84$(R_file_stamp): $(call intermediates-dir-for,GYP,android_webview_resources)/android_webview_resources.stamp
85
86ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
87# Add build rules to check that the jarjar'ed jar only contains whitelisted
88# packages. Only enable this when we are running jarjar.
89LOCAL_JAR_CHECK_WHITELIST := $(LOCAL_PATH)/jar_package_whitelist.txt
90
91jar_check_ok := $(intermediates.COMMON)/jar_check_ok
92$(jar_check_ok): PRIVATE_JAR_CHECK := $(LOCAL_PATH)/tools/jar_check.py
93$(jar_check_ok): PRIVATE_JAR_CHECK_WHITELIST := $(LOCAL_JAR_CHECK_WHITELIST)
94$(jar_check_ok): $(full_classes_jarjar_jar) $(LOCAL_PATH)/tools/jar_check.py $(LOCAL_JAR_CHECK_WHITELIST)
95	@echo Jar check: $@
96	$(hide) $(PRIVATE_JAR_CHECK) $< $(PRIVATE_JAR_CHECK_WHITELIST)
97	$(hide) touch $@
98
99$(LOCAL_BUILT_MODULE): $(jar_check_ok)
100endif
101
102endif  # CHROMIUM_PATH existence test
103