Commit 4995409b authored by Ian Vollick's avatar Ian Vollick Committed by Commit Bot

Update build rules to support ARCore

Define enable_arcore and add some build rules to use it.

Bug: 833511
Change-Id: I716123c2a282d7d123883df81ebbc00a0a883be8
Reviewed-on: https://chromium-review.googlesource.com/1033580
Commit-Queue: Ian Vollick <vollick@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Reviewed-by: default avatarEric Stevenson <estevenson@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Reviewed-by: default avatarDavid Dorwin <ddorwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555174}
parent 82aa1f5c
......@@ -27,8 +27,11 @@ def main():
parser.add_argument('apk', help='APK file path.')
args = parser.parse_args()
#TODO(crbug.com/838414): add support for files included via loadable_modules.
ignored_libs = ['libarcore_sdk_c_minimal.so']
si_count = resource_sizes.AnalyzeStaticInitializers(
args.apk, args.tool_prefix, False, '.')
args.apk, args.tool_prefix, False, '.', ignored_libs)
if si_count != args.expected_count:
print 'Expected {} static initializers, but found {}.'.format(
args.expected_count, si_count)
......@@ -40,7 +43,7 @@ def main():
print 'Dumping static initializers via dump-static-initializers.py:'
sys.stdout.flush()
resource_sizes.AnalyzeStaticInitializers(
args.apk, args.tool_prefix, True, '.')
args.apk, args.tool_prefix, True, '.', ignored_libs)
print
print 'If the above list is not useful, consider listing them with:'
print ' //tools/binary_size/diagnose_bloat.py'
......
......@@ -562,12 +562,14 @@ def _AnnotatePakResources(out_dir):
# This method also used by //build/android/gyp/assert_static_initializers.py
def AnalyzeStaticInitializers(apk_filename, tool_prefix, dump_sis, out_dir):
def AnalyzeStaticInitializers(apk_filename, tool_prefix, dump_sis, out_dir,
ignored_libs):
# Static initializer counting mostly copies logic in
# infra/scripts/legacy/scripts/slave/chromium/sizes.py.
with zipfile.ZipFile(apk_filename) as z:
so_files = [f for f in z.infolist()
if f.filename.endswith('.so') and f.file_size > 0]
if f.filename.endswith('.so') and f.file_size > 0
and os.path.basename(f.filename) not in ignored_libs]
# Skip checking static initializers for 32 bit .so files when 64 bit .so files
# are present since the 32 bit versions will be checked by bots that only
# build the 32 bit version. This avoids the complexity of finding 32 bit .so
......@@ -731,7 +733,7 @@ def main():
_PrintDexAnalysis(args.apk, chartjson=chartjson)
si_count = AnalyzeStaticInitializers(
args.apk, tool_prefix, args.dump_sis, out_dir)
args.apk, tool_prefix, args.dump_sis, out_dir, [])
perf_tests_results_helper.ReportPerfResult(
chartjson, 'StaticInitializersCount', 'count', si_count, 'count')
......
......@@ -8,6 +8,7 @@ import("//build/config/locales.gni")
import("//build/config/android/extract_unwind_tables.gni")
import("//build/config/compiler/compiler.gni")
import("//chrome/common/features.gni")
import("//device/vr/buildflags/buildflags.gni")
import("//third_party/leakcanary/config.gni")
import("channel.gni")
......@@ -193,5 +194,15 @@ template("monochrome_public_apk_tmpl") {
proguard_configs += [ "//android_webview/apk/java/proguard.flags" ]
png_to_webp = true
}
if (enable_arcore) {
deps += [
"//third_party/arcore-android-sdk:libarcore_library",
"//third_party/arcore-android-sdk:libdynamite_client_java",
]
# We store this as a separate .so in the APK and only load as needed.
loadable_modules = [ "${root_out_dir}/libarcore_sdk_c_minimal.so" ]
}
}
}
......@@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni")
import("//build/config/gclient_args.gni")
import("//chrome/android/channel.gni")
declare_args() {
# TODO(733935): Enable for other Android architectures too. Currently we only
......@@ -29,4 +30,11 @@ declare_args() {
# Whether to include VR extras like test APKs in non-VR-specific targets
include_vr_data = false
# TODO(crbug.com/837999): We currently only support arm and arm64 and we are
# limiting to canary and dev until binary size issues are resolved.
enable_arcore = is_android && !is_chromecast &&
(current_cpu == "arm" || current_cpu == "arm64") &&
(android_channel == "default" || android_channel == "dev" ||
android_channel == "canary")
}
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