Skip to content

Commit

Permalink
Replaced the Double -> Int.max "dance" with just using UInt64. Thanks…
Browse files Browse the repository at this point in the history
… for the hint, alexdeem.
  • Loading branch information
Alex da Franca committed May 22, 2024
1 parent 7445f45 commit 7b437c1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
6 changes: 2 additions & 4 deletions Sources/xcresultparser/CoberturaCoverageConverter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ public class CoberturaCoverageConverter: CoverageConverter, XmlSerializable {
guard let covered = lineData.executionCount else {
continue
}
// If the line coverage count is a MAX_INT, just cap it at MAX_INT
let coveredAsInt = covered > Double(Int.max) ? Int.max : Int(covered)
let line = LineInfo(lineNumber: String(lineNum), coverage: coveredAsInt)
let line = LineInfo(lineNumber: String(lineNum), coverage: covered)
fileLines.append(line)
}

Expand Down Expand Up @@ -184,7 +182,7 @@ public class CoberturaCoverageConverter: CoverageConverter, XmlSerializable {

private struct LineInfo {
let lineNumber: String
let coverage: Int
let coverage: UInt64
}

private struct FileInfo {
Expand Down
2 changes: 1 addition & 1 deletion Sources/xcresultparser/Models/Coverage/LineDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import Foundation
struct LineDetail: Decodable {
let isExecutable: Bool
let line: Int
let executionCount: Double?
let executionCount: UInt64?
let subranges: [Subrange]?
}
2 changes: 1 addition & 1 deletion Sources/xcresultparser/Models/Coverage/Subrange.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import Foundation
// Subrange information struct
struct Subrange: Decodable {
let column: Int
let executionCount: Double
let executionCount: UInt64
let length: Int
}
3 changes: 3 additions & 0 deletions notarize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ fi
swift build -c release --arch arm64 --arch x86_64

# move the result from the .build folder to the product folder
if [ ! -d product ]; then
mkdir product
fi
cp ".build/apple/Products/Release/$productName" "product/$productName"

# Now codesign the app with hardening (-o)
Expand Down

0 comments on commit 7b437c1

Please sign in to comment.