forked from swiftwasm/JavaScriptKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginPaths.swift
More file actions
74 lines (70 loc) · 2.34 KB
/
Copy pathPluginPaths.swift
File metadata and controls
74 lines (70 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#if canImport(PackagePlugin)
import struct Foundation.URL
enum BridgeJSPluginPaths {
static func skeletonURL(
targetName: String,
packageID: String,
buildPluginWorkDirectoryURL workDirectoryURL: URL
) -> URL {
let pluginsOutputsRootURL =
workDirectoryURL
.deletingLastPathComponent()
.deletingLastPathComponent()
.deletingLastPathComponent()
.deletingLastPathComponent()
return bridgeJSDirectoryURL(
targetName: targetName,
packageID: packageID,
pluginsOutputsRootURL: pluginsOutputsRootURL
)
.appending(path: "JavaScript/BridgeJS.json")
}
static func skeletonURL(
targetName: String,
packageID: String,
commandPluginWorkDirectoryURL workDirectoryURL: URL
) -> URL {
// workDirectoryURL: ".build/plugins/PackageToJS/outputs/"
// .build/plugins/outputs/[package]/[target]/destination/BridgeJS/JavaScript/BridgeJS.json
let pluginsOutputsRootURL =
workDirectoryURL
.deletingLastPathComponent()
.deletingLastPathComponent()
.appending(path: "outputs")
return bridgeJSDirectoryURL(
targetName: targetName,
packageID: packageID,
pluginsOutputsRootURL: pluginsOutputsRootURL
)
.appending(path: "JavaScript/BridgeJS.json")
}
static func bridgeJSSwiftURL(
targetName: String,
packageID: String,
buildPluginWorkDirectoryURL workDirectoryURL: URL
) -> URL {
let pluginsOutputsRootURL =
workDirectoryURL
.deletingLastPathComponent()
.deletingLastPathComponent()
.deletingLastPathComponent()
.deletingLastPathComponent()
return bridgeJSDirectoryURL(
targetName: targetName,
packageID: packageID,
pluginsOutputsRootURL: pluginsOutputsRootURL
)
.appending(path: "BridgeJS.swift")
}
private static func bridgeJSDirectoryURL(
targetName: String,
packageID: String,
pluginsOutputsRootURL: URL
) -> URL {
pluginsOutputsRootURL
.appending(path: packageID)
.appending(path: targetName)
.appending(path: "destination/BridgeJS")
}
}
#endif