Skip to content

Commit e29010c

Browse files
committed
Build EditorExtension as part of CI job
1 parent 1060677 commit e29010c

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/Build.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,11 @@ struct Build: ParsableCommand, BuildCommand {
2020
func run() throws {
2121
try buildTarget(packageDir: Paths.packageDir, targetName: "SwiftSyntax-all")
2222
try buildTarget(packageDir: Paths.examplesDir, targetName: "Examples-all")
23+
try buildEditorExtension()
24+
}
25+
26+
private func buildEditorExtension() throws {
27+
logSection("Building Editor Extension")
28+
let result = try invokeXcodeBuild(projectPath: Paths.editorExtensionDir)
2329
}
2430
}

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/common/BuildCommand.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,26 @@ extension BuildCommand {
8989
return result
9090
}
9191

92+
func invokeXcodeBuild(projectPath: URL) throws -> ProcessResult {
93+
guard let xcodebuildExec = Paths.xcodebuildExec else {
94+
throw ScriptExectutionError(
95+
message: """
96+
Error: Could not find xcodebuild.
97+
Looking at '\(Paths.xcodebuildExec?.path ?? "N/A")'.
98+
"""
99+
)
100+
}
101+
let processRunner = ProcessRunner(
102+
executableURL: xcodebuildExec,
103+
arguments: ["-project", projectPath.path],
104+
additionalEnvironment: [:]
105+
)
106+
107+
let result = try processRunner.run(verbose: arguments.verbose)
108+
109+
return result
110+
}
111+
92112
private func build(packageDir: URL, name: String, isProduct: Bool) throws {
93113
let args: [String]
94114

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/common/Paths.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ enum Paths {
3737
.appendingPathComponent("CodeGeneration")
3838
}
3939

40+
static var editorExtensionProjectPath: URL {
41+
packageDir
42+
.appendingPathComponent("EditorExtension")
43+
.appendingPathComponent("SwiftRefactorExtension.xcodeproj")
44+
}
45+
4046
static var workspaceDir: URL {
4147
packageDir
4248
.deletingLastPathComponent()
@@ -63,6 +69,10 @@ enum Paths {
6369
return lookupExecutable(for: "diff")
6470
}
6571

72+
static var xcodebuildExec: URL? {
73+
return lookupExecutable(for: "xcodebuild")
74+
}
75+
6676
private static var envSearchPaths: [URL] {
6777
// Compute search paths from PATH variable.
6878
#if os(Windows)

0 commit comments

Comments
 (0)