Skip to content

Commit

Permalink
build: added absolute framework size to dangerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Longridge committed Dec 8, 2023
1 parent c048d3e commit cf0daa8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@
# vim: set ft=ruby

def framework_size
def _(number) # Formats a number with thousands separated by ','
number.to_s.reverse.scan(/.{1,3}/).join(',').reverse
end

old_binary = 'DerivedData.old/Build/Products/Release-iphoneos/BugsnagPerformance.framework/BugsnagPerformance'
new_binary = 'DerivedData.new/Build/Products/Release-iphoneos/BugsnagPerformance.framework/BugsnagPerformance'

size_after = File.size(new_binary)
size_before = File.size(old_binary)

case true
when size_after == size_before
markdown("**`BugsnagPerformance.framework`** binary size did not change - #{_(size_after)} bytes")
when size_after < size_before
markdown("**`BugsnagPerformance.framework`** binary size decreased by #{_(size_before - size_after)} bytes from #{_(size_before)} to #{_(size_after)} :tada:")
when size_after > size_before
markdown("**`BugsnagPerformance.framework`** binary size increased by #{_(size_after - size_before)} bytes from #{_(size_before)} to #{_(size_after)}")
end

markdown <<~MARKDOWN
```
#{`bloaty #{new_binary} -- #{old_binary}`.chomp}
Expand Down

0 comments on commit cf0daa8

Please sign in to comment.