Skip to content

Commit d8e139e

Browse files
committed
fix(ci): use consistent SDK size calculation for both metrics
- Use nested package node that contains 'src' folder - This excludes metadata wrappers (<String>, <int>, etc.) - Both SDK Size Comparison and Package Size Breakdown now show same total - Changed from 243.34KB to 238.66KB (actual SDK code size)
1 parent c3b1fd9 commit d8e139e

File tree

2 files changed

+22
-29
lines changed

2 files changed

+22
-29
lines changed

scripts/ci/calculate_sdk_size.sh

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if ! command -v jq &> /dev/null; then
2121
sudo apt-get update -qq && sudo apt-get install -y -qq jq >&2
2222
fi
2323

24-
# Calculate SDK size using jq with multiple search patterns
24+
# Calculate SDK size using jq - use nested package that contains "src"
2525
RESULT=$(jq '
2626
def sum_values:
2727
if type == "object" then
@@ -32,27 +32,12 @@ RESULT=$(jq '
3232
0
3333
end;
3434
35-
# Try multiple patterns to find the SDK package
35+
# Find the nested package that has "src" as a child (actual SDK code)
3636
(
37-
[.. | objects | select(.n? == "package:stadata_flutter_sdk")] |
38-
if length > 0 then
39-
(.[0] | sum_values)
40-
else
41-
# Try alternative pattern without package: prefix
42-
[.. | objects | select(.n? == "stadata_flutter_sdk")] |
43-
if length > 0 then
44-
(.[0] | sum_values)
45-
else
46-
# Try pattern with lib prefix
47-
[.. | objects | select(.n? | test("stadata_flutter_sdk"))] |
48-
if length > 0 then
49-
(.[0] | sum_values)
50-
else
51-
0
52-
end
53-
end
54-
end
55-
)
37+
.. | objects |
38+
select(.n? == "package:stadata_flutter_sdk" and (.children | if . then (map(.n) | any(. == "src")) else false end)) |
39+
sum_values
40+
) // 0
5641
' "$JSON_FILE" 2>/dev/null)
5742

5843
if [ -z "$RESULT" ] || [ "$RESULT" = "null" ]; then

scripts/ci/extract_feature_sizes.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,22 @@ jq -r '
7272
end;
7373
7474
# Combine all results
75-
[extract_features, extract_core_shared] |
76-
group_by(.feature) |
77-
map({
78-
feature: .[0].feature,
79-
size: (map(.size) | add)
80-
}) |
8175
{
82-
total: (map(.size) | add // 0),
83-
features: (map({(.feature): .size}) | add // {})
76+
# Calculate total from nested package that has "src" as child
77+
total: (
78+
.. | objects |
79+
select(.n? == "package:stadata_flutter_sdk" and (.children | if . then (map(.n) | any(. == "src")) else false end)) |
80+
sum_values
81+
),
82+
# Feature breakdown
83+
features: (
84+
[extract_features, extract_core_shared] |
85+
group_by(.feature) |
86+
map({
87+
feature: .[0].feature,
88+
size: (map(.size) | add)
89+
}) |
90+
map({(.feature): .size}) | add // {}
91+
)
8492
}
8593
' "$JSON_FILE" 2>/dev/null || echo "{}"

0 commit comments

Comments
 (0)