Skip to content

Build EditorExtension as part of CI job #2075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@ struct Build: ParsableCommand, BuildCommand {
func run() throws {
try buildTarget(packageDir: Paths.packageDir, targetName: "SwiftSyntax-all")
try buildTarget(packageDir: Paths.examplesDir, targetName: "Examples-all")
try buildEditorExtension()
}

private func buildEditorExtension() throws {
#if os(macOS)
logSection("Building Editor Extension")
try invokeXcodeBuild(projectPath: Paths.editorExtensionProjectPath)
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,27 @@ extension BuildCommand {
return result
}

@discardableResult
func invokeXcodeBuild(projectPath: URL) throws -> ProcessResult {
guard let xcodebuildExec = Paths.xcodebuildExec else {
throw ScriptExectutionError(
message: """
Error: Could not find xcodebuild.
Looking at '\(Paths.xcodebuildExec?.path ?? "N/A")'.
"""
)
}
let processRunner = ProcessRunner(
executableURL: xcodebuildExec,
arguments: ["-project", projectPath.path],
additionalEnvironment: [:]
)

let result = try processRunner.run(verbose: arguments.verbose)

return result
}

private func build(packageDir: URL, name: String, isProduct: Bool) throws {
let args: [String]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ enum Paths {
.appendingPathComponent("CodeGeneration")
}

static var editorExtensionProjectPath: URL {
packageDir
.appendingPathComponent("EditorExtension")
.appendingPathComponent("SwiftRefactorExtension.xcodeproj")
}

static var workspaceDir: URL {
packageDir
.deletingLastPathComponent()
Expand All @@ -63,6 +69,10 @@ enum Paths {
return lookupExecutable(for: "diff")
}

static var xcodebuildExec: URL? {
return lookupExecutable(for: "xcodebuild")
}

private static var envSearchPaths: [URL] {
// Compute search paths from PATH variable.
#if os(Windows)
Expand Down