Skip to content

Commit e71ede1

Browse files
Merge pull request #83696 from swiftlang/jepa-main
swift-xcodegen: Minor tweaks
2 parents 24ac33d + d81a42a commit e71ede1

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

utils/swift-xcodegen/Sources/swift-xcodegen/Options.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,13 @@ struct MiscOptions: ParsableArguments {
242242
""")
243243
var projectRootDir: AnyPath?
244244

245-
@Option(help: """
246-
The output directory to write the Xcode project to. Defaults to the project
247-
root directory.
248-
""")
245+
@Option(
246+
name: .shortAndLong,
247+
help: """
248+
The output directory to write the Xcode project to. Defaults to the
249+
project root directory.
250+
"""
251+
)
249252
var outputDir: AnyPath?
250253

251254
@Option(help: "The log level verbosity (default: info)")

utils/swift-xcodegen/Sources/swift-xcodegen/SwiftXcodegen.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,22 @@ struct SwiftXcodegen: AsyncParsableCommand, Sendable {
402402
}
403403

404404
func printingTimeTaken<T>(_ fn: () async throws -> T) async rethrows -> T {
405-
let start = Date()
405+
let start = ContinuousClock.now
406406
let result = try await fn()
407+
let end = ContinuousClock.now
408+
409+
let duration = start.duration(to: end)
407410

408411
// Note we don't print the time taken when we fail.
409-
let delta = Date().timeIntervalSince(start)
410-
log.info("Successfully generated in \(Int((delta * 1000).rounded()))ms")
412+
var message = "Successfully generated in "
413+
message += duration.formatted(
414+
.units(
415+
allowed: [.seconds],
416+
width: .narrow,
417+
fractionalPart: .init(lengthLimits: 0...3, roundingRule: .up)
418+
)
419+
)
420+
log.info(message)
411421

412422
return result
413423
}

0 commit comments

Comments
 (0)