Home | History | Annotate | Download | only in chromium
      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 
     19 LOCAL_PATH := $(call my-dir)
     20 CHROMIUM_PATH := external/chromium_org
     21 
     22 ifeq (,$(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)
     26 else
     27 # Chromium sources exist, build the package.
     28 
     29 # Java glue layer JAR, calls directly into the chromium AwContents Java API.
     30 include $(CLEAR_VARS)
     31 
     32 LOCAL_PACKAGE_NAME := webview
     33 
     34 LOCAL_MANIFEST_FILE := AndroidManifest.xml
     35 
     36 LOCAL_MODULE_TAGS := optional
     37 
     38 LOCAL_SDK_VERSION := system_current
     39 
     40 LOCAL_STATIC_JAVA_LIBRARIES += android_webview_java_with_new_resources
     41 
     42 LOCAL_SRC_FILES := $(call all-java-files-under, java)
     43 LOCAL_SRC_FILES += $(extra_java_files)
     44 
     45 LOCAL_JARJAR_RULES := $(CHROMIUM_PATH)/android_webview/build/jarjar-rules.txt
     46 
     47 include $(CHROMIUM_PATH)/android_webview/build/resources_config.mk
     48 LOCAL_RESOURCE_DIR := \
     49     $(res_overrides) \
     50     $(LOCAL_PATH)/res \
     51     $(android_webview_resources_dirs)
     52 
     53 LOCAL_AAPT_FLAGS := $(android_webview_aapt_flags)
     54 LOCAL_AAPT_FLAGS += --extra-packages com.android.webview.chromium
     55 LOCAL_AAPT_FLAGS += --shared-lib
     56 
     57 include $(LOCAL_PATH)/version.mk
     58 LOCAL_AAPT_FLAGS += --version-code "$(version_code)" --version-name "$(version_name)"
     59 
     60 LOCAL_JNI_SHARED_LIBRARIES += libwebviewchromium
     61 
     62 LOCAL_MULTILIB := both
     63 
     64 # See Bug 17409149.
     65 LOCAL_DEX_PREOPT := false
     66 
     67 # TODO: filter webviewchromium_webkit_strings based on PRODUCT_LOCALES.
     68 LOCAL_REQUIRED_MODULES := \
     69         libwebviewchromium \
     70         libwebviewchromium_loader \
     71         libwebviewchromium_plat_support
     72 
     73 LOCAL_PROGUARD_ENABLED := full
     74 LOCAL_PROGUARD_FLAG_FILES := proguard.flags
     75 
     76 LOCAL_JAVACFLAGS := -Xlint:unchecked -Werror
     77 
     78 include $(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 
     86 ifneq ($(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.
     89 LOCAL_JAR_CHECK_WHITELIST := $(LOCAL_PATH)/jar_package_whitelist.txt
     90 
     91 jar_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)
    100 endif
    101 
    102 endif  # CHROMIUM_PATH existence test
    103