Index: android_webview/glue/BUILD.gn |
diff --git a/android_webview/glue/BUILD.gn b/android_webview/glue/BUILD.gn |
index 59302f7783514bd882f205b2df158cc97555046e..ac732bd6f7cab47cbfd2b9cc2357e09825030e27 100644 |
--- a/android_webview/glue/BUILD.gn |
+++ b/android_webview/glue/BUILD.gn |
@@ -7,12 +7,29 @@ import("//build/config/android/rules.gni") |
import("generate_resource_rewriter.gni") |
import("glue.gni") |
-webview_framework_ijar = |
- "$root_out_dir/lib.java/webview/frameworks.interface.jar" |
+# There are two copies of this file: one upstream and one downstream, |
+# all targets defined in this file will finally generate two targets. |
+# is_upstream could be used to differentiate those two targets, see |
+# 'glue' target for details. |
+is_upstream = rebase_path(".", "//android_webview/glue") == "." |
-generate_interface_jar("framework_ijar") { |
- input_jar = webview_framework_jar |
- output_jar = webview_framework_ijar |
+webview_framework_ijar = "frameworks.interface.jar" |
+webview_public_framework_ijar = "frameworks.public.interface.jar" |
+ |
+# Mark webview_framework_ijar is used, otherwise it isn't used if there |
+# is no internal code. |
+assert(webview_framework_ijar != "") |
+ |
+if (defined(webview_internal_framework_jar)) { |
+ generate_interface_jar("framework_ijar") { |
+ input_jar = webview_internal_framework_jar |
+ output_jar = "$target_out_dir/$webview_framework_ijar" |
+ } |
+} |
+ |
+generate_interface_jar("public_framework_ijar") { |
+ input_jar = webview_public_framework_jar |
+ output_jar = "$target_out_dir/$webview_public_framework_ijar" |
} |
generate_resource_rewriter("glue_resource_rewriter") { |
@@ -21,35 +38,41 @@ generate_resource_rewriter("glue_resource_rewriter") { |
package_name = "com.android.webview.chromium" |
} |
-if (!defined(use_webview_internal_framework) || |
- !use_webview_internal_framework) { |
- android_library("glue") { |
- # Change deps? please modify glue_library_deps variable. |
- deps = glue_library_deps |
- srcjar_deps = [ ":glue_resource_rewriter" ] |
- |
- alternative_android_sdk_ijar = webview_framework_ijar |
- alternative_android_sdk_ijar_dep = "//android_webview/glue:framework_ijar" |
- |
- java_files = [ |
- "java/src/com/android/webview/chromium/ContentSettingsAdapter.java", |
- "java/src/com/android/webview/chromium/CookieManagerAdapter.java", |
- "java/src/com/android/webview/chromium/DrawGLFunctor.java", |
- "java/src/com/android/webview/chromium/GeolocationPermissionsAdapter.java", |
- "java/src/com/android/webview/chromium/GraphicsUtils.java", |
- "java/src/com/android/webview/chromium/LicenseActivity.java", |
- "java/src/com/android/webview/chromium/LicenseContentProvider.java", |
- "java/src/com/android/webview/chromium/ResourcesContextWrapperFactory.java", |
- "java/src/com/android/webview/chromium/WebBackForwardListChromium.java", |
- "java/src/com/android/webview/chromium/WebHistoryItemChromium.java", |
- "java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java", |
- "java/src/com/android/webview/chromium/WebMessagePortAdapter.java", |
- "java/src/com/android/webview/chromium/WebStorageAdapter.java", |
- "java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java", |
- "java/src/com/android/webview/chromium/WebViewChromium.java", |
- "java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java", |
- "java/src/com/android/webview/chromium/WebViewDatabaseAdapter.java", |
- "java/src/com/android/webview/chromium/WebViewDelegateFactory.java", |
- ] |
+android_library("glue") { |
+ # Change deps? please modify glue_library_deps variable. |
+ deps = glue_library_deps |
+ srcjar_deps = [ ":glue_resource_rewriter" ] |
+ |
+ # Always build upstream or downstream target with public or internal |
+ # framework jar respectively. |
+ if (is_upstream) { |
+ alternative_android_sdk_ijar_dep = ":public_framework_ijar" |
+ _ijar = webview_public_framework_ijar |
+ } else { |
+ assert(defined(webview_internal_framework_jar)) |
+ alternative_android_sdk_ijar_dep = ":framework_ijar" |
+ _ijar = webview_framework_ijar |
} |
+ _ijar_dir = get_label_info(alternative_android_sdk_ijar_dep, "target_out_dir") |
+ alternative_android_sdk_ijar = "$_ijar_dir/$_ijar" |
+ java_files = [ |
+ "java/src/com/android/webview/chromium/ContentSettingsAdapter.java", |
+ "java/src/com/android/webview/chromium/CookieManagerAdapter.java", |
+ "java/src/com/android/webview/chromium/DrawGLFunctor.java", |
+ "java/src/com/android/webview/chromium/GeolocationPermissionsAdapter.java", |
+ "java/src/com/android/webview/chromium/GraphicsUtils.java", |
+ "java/src/com/android/webview/chromium/LicenseActivity.java", |
+ "java/src/com/android/webview/chromium/LicenseContentProvider.java", |
+ "java/src/com/android/webview/chromium/ResourcesContextWrapperFactory.java", |
+ "java/src/com/android/webview/chromium/WebBackForwardListChromium.java", |
+ "java/src/com/android/webview/chromium/WebHistoryItemChromium.java", |
+ "java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java", |
+ "java/src/com/android/webview/chromium/WebMessagePortAdapter.java", |
+ "java/src/com/android/webview/chromium/WebStorageAdapter.java", |
+ "java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java", |
+ "java/src/com/android/webview/chromium/WebViewChromium.java", |
+ "java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java", |
+ "java/src/com/android/webview/chromium/WebViewDatabaseAdapter.java", |
+ "java/src/com/android/webview/chromium/WebViewDelegateFactory.java", |
+ ] |
} |