Track binary file size as part of the build.
@@ -84,6 +84,34 @@ function Get-Key {
return $key.Trim()
}
+###########################################
+
+function Build-Sizes {
+ $size_x64 = (Get-Item "bin/x64_Release/StereoKitC/StereoKitC.dll").length
+ $size_x64_linux = (Get-Item "bin/x64_Release/StereoKitC_Linux/libStereoKitC.so").length
+ $size_x64_uwp = (Get-Item "bin/x64_Release_UWP/StereoKitC_UWP/StereoKitC.dll").length
+ $size_arm64 = (Get-Item "bin/ARM64_Release/StereoKitC_Android/libStereoKitC.so").length
+ $size_arm64_uwp = (Get-Item "bin/ARM64_Release_UWP/StereoKitC_UWP/StereoKitC.dll").length
+
+ $text = (@"
+## Build Sizes:
+
+| Platform | Arch | Size, kb | Size, bytes |
+| -------- | ----- | -------- | ----------- |
+| Win32 | x64 | {0,8:N0} | {1,11:N0} |
+| Linux | x64 | {2,8:N0} | {3,11:N0} |
+| UWP | x64 | {4,8:N0} | {5,11:N0} |
+| UWP | ARM64 | {6,8:N0} | {7,11:N0} |
+| Android | ARM64 | {8,8:N0} | {9,11:N0} |
+"@ -f ([math]::Round($size_x64/1kb), $size_x64,
+ [math]::Round($size_x64_linux/1kb), $size_x64_linux,
+ [math]::Round($size_x64_uwp/1kb), $size_x64_uwp,
+ [math]::Round($size_arm64_uwp/1kb), $size_arm64_uwp,
+ [math]::Round($size_arm64/1kb), $size_arm64))
+
+ return $text
+}
+
###########################################
## Main ##
###########################################
@@ -211,6 +239,15 @@ if ($result -ne 0) {
}
Write-Host "Finished building: NuGet package" -ForegroundColor green
+#### Create Build Info File ###############
+
+$build_size = Build-Sizes
+$build_info = "# StereoKit v$version Build Information
+
+$build_size"
+Set-Content -path 'Tools\BuildInfo.md' -value $build_info
+Write-Host $build_info
+
#### Upload NuGet Package #################
if ($upload) {
