Merge "Remove package-stats.txt"

This commit is contained in:
Treehugger Robot 2019-08-22 06:40:11 +00:00 committed by Gerrit Code Review
commit 1211130c92
3 changed files with 0 additions and 167 deletions

View File

@ -761,30 +761,6 @@ ifdef BOARD_ODM_KERNEL_MODULES
ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_ODM_KERNEL_MODULES),$(TARGET_OUT_ODM),odm,$(call intermediates-dir-for,PACKAGING,depmod_odm),$(BOARD_ODM_KERNEL_MODULES_LOAD),modules.load))
endif
# -----------------------------------------------------------------
# package stats
ifdef BUILDING_SYSTEM_IMAGE
PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
PACKAGES_TO_STAT := \
$(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
$(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
@echo Package stats: $@
@mkdir -p $(dir $@)
$(hide) rm -f $@
ifeq ($(PACKAGES_TO_STAT),)
# Create empty package stats file if target builds no jar(s) or apk(s).
$(hide) touch $@
else
$(hide) build/make/tools/dump-package-stats $^ > $@
endif
.PHONY: package-stats
package-stats: $(PACKAGE_STATS_FILE)
endif # BUILDING_SYSTEM_IMAGE
# -----------------------------------------------------------------
# Cert-to-package mapping. Used by the post-build signing tools.
# Use a macro to add newline to each echo command

View File

@ -1694,7 +1694,6 @@ else # TARGET_BUILD_APPS
$(call dist-for-goals, droidcore, \
$(APPS_ZIP) \
$(INTERNAL_EMULATOR_PACKAGE_TARGET) \
$(PACKAGE_STATS_FILE) \
)
endif
endif

View File

@ -1,142 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
PROGNAME=`basename $0`
function fail ()
{
if [ ! -z "$@" ]
then
echo "$PROGNAME: ERROR: $@" >&2
fi
echo "$PROGNAME: ERROR: failed." >&2
exit 1
}
function usage ()
{
cat << HERE
usage: $PROGNAME <.jar/.apk-file-list>
Dumps a summary of the compressed and uncompressed sizes of various
types of files in each package. Emits one line per package.
Packages must be zipfiles, readable using "unzip".
Example output line:
filesize=642684 all=603288/919304 dex=119529/353815 name="out/App.apk"
filesize: the size of the package on disk
name: the name of the package as passed to $PROGNAME
These fields are presented as <uncompressed bytes>/<compressed bytes>:
all: the sum of all entries in the package
dex: the sum of all "*.dex" entries in the package
HERE
exit 1
}
if [ $# -lt 1 ]
then
usage
fi
UNAME=`uname`
if [ "x$UNAME" = "xDarwin" ]
then
statArgs="-f %z"
elif [ "x$UNAME" = "xLinux" ]
then
statArgs="-c %s"
else
fail "Unknown uname $UNAME"
fi
function printFileSize ()
{
stat $statArgs $1
}
for file
do
if [ ! -f "$file" ]
then
fail "$file doesn't exist or isn't a file"
fi
unzip -lvq "$file" | awk '
BEGIN {
total_compressed = 0;
total_uncompressed = 0;
dex_compressed = 0;
dex_uncompressed = 0;
}
# Make sure the output of unzip -lv looks like something we expect.
#
NR == "1" {
if (NF != "8" ||
$1 != "Length" ||
$2 != "Method" ||
$3 != "Size" ||
($4 != "Ratio" && $4 != "Cmpr") ||
$5 != "Date" ||
$6 != "Time" ||
$7 != "CRC-32" ||
$8 != "Name")
{
print "'$PROGNAME': ERROR: Unexpected zip listing format" > \
"/dev/stderr";
print "'$PROGNAME': ERROR: Line 2 is \"" $0 "\"" > \
"/dev/stderr";
failed = 1;
exit 1;
} else {
saw_listing = 1;
}
}
# Only look for lines where the ratio is the fourth column;
# this filters out the header and footer.
#
$4 ~ /%$/ {
uncompressed = $1;
compressed = $3;
if ($0 ~ /.dex$/) {
dex_compressed += compressed;
dex_uncompressed += uncompressed;
}
total_compressed += compressed;
total_uncompressed += uncompressed;
}
{ next }
END {
if (!failed && saw_listing) {
print "filesize='$(printFileSize "$file")'",
"all=" total_compressed "/" total_uncompressed,
"dex=" dex_compressed "/" dex_uncompressed,
"name=\"'"$file"'\"";
} else {
exit 1;
}
}
'
if [ $? -ne 0 ]
then
fail "Could not get stats for $file"
fi
done