Skip to content

Commit 5fe416c

Browse files
committed
Skip locking package build directory
SwiftPM 6 introduces a lock in the package build directory to avoid concurrent builds/tests. Unfortuntely this behavior is needed by the MMIOFileCheckTests currently. This commit adds a flag to avoid locking the package build directory when building with SwiftPM 6. Additionally, I have an inflight PR to change `--ignore-lock true` to `--ignore-lock` so this commit will require a follow-up fix, after that change in SwiftPM is merged (swiftlang/swift-package-manager#7384).
1 parent 9117295 commit 5fe416c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

Tests/MMIOFileCheckTests/MMIOFileCheckTestCase.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,28 @@ class MMIOFileCheckTestCaseSetup {
117117
print("Using Simple FileCheck")
118118
}
119119

120+
print("Determining Swift Version...")
121+
let versionString = try sh(
122+
"""
123+
swift --version
124+
""")
125+
126+
let regex = #/Apple Swift version (\d+)/#
127+
let swift6Plus =
128+
if let match = versionString.firstMatch(of: regex),
129+
let majorVersion = Int(match.output.1),
130+
majorVersion > 5 {
131+
true
132+
} else {
133+
false
134+
}
135+
120136
print("Determining Dependency Paths...")
121137
let buildOutputsURL = URL(
122138
fileURLWithPath: try sh(
123139
"""
124140
swift build \
141+
\(swift6Plus ? "--ignore-lock true" : "") \
125142
--configuration release \
126143
--package-path \(self.packageDirectoryURL.path) \
127144
--show-bin-path
@@ -131,6 +148,7 @@ class MMIOFileCheckTestCaseSetup {
131148
_ = try sh(
132149
"""
133150
swift build \
151+
\(swift6Plus ? "--ignore-lock true" : "") \
134152
--configuration release \
135153
--package-path \(self.packageDirectoryURL.path)
136154
""")
@@ -168,7 +186,8 @@ struct MMIOFileCheckTestCase {
168186
-I \(mmioVolatileDirectoryURL.path) \
169187
-load-plugin-executable \
170188
\(paths.buildOutputsURL.path)/MMIOMacros#MMIOMacros \
171-
-parse-as-library
189+
-parse-as-library \
190+
-diagnostic-style llvm
172191
""")
173192

174193
if paths.hasLLVMFileCheck {

0 commit comments

Comments
 (0)