Skip to content

Commit ee778d9

Browse files
committed
Use SCRIPT_DIR placeholder in fixtures
1 parent edd3056 commit ee778d9

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Fixtures/Scripts/EchoArguments/PackageSyntax.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"dependencies" : [
33

44
],
5-
"sourceFile" : "\/Users\/yr.chen\/Developer\/GSoC\/swift-package-manager\/Fixtures\/Scripts\/EchoArguments\/EchoArguments.swift"
5+
"sourceFile" : "SCRIPT_DIR\/EchoArguments.swift"
66
}

Fixtures/Scripts/EchoCWD/PackageSyntax.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"dependencies" : [
33
{
44
"package" : {
5-
"raw" : "name:\"CwdDump\",path:\"\/Users\/yr.chen\/Developer\/GSoC\/swift-package-manager\/Fixtures\/Scripts\/EchoCWD\/cwd-dump\"",
6-
"path" : "\/Users\/yr.chen\/Developer\/GSoC\/swift-package-manager\/Fixtures\/Scripts\/EchoCWD\/cwd-dump",
5+
"raw" : "name:\"CwdDump\",path:\"SCRIPT_DIR\/cwd-dump\"",
6+
"path" : "SCRIPT_DIR\/cwd-dump",
77
"name" : "CwdDump"
88
},
99
"modules" : [
1010
"CwdDump"
1111
]
1212
}
1313
],
14-
"sourceFile" : "\/Users\/yr.chen\/Developer\/GSoC\/swift-package-manager\/Fixtures\/Scripts\/EchoCWD\/EchoCWD.swift"
14+
"sourceFile" : "SCRIPT_DIR\/EchoCWD.swift"
1515
}
1616

Sources/SPMTestSupport/misc.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ private func withPackageSyntax(from file: AbsolutePath, _ body: () throws -> Voi
267267
try withTemporaryDirectory { path in
268268
let parser = path.appending(component: "package-syntax-parser")
269269
try localFileSystem.writeFileContents(parser) {
270-
$0.write("cat \(file.toJSON())\n")
270+
// Manually escape the separator.
271+
let dirname = file.dirname.replacingOccurrences(of: "/", with: "\\/")
272+
// Replace placeholder with the real dirpath.
273+
$0.write("cat \(file.pathString.spm_shellEscaped()) | sed 's$SCRIPT_DIR$\(dirname)$g' \n")
271274
$0.flush()
272275
}
273276
try localFileSystem.chmod(.executable, path: parser)

0 commit comments

Comments
 (0)