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_STATIC_JAVA_LIBRARIES += android_webview_java_with_new_resources 39 40LOCAL_SRC_FILES := $(call all-java-files-under, java) 41LOCAL_SRC_FILES += $(extra_java_files) 42 43LOCAL_JARJAR_RULES := $(CHROMIUM_PATH)/android_webview/build/jarjar-rules.txt 44 45include $(CHROMIUM_PATH)/android_webview/build/resources_config.mk 46LOCAL_RESOURCE_DIR := \ 47 $(res_overrides) \ 48 $(LOCAL_PATH)/res \ 49 $(android_webview_resources_dirs) 50 51LOCAL_AAPT_FLAGS := $(android_webview_aapt_flags) 52LOCAL_AAPT_FLAGS += --extra-packages com.android.webview.chromium 53LOCAL_AAPT_FLAGS += --shared-lib 54 55include $(LOCAL_PATH)/version.mk 56LOCAL_AAPT_FLAGS += --version-code "$(version_code)" --version-name "$(version_name)" 57 58LOCAL_JNI_SHARED_LIBRARIES += libwebviewchromium 59 60LOCAL_MULTILIB := both 61 62# TODO: filter webviewchromium_webkit_strings based on PRODUCT_LOCALES. 63LOCAL_REQUIRED_MODULES := \ 64 libwebviewchromium \ 65 libwebviewchromium_loader \ 66 libwebviewchromium_plat_support 67 68LOCAL_PROGUARD_ENABLED := full 69LOCAL_PROGUARD_FLAG_FILES := proguard.flags 70 71LOCAL_JAVACFLAGS := -Xlint:unchecked -Werror 72 73include $(BUILD_PACKAGE) 74 75$(LOCAL_BUILT_MODULE): $(android_webview_intermediates_pak_additional_deps) 76$(LOCAL_BUILT_MODULE): PRIVATE_ASSET_DIR += $(android_webview_asset_dirs) 77# This is needed to force the grd->string.xml conversion to run before we 78# attempt to generate the R.java file. 79$(R_file_stamp): $(call intermediates-dir-for,GYP,android_webview_resources)/android_webview_resources.stamp 80 81ifneq ($(strip $(LOCAL_JARJAR_RULES)),) 82# Add build rules to check that the jarjar'ed jar only contains whitelisted 83# packages. Only enable this when we are running jarjar. 84LOCAL_JAR_CHECK_WHITELIST := $(LOCAL_PATH)/jar_package_whitelist.txt 85 86jar_check_ok := $(intermediates.COMMON)/jar_check_ok 87$(jar_check_ok): PRIVATE_JAR_CHECK := $(LOCAL_PATH)/tools/jar_check.py 88$(jar_check_ok): PRIVATE_JAR_CHECK_WHITELIST := $(LOCAL_JAR_CHECK_WHITELIST) 89$(jar_check_ok): $(full_classes_jarjar_jar) $(LOCAL_PATH)/tools/jar_check.py $(LOCAL_JAR_CHECK_WHITELIST) 90 @echo Jar check: $@ 91 $(hide) $(PRIVATE_JAR_CHECK) $< $(PRIVATE_JAR_CHECK_WHITELIST) 92 $(hide) touch $@ 93 94$(LOCAL_BUILT_MODULE): $(jar_check_ok) 95endif 96 97endif # CHROMIUM_PATH existence test 98