File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -20,5 +20,13 @@ struct Build: ParsableCommand, BuildCommand {
20
20
func run( ) throws {
21
21
try buildTarget ( packageDir: Paths . packageDir, targetName: " SwiftSyntax-all " )
22
22
try buildTarget ( packageDir: Paths . examplesDir, targetName: " Examples-all " )
23
+ try buildEditorExtension ( )
24
+ }
25
+
26
+ private func buildEditorExtension( ) throws {
27
+ #if os(macOS)
28
+ logSection ( " Building Editor Extension " )
29
+ try invokeXcodeBuild ( projectPath: Paths . editorExtensionProjectPath)
30
+ #endif
23
31
}
24
32
}
Original file line number Diff line number Diff line change @@ -89,6 +89,27 @@ extension BuildCommand {
89
89
return result
90
90
}
91
91
92
+ @discardableResult
93
+ func invokeXcodeBuild( projectPath: URL ) throws -> ProcessResult {
94
+ guard let xcodebuildExec = Paths . xcodebuildExec else {
95
+ throw ScriptExectutionError (
96
+ message: """
97
+ Error: Could not find xcodebuild.
98
+ Looking at ' \( Paths . xcodebuildExec? . path ?? " N/A " ) '.
99
+ """
100
+ )
101
+ }
102
+ let processRunner = ProcessRunner (
103
+ executableURL: xcodebuildExec,
104
+ arguments: [ " -project " , projectPath. path] ,
105
+ additionalEnvironment: [ : ]
106
+ )
107
+
108
+ let result = try processRunner. run ( verbose: arguments. verbose)
109
+
110
+ return result
111
+ }
112
+
92
113
private func build( packageDir: URL , name: String , isProduct: Bool ) throws {
93
114
let args : [ String ]
94
115
Original file line number Diff line number Diff line change @@ -37,6 +37,12 @@ enum Paths {
37
37
. appendingPathComponent ( " CodeGeneration " )
38
38
}
39
39
40
+ static var editorExtensionProjectPath : URL {
41
+ packageDir
42
+ . appendingPathComponent ( " EditorExtension " )
43
+ . appendingPathComponent ( " SwiftRefactorExtension.xcodeproj " )
44
+ }
45
+
40
46
static var workspaceDir : URL {
41
47
packageDir
42
48
. deletingLastPathComponent ( )
@@ -63,6 +69,10 @@ enum Paths {
63
69
return lookupExecutable ( for: " diff " )
64
70
}
65
71
72
+ static var xcodebuildExec : URL ? {
73
+ return lookupExecutable ( for: " xcodebuild " )
74
+ }
75
+
66
76
private static var envSearchPaths : [ URL ] {
67
77
// Compute search paths from PATH variable.
68
78
#if os(Windows)
You can’t perform that action at this time.
0 commit comments