You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix SPM dependency linking and Xcode multi-scheme selection (#69, #70)
SPM: After swift build, archive each dependency target's .o files into
lib<Dep>.a and pass -L <binPath> -l<Dep> so the bridge dylib can link
against sibling targets and cross-package dependencies. SPM doesn't
create static archives or emit autolink hints for library targets, so
the build system has to stage them explicitly.
Xcode: Add optional `scheme` parameter threaded from MCP tool schemas
and CLI options through BuildSystemDetector into XcodeBuildSystem.
When set, pickScheme() validates it against the project's scheme list.
When unset, existing heuristics apply (single scheme auto-pick, then
path-component matching). Ambiguous-target error now names the `scheme`
parameter instead of suggesting `projectRoot`.
Adds ToDoExtras (sibling target) and LocalDep (cross-package path dep)
to the SPM example. The existing Tier 2 test now exercises dependency
linking as a regression guard.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
"Project root path (auto-detected if omitted). Enables importing project types from SPM packages, Bazel swift_library targets, or Xcode projects (.xcodeproj / .xcworkspace)."
137
137
),
138
138
]),
139
+
"scheme":.object([
140
+
"type":.string("string"),
141
+
"description":.string(
142
+
"Xcode scheme name (only used for .xcodeproj / .xcworkspace projects). Required when the project contains more than one scheme and none of them match the source file's directory."
@@ -56,7 +65,7 @@ public enum BuildSystemDetector {
56
65
return bazel
57
66
}
58
67
// Xcode (.xcworkspace / .xcodeproj)
59
-
if let xcode =tryawaitXcodeBuildSystem.detect(for: sourceFile){
68
+
if let xcode =tryawaitXcodeBuildSystem.detect(for: sourceFile, scheme: scheme){
60
69
return xcode
61
70
}
62
71
return nil
@@ -69,6 +78,7 @@ public enum BuildSystemError: Error, LocalizedError {
69
78
case targetNotFound(sourceFile: String, project: String)
70
79
case missingArtifacts(String)
71
80
case ambiguousTarget(sourceFile: String, candidates:[String])
81
+
case unknownScheme(requested: String, candidates:[String])
72
82
73
83
public varerrorDescription:String?{
74
84
switchself{
@@ -80,7 +90,10 @@ public enum BuildSystemError: Error, LocalizedError {
80
90
return"Build artifacts not found: \(msg)"
81
91
case.ambiguousTarget(let file,let candidates):
82
92
return
83
-
"Multiple schemes found for \(file). Use projectRoot to disambiguate. Available schemes: \(candidates.joined(separator:", "))"
93
+
"Multiple schemes found for \(file) and none matched the source file's directory. Pass the `scheme` parameter to pick one. Available schemes: \(candidates.joined(separator:", "))"
94
+
case.unknownScheme(let requested,let candidates):
95
+
return
96
+
"Scheme '\(requested)' not found in project. Available schemes: \(candidates.joined(separator:", "))"
0 commit comments