Commit 3bffe144 authored by Samuel Huang's avatar Samuel Huang Committed by Commit Bot

[Build] Use GN write_file() instead of script to write .ssargs files.

Previously we added a script write_ssargs.py to write .ssargs files for
SuperSize. To simplify things, this CL removes the script, and use GN
write_file() command instead.

As a result .ssargs files are created on "gn gen", instead of during
build.

Bug: 1040645
Change-Id: I147480817d1c3036780d5496cc30fd2d4c8b9fb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2267337
Commit-Queue: Samuel Huang <huangs@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782728}
parent ab0043d3
......@@ -2808,10 +2808,7 @@ if (public_android_sdk) {
# Used for binary size monitoring.
create_app_bundle_minimal_apks("trichrome_chrome_minimal_apks") {
deps = [
":ssargs_trichrome",
":trichrome_chrome_bundle",
]
deps = [ ":trichrome_chrome_bundle" ]
bundle_path = "$root_build_dir/apks/TrichromeChrome.aab"
}
......
......@@ -210,23 +210,19 @@ template("trichrome_library_apk_tmpl") {
# parameters, and is used by SuperSize-archive to create multi-container .size
# files. This is used to support SuperSize on Trichrome.
template("write_ssargs_trichrome") {
action(target_name) {
script = "//chrome/android/write_ssargs.py"
outputs = [ invoker.ssargs_path ]
# Base names (i.e., no full path) are used because .ssargs files specifies
# files using paths relative to itself. It is expected for |ssargs_path| to
# be in the same directory as all Trichrome files whose sizes are measured
# by SuperSize.
args = [
rebase_path(invoker.ssargs_path, root_build_dir),
"--items",
"Library -f ${invoker.trichrome_library_basename}",
"Chrome -f ${invoker.trichrome_chrome_basename}",
# WebView has no .so files. --java-only is needed to prevent SuperSize
# from failing.
"WebView -f ${invoker.trichrome_webview_basename} --java-only",
]
}
# Base names (i.e., no full path) are used because .ssargs files specifies
# files using paths relative to itself. It is expected for |ssargs_path| to
# be in the same directory as all Trichrome files whose sizes are measured
# by SuperSize.
ssargs_lines = [
"# Written by build target \"${target_name}.\"",
"Library -f ${invoker.trichrome_library_basename}",
"Chrome -f ${invoker.trichrome_chrome_basename}",
# WebView has no .so files. --java-only is needed to prevent SuperSize
# from failing.
"WebView -f ${invoker.trichrome_webview_basename} --java-only",
]
write_file(invoker.ssargs_path, ssargs_lines)
}
#!/usr/bin/env python
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Creates .ssargs file for SuperSize."""
import argparse
import os
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument('output', type=argparse.FileType('w'),
help='Output filename.')
parser.add_argument('--items',
nargs='*',
default=[],
help='Line specifying a single Container.')
args = parser.parse_args()
lines = ['# Generated by {}'.format(os.path.basename(__file__))] + args.items
args.output.write('\n'.join(lines + ['']))
if __name__ == '__main__':
main()
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