-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_size
More file actions
executable file
·52 lines (42 loc) · 1.78 KB
/
check_size
File metadata and controls
executable file
·52 lines (42 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
(cd size_check/ ; ./gradlew clean assembleWithTeakRelease assembleWithoutTeakRelease > /dev/null 2> /dev/null)
print_size () {
(
stat --printf="%s" "$1" 2>/dev/null ||
stat -f%z "$1" 2>/dev/null
) | awk '{print $1}'
}
withTeakSize=$(print_size size_check/app/build/outputs/apk/withTeak/release/app-withTeak-release-unsigned.apk)
withoutTeakSize=$(print_size size_check/app/build/outputs/apk/withoutTeak/release/app-withoutTeak-release-unsigned.apk)
declare -a columns
declare -a withTeak
declare -a withoutTeak
IFS=, read -r col1 col2 col3 < size_check/app/build/outputs/dexcount/withTeakRelease.csv
columns[0]=$col1
columns[1]=$col2
columns[2]=$col3
while IFS=, read -r col1 col2 col3
do
withTeak[0]=$col1
withTeak[1]=$col2
withTeak[2]=$col3
done < size_check/app/build/outputs/dexcount/withTeakRelease.csv
while IFS=, read -r col1 col2 col3
do
withoutTeak[0]=$col1
withoutTeak[1]=$col2
withoutTeak[2]=$col3
done < size_check/app/build/outputs/dexcount/withoutTeakRelease.csv
padding=12
headerPadding=$((padding + ${#columns[0]}))
printf "Teak Android SDK Size (Release)\n"
printf "%19s %'d bytes\n" "With Teak" ${withTeakSize}
printf "%19s %'d bytes\n" "Without Teak" ${withoutTeakSize}
printf "\n"
printf "%${headerPadding}s | %s | %s\n" ${columns[0]} ${columns[1]} ${columns[2]}
printf "%${padding}s %'6d | %'6d | %'6d\n" "With Teak" ${withTeak[0]} ${withTeak[1]} ${withTeak[2]}
printf "%${padding}s %'6d | %'6d | %'6d\n" "Without Teak" ${withoutTeak[0]} ${withoutTeak[1]} ${withoutTeak[2]}
printf "\n"
printf "Adds a maximum of %'dkb, %'d methods, %'d fields, %'d classes (without stripping)\n" $(((withTeakSize - withoutTeakSize) / 1024)) $((withTeak[0] - withoutTeak[0])) $((withTeak[1] - withoutTeak[1])) $((withTeak[2] - withoutTeak[2]))