Commit b467849d authored by Anna Malova's avatar Anna Malova Committed by Commit Bot

Revert "Reland "Android: Increase default_min_sdk_version 19 -> 21""

This reverts commit 93dfa799.

Reason for revert: The CL causes failures on android-cronet-arm64-dbg and Android arm64 Builder (dbg). 
https://ci.chromium.org/p/chromium/builders/ci/android-cronet-arm64-dbg/59030

https://ci.chromium.org/p/chromium/builders/ci/Android%20arm64%20Builder%20%28dbg%29/42461

The error message is "Error: Cannot fit requested classes in a single dex file (# methods: 76373 > 65536). Try supplying a main-dex list."

Original change's description:
> Reland "Android: Increase default_min_sdk_version 19 -> 21"
> 
> This reverts commit a71864a7.
> 
> Reason for revert:
>  * Added min_sdk_version to cronet targets
>  * Made dex.py not package incremental dex in cronet's test apks
> 
> Original change's description:
> > Revert "Android: Increase default_min_sdk_version 19 -> 21"
> >
> > This reverts commit ce14e58b.
> >
> > Reason for revert: The CL causes failures on Cronet KitKat builders https://ci.chromium.org/p/chromium/builders/ci/android-cronet-kitkat-arm-rel
> >
> > The error code is INSTALL_FAILED_OLDER_SDK
> > https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8878029920810653312/+/steps/cronet_smoketests_missing_native_library_instrumentation_apk_on_Android_device_Nexus_5/0/stdout
> >
> > Original change's description:
> > > Android: Increase default_min_sdk_version 19 -> 21
> > >
> > > Cronet is the only project that requires a lower minSdkVersion. To
> > > continue supporting building of their targets, this change enabled
> > > proguard on all of their apks in order to have all files desugared at
> > > the proper minApiVersion.
> > >
> > > This change should speed up compiles somewhat, as it removes the need to
> > > generate main-dex-lists for legacy multidex purposes.
> > >
> > > Bug: 1091919
> > > Change-Id: Ifd8089bbf4965b55a13dea11464ccda979fd5028
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2233581
> > > Reviewed-by: Peter Wen <wnwen@chromium.org>
> > > Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> > > Cr-Commit-Position: refs/heads/master@{#776166}
> >
> > TBR=wnwen@chromium.org,agrieve@chromium.org
> >
> > Change-Id: Id4b92d5549d13de9684f542ce646993c3833795f
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: 1091919
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2236715
> > Reviewed-by: Pavel Yatsuk <pavely@chromium.org>
> > Commit-Queue: Pavel Yatsuk <pavely@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#776237}
> 
> Bug: 1091919
> Change-Id: Ie2dc5d64739a3f57c36f3380502d290129d634f2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2235737
> Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> Reviewed-by: Peter Wen <wnwen@chromium.org>
> Reviewed-by: Paul Jensen <pauljensen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#776952}

TBR=wnwen@chromium.org,pauljensen@chromium.org,agrieve@chromium.org

Change-Id: I679cb9f9e6f8fe8ca69ef1f4061e96c9f17063d7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1091919
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2237935Reviewed-by: default avatarAnna Malova <amalova@chromium.org>
Commit-Queue: Anna Malova <amalova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777039}
parent 14190177
...@@ -62,9 +62,6 @@ def _ParseArgs(args): ...@@ -62,9 +62,6 @@ def _ParseArgs(args):
'--multi-dex', '--multi-dex',
action='store_true', action='store_true',
help='Allow multiple dex files within output.') help='Allow multiple dex files within output.')
parser.add_argument('--library',
action='store_true',
help='Allow numerous dex files within output.')
parser.add_argument('--r8-jar-path', required=True, help='Path to R8 jar.') parser.add_argument('--r8-jar-path', required=True, help='Path to R8 jar.')
parser.add_argument('--desugar', action='store_true') parser.add_argument('--desugar', action='store_true')
parser.add_argument( parser.add_argument(
...@@ -337,15 +334,13 @@ def _PerformDexlayout(tmp_dir, tmp_dex_output, options): ...@@ -337,15 +334,13 @@ def _PerformDexlayout(tmp_dir, tmp_dex_output, options):
def _CreateFinalDex(d8_inputs, output, tmp_dir, dex_cmd, options=None): def _CreateFinalDex(d8_inputs, output, tmp_dir, dex_cmd, options=None):
tmp_dex_output = os.path.join(tmp_dir, 'tmp_dex_output.zip') tmp_dex_output = os.path.join(tmp_dir, 'tmp_dex_output.zip')
needs_dexing = not all(f.endswith('.dex') for f in d8_inputs) if (output.endswith('.dex')
needs_dexmerge = output.endswith('.dex') or not (options and options.library) or not all(f.endswith('.dex') for f in d8_inputs)):
if needs_dexing or needs_dexmerge:
if options: if options:
if options.main_dex_list_path: if options.main_dex_list_path:
dex_cmd = dex_cmd + ['--main-dex-list', options.main_dex_list_path] dex_cmd = dex_cmd + ['--main-dex-list', options.main_dex_list_path]
elif options.library and int(options.min_api or 1) < 21: elif options.multi_dex and int(options.min_api or 1) < 21:
# When dexing D8 requires a main dex list pre-21. For library targets, # When dexing library targets, it doesn't matter what's in the main dex.
# it doesn't matter what's in the main dex, so just use a dummy one.
tmp_main_dex_list_path = os.path.join(tmp_dir, 'main_list.txt') tmp_main_dex_list_path = os.path.join(tmp_dir, 'main_list.txt')
with open(tmp_main_dex_list_path, 'w') as f: with open(tmp_main_dex_list_path, 'w') as f:
f.write('Foo.class\n') f.write('Foo.class\n')
......
...@@ -46,8 +46,9 @@ if (is_android || is_chromeos) { ...@@ -46,8 +46,9 @@ if (is_android || is_chromeos) {
enable_chrome_android_internal = has_chrome_android_internal enable_chrome_android_internal = has_chrome_android_internal
# The default to use for android:minSdkVersion for targets that do # The default to use for android:minSdkVersion for targets that do
# not explicitly set it. # not explicitly set it. This can generally be set higher than the
default_min_sdk_version = 21 # default, but not lower.
default_min_sdk_version = 19
# Android API level for 32 bits platforms # Android API level for 32 bits platforms
android32_ndk_api_level = 16 android32_ndk_api_level = 16
......
...@@ -1304,9 +1304,6 @@ if (enable_java_templates) { ...@@ -1304,9 +1304,6 @@ if (enable_java_templates) {
} }
} }
# It's not safe to dex merge with libraries dex'ed at higher api versions.
assert(!_is_dex_merging || _min_sdk_version >= default_min_sdk_version)
# For D8's backported method desugaring to work properly, the dex merge step # For D8's backported method desugaring to work properly, the dex merge step
# must not be set to a higher minSdkVersion than it was for the libraries. # must not be set to a higher minSdkVersion than it was for the libraries.
if (_enable_desugar && _is_dex_merging) { if (_enable_desugar && _is_dex_merging) {
...@@ -1416,14 +1413,13 @@ if (enable_java_templates) { ...@@ -1416,14 +1413,13 @@ if (enable_java_templates) {
} }
} }
} else { # !_proguard_enabled } else { # !_proguard_enabled
_is_library = defined(invoker.is_library) && invoker.is_library
_input_class_jars = [] _input_class_jars = []
if (defined(invoker.input_class_jars)) { if (defined(invoker.input_class_jars)) {
_input_class_jars = invoker.input_class_jars _input_class_jars = invoker.input_class_jars
} }
_deps = invoker.deps _deps = invoker.deps
if (!_is_library && enable_bazel_desugar) { if (_is_dex_merging && enable_bazel_desugar) {
# It would be more efficient to use the pre-dex'ed copy of the runtime, # It would be more efficient to use the pre-dex'ed copy of the runtime,
# but it's easier to add it in this way. # but it's easier to add it in this way.
_deps += [ "//third_party/bazel/desugar:desugar_runtime_java" ] _deps += [ "//third_party/bazel/desugar:desugar_runtime_java" ]
...@@ -1541,10 +1537,11 @@ if (enable_java_templates) { ...@@ -1541,10 +1537,11 @@ if (enable_java_templates) {
deps += [ ":${_main_dex_list_target_name}" ] deps += [ ":${_main_dex_list_target_name}" ]
inputs += [ _main_dex_list_path ] inputs += [ _main_dex_list_path ]
} }
} else if (defined(invoker.enable_library_multidex) &&
invoker.enable_library_multidex) {
args += [ "--multi-dex" ]
} }
if (_is_library) {
args += [ "--library" ]
}
if (defined(invoker.input_dex_filearg)) { if (defined(invoker.input_dex_filearg)) {
inputs += [ invoker.build_config ] inputs += [ invoker.build_config ]
args += [ "--dex-inputs-filearg=${invoker.input_dex_filearg}" ] args += [ "--dex-inputs-filearg=${invoker.input_dex_filearg}" ]
...@@ -1582,7 +1579,7 @@ if (enable_java_templates) { ...@@ -1582,7 +1579,7 @@ if (enable_java_templates) {
# 1) not require recompiles when toggling is_java_debug, # 1) not require recompiles when toggling is_java_debug,
# 2) allow incremental_install=1 to still have local variable # 2) allow incremental_install=1 to still have local variable
# information even when is_java_debug=false. # information even when is_java_debug=false.
if (!is_java_debug && !_is_library) { if (!is_java_debug && _is_dex_merging) {
args += [ "--release" ] args += [ "--release" ]
} }
...@@ -3255,6 +3252,8 @@ if (enable_java_templates) { ...@@ -3255,6 +3252,8 @@ if (enable_java_templates) {
# from the final .jar file. # from the final .jar file.
# jar_included_patterns: Optional list of .class file patterns to include # jar_included_patterns: Optional list of .class file patterns to include
# in the final .jar file. jar_excluded_patterns take precedence over this. # in the final .jar file. jar_excluded_patterns take precedence over this.
# min_sdk_version: Optional. The minimum Android SDK version this target
# supports.
# #
# For 'android_apk' and 'android_app_bundle_module' targets only: # For 'android_apk' and 'android_app_bundle_module' targets only:
# #
...@@ -3790,8 +3789,10 @@ if (enable_java_templates) { ...@@ -3790,8 +3789,10 @@ if (enable_java_templates) {
deps += _classpath_deps + [ ":$_header_target_name" ] deps += _classpath_deps + [ ":$_header_target_name" ]
} }
# For library targets, we do not need a proper main dex list, but do
# need to allow multiple dex files.
enable_multidex = false enable_multidex = false
is_library = true enable_library_multidex = true
} }
_public_deps += [ ":${target_name}__dex" ] _public_deps += [ ":${target_name}__dex" ]
} }
......
...@@ -2430,7 +2430,9 @@ if (enable_java_templates) { ...@@ -2430,7 +2430,9 @@ if (enable_java_templates) {
_final_deps = [] _final_deps = []
_enable_main_dex_list = _enable_multidex && _min_sdk_version < 21 _enable_main_dex_list =
_enable_multidex &&
(!defined(invoker.min_sdk_version) || invoker.min_sdk_version < 21)
if (_enable_main_dex_list) { if (_enable_main_dex_list) {
_generated_proguard_main_dex_config = _generated_proguard_main_dex_config =
"$_base_path.resources.main-dex-proguard.txt" "$_base_path.resources.main-dex-proguard.txt"
...@@ -2925,16 +2927,12 @@ if (enable_java_templates) { ...@@ -2925,16 +2927,12 @@ if (enable_java_templates) {
deps += _deps + [ ":$_compile_resources_target" ] deps += _deps + [ ":$_compile_resources_target" ]
proguard_mapping_path = _proguard_mapping_path proguard_mapping_path = _proguard_mapping_path
proguard_sourcefile_suffix = "$android_channel-$_version_code" proguard_sourcefile_suffix = "$android_channel-$_version_code"
} else if (_min_sdk_version >= default_min_sdk_version) { } else {
# Enable dex merging only when min_sdk_version is >= what the library
# .dex files were created with.
input_dex_filearg = input_dex_filearg =
"@FileArg(${_rebased_build_config}:final_dex:all_dex_files)" "@FileArg(${_rebased_build_config}:final_dex:all_dex_files)"
if (_enable_main_dex_list) { if (_enable_main_dex_list) {
main_dex_list_input_classes_filearg = "@FileArg(${_rebased_build_config}:deps_info:java_runtime_classpath)" main_dex_list_input_classes_filearg = "@FileArg(${_rebased_build_config}:deps_info:java_runtime_classpath)"
} }
} else {
input_classes_filearg = "@FileArg($_rebased_build_config:deps_info:java_runtime_classpath)"
} }
if (_is_static_library_provider) { if (_is_static_library_provider) {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="org.chromium.android_browsertests_apk"> package="org.chromium.android_browsertests_apk">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="23" />
<uses-feature android:glEsVersion="0x00020000" /> <uses-feature android:glEsVersion="0x00020000" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
......
...@@ -1110,7 +1110,6 @@ if (!is_component_build) { ...@@ -1110,7 +1110,6 @@ if (!is_component_build) {
"cronet_smoketests_missing_native_library_instrumentation_apk") { "cronet_smoketests_missing_native_library_instrumentation_apk") {
apk_name = "MissingNativeLibrarySmokeTestInstrumentation" apk_name = "MissingNativeLibrarySmokeTestInstrumentation"
android_manifest = "test/javatests/AndroidManifest.xml" android_manifest = "test/javatests/AndroidManifest.xml"
min_sdk_version = _cronet_min_sdk_version
sources = cronet_smoketests_native_common_srcs + [ "test/smoketests/src/org/chromium/net/smoke/MissingNativeLibraryTest.java" ] sources = cronet_smoketests_native_common_srcs + [ "test/smoketests/src/org/chromium/net/smoke/MissingNativeLibraryTest.java" ]
deps = [ deps = [
...@@ -1180,7 +1179,6 @@ if (!is_component_build) { ...@@ -1180,7 +1179,6 @@ if (!is_component_build) {
} }
test("cronet_unittests_android") { test("cronet_unittests_android") {
min_sdk_version = _cronet_min_sdk_version
deps = [ deps = [
":cronet_impl_native_base_java", ":cronet_impl_native_base_java",
":cronet_static", ":cronet_static",
...@@ -1206,7 +1204,6 @@ if (!is_component_build) { ...@@ -1206,7 +1204,6 @@ if (!is_component_build) {
} }
test("cronet_tests_android") { test("cronet_tests_android") {
min_sdk_version = _cronet_min_sdk_version
deps = [ deps = [
":cronet_impl_native_base_java", ":cronet_impl_native_base_java",
":cronet_static", ":cronet_static",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment