Skip to content

Commit

Permalink
[Cronet] Build cronet_impl_native_java.jar from undesugared jars
Browse files Browse the repository at this point in the history
Prior to this change cronet_impl_native_java.jar was desugared but
did not include the desugar runtime library and was missing classes.
Rather than include the desugar runtime library, it's preferable to
build Java 8 jar files as that allows consumers to desugar only what
they need (e.g., not desugar try-with-resources if the consumer's
app's min-sdk-version is >= 19).
Note that this requires using either Android Studio 3.0 (currently beta)
or Bazel, which both support desugaring.

Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester
Change-Id: I68c0bc75bd11f32bf3d9e14f0a9880aa3afbf1d0
Reviewed-on: https://chromium-review.googlesource.com/620987
Reviewed-by: Helen Li <xunjieli@chromium.org>
Commit-Queue: Paul Jensen <pauljensen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#495655}
  • Loading branch information
JensenPaul authored and Commit Bot committed Aug 18, 2017
1 parent dc8cacd commit 397ea05
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions components/cronet/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,9 @@ instrumentation_test_apk(
apk_under_test = ":cronet_smoketests_platform_only_apk"
android_manifest = "test/javatests/AndroidManifest.xml"
deps = [
":cronet_smoketests_platform_only_java",
"//base:base_java_test_support",
"//third_party/android_support_test_runner:runner_java",
":cronet_smoketests_platform_only_java",
]

proguard_enabled = true
Expand Down Expand Up @@ -935,18 +935,24 @@ action("extract_cronet_jars") {
script = "//components/cronet/tools/extract_from_jars.py"
depfile = "$target_gen_dir/$target_name.d"

sources = [
"$root_out_dir/lib.java/base/base_java.jar",
"$root_out_dir/lib.java/components/cronet/android/cronet_impl_native_java.jar",
"$root_out_dir/lib.java/net/android/net_java.jar",
"$root_out_dir/lib.java/url/url_java.jar",
]

_stamp_file = "$target_gen_dir/$target_name.stamp"
outputs = [
_stamp_file,
]

deps = [
":cronet_impl_native_java",
"//base:base_java",
"//net/android:net_java",
"//url:url_java",
]

sources = []
foreach(dep, deps) {
sources += [ get_label_info(dep, "target_gen_dir") + "/" +
get_label_info(dep, "name") + "__compile_java.javac.jar" ]
}

_rebased_sources = rebase_path(sources, root_build_dir)

args = [
Expand All @@ -958,13 +964,6 @@ action("extract_cronet_jars") {
"--stamp",
rebase_path(_stamp_file, root_build_dir),
]

deps = [
":cronet_impl_native_java",
"//base:base_java",
"//net/android:net_java",
"//url:url_java",
]
}

action("repackage_extracted_jars") {
Expand Down

0 comments on commit 397ea05

Please sign in to comment.