@@ -46,11 +46,34 @@ struct VerifyDocumentation: ParsableCommand {
46
46
}
47
47
}
48
48
49
+ func xcodeVersion( xcodebuildExec: URL ) throws -> ( major: Int , minor: Int ) {
50
+ let result = try ProcessRunner (
51
+ executableURL: xcodebuildExec,
52
+ arguments: [ " -version " ]
53
+ ) . run ( captureStdout: true , captureStderr: false , verbose: false )
54
+ let xcodeVersionRegex = Regex {
55
+ " Xcode "
56
+ Capture ( OneOrMore ( . digit) )
57
+ " . "
58
+ Capture ( OneOrMore ( . digit) )
59
+ }
60
+ guard let match = result. stdout. firstMatch ( of: xcodeVersionRegex) , let major = Int ( match. 1 ) ,
61
+ let minor = Int ( match. 2 )
62
+ else {
63
+ throw ScriptExectutionError ( message: " Failed to extract Xcode version to verify documentation " )
64
+ }
65
+ return ( major, minor)
66
+ }
67
+
49
68
func buildDocumentation( product: String ) throws {
50
69
guard let xcodebuildExec = try ? Paths . xcodebuildExec else {
51
70
return
52
71
}
53
72
logSection ( " Building documentation for \( product) " )
73
+ var otherDoccFlags = [ " --warnings-as-errors " ]
74
+ if try xcodeVersion ( xcodebuildExec: xcodebuildExec) >= ( 16 , 0 ) {
75
+ otherDoccFlags. append ( " --disable-parameters-and-returns-validation " )
76
+ }
54
77
try ProcessRunner (
55
78
executableURL: xcodebuildExec,
56
79
arguments: [
@@ -60,7 +83,7 @@ struct VerifyDocumentation: ParsableCommand {
60
83
" -scheme " ,
61
84
product,
62
85
" -destination " , " platform=macOS " ,
63
- " OTHER_DOCC_FLAGS='--warnings-as-errors' " ,
86
+ " OTHER_DOCC_FLAGS= \( otherDoccFlags . joined ( separator : " " ) ) " ,
64
87
]
65
88
) . run ( captureStdout: false , captureStderr: false , verbose: self . verbose)
66
89
}
0 commit comments