SkQP: Slimmer APKS
Currently produces 30% smaller APKs. No-Try: true Change-Id: Ic04b4bebef78e9a3f8b8dde4bace78ce74e43d66 Reviewed-on: https://skia-review.googlesource.com/106165 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
This commit is contained in:
parent
cf42e98297
commit
a58bcf7ef8
@ -22,6 +22,9 @@ locations of the Android NDK and SDK. Current values:
|
||||
|
||||
Additionally, \`python\` and \`ninja\` should be in your path.
|
||||
|
||||
If SKQP_EXTRA_MODELS is non-empty, assets unneeded by the CTS tests will be
|
||||
included for experimental mode.
|
||||
|
||||
EOM
|
||||
exit 1
|
||||
}
|
||||
@ -37,7 +40,14 @@ set -e # Exit immediately
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
|
||||
git clean -fxd platform_tools/android/apps/skqp
|
||||
|
||||
python tools/skqp/download_model
|
||||
if [ -z "$SKQP_EXTRA_MODELS" ]; then
|
||||
python tools/skqp/remove_unneeded_assets
|
||||
fi
|
||||
|
||||
python tools/skqp/setup_resources
|
||||
python tools/git-sync-deps
|
||||
|
||||
|
34
tools/skqp/remove_unneeded_assets
Executable file
34
tools/skqp/remove_unneeded_assets
Executable file
@ -0,0 +1,34 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
# Copyright 2018 Google Inc.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
def gset(path):
|
||||
s = set()
|
||||
if os.path.isfile(path):
|
||||
with open(path, 'r') as f:
|
||||
for line in f:
|
||||
s.add(line.strip())
|
||||
return s
|
||||
|
||||
def main():
|
||||
assets = os.path.join('platform_tools', 'android', 'apps', 'skqp', 'src', 'main', 'assets')
|
||||
os.chdir(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, assets))
|
||||
known = gset('skqp/KnownGMs.txt')
|
||||
nope = gset('skqp/DoNotScoreInCompatibilityTestMode.txt')
|
||||
present = set(os.listdir('gmkb'))
|
||||
to_delete = present & nope
|
||||
if (known):
|
||||
to_delete |= (present - known)
|
||||
for x in to_delete:
|
||||
shutil.rmtree(os.path.join('gmkb', x))
|
||||
sys.stdout.write('%s: %d of %d models removed\n' %(sys.argv[0], len(to_delete), len(present)))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user