Open jordikitto opened 3 months ago
Hi @jordikitto, thanks for bringing this to our attention -- Looks like there's some cases that finding the checkout of code-connect doesn't cover completely.
Would you be willing to share what the output of running xcodebuild -project
Workaround wise, as you've identified you can add a symlink in order to trick the parser to finding the right location. Another option is to create a dummy Package.swift
file somewhere that adds a dependency to code-connect and then configure the configuration file with the relevant include
glob paths (And then run code connect from that directory).
Hi @jyyang0
Here is the output of xcodebuild -project .xcodeproj -showBuildSettings
-> xcodebuild-output.txt
As for the project structure, it looks like such:
/<REPO_NAME>/
<PROJECT_NAME>.xcodeproj <-- Code Connect package added here
<PROJECT_NAME>.xcworkspace
/<PROJECT_NAME>/
/LOCAL_PACKAGE_1/
/LOCAL_PACKAGE_2/
/LOCAL_PACKAGE_3/
/LOCAL_PACKAGE_DESIGN_SYSTEM/
Package.swift <-- Code Connect package added here as well
The package is added to the project like so:
Figma
Library to app target, and don't add figma-swift
executable to target (Left as none
, this caused build errors if added)The package is added to the LOCAL_PACKAGE_DESIGN_SYSTEM
package as per the installation instructions
In Package.swift
:
dependencies
This all builds successfully, with a FigmaConnection
file in LOCAL_PACKAGE_DESIGN_SYSTEM
package publishing successfully to Code Connect.
If it makes any difference, I open the "project" via the xcworkspace
when developing. I'm also using Xcode 16 Beta 6.
Hey @jyyang0, any updates on this one? Would be really great if we could integrate this into our CI for our large project but this is making it quite difficult :(
Sorry about the delay -- Looking at your setup it seems like our current system is making some assumptions about xcodeproj based workspaces. which is failing -- In the next release that's coming out (1.0.7) we've added the ability to specify a swiftPackagePath
which you can use to refer to the Package.swift
file. Another option here is to run figma connect ...
in your LOCAL_PACKAGE_DESIGN_SYSTEM (so there's no ambiguity about whether theres an xcodeproj or SPM managed project) which should also unblock you.
This isn't a perfect solution and we're still iterating on how we can make the system more robust as a whole to support a variety of xcode project configurations, but this feedback is really helpful!
Hello @jyyang0 I am experiencing the same issue on CLI 1.1.4
It cannot locate the checkout of code-connect in derived data folder.
That's because it uses BUILD_DIR.
xcodebuild -project .xcodeproj -showBuildSettings
returns the project folder,
BUILD_DIR
is (/Users/raph/Developer/<project>/build)
not the derived data folder.
BUILD_DIR only returns the correct derived folder path when building.
@jyyang0 what's the correct way to install it, I've followed instructions on https://github.com/figma/code-connect/blob/main/docs/swiftui.md ?
@raphschwander are you using local packages like myself? Or just single project?
@jordikitto just a single project.
Hey @raphschwander, sorry to hear you're continuing to have issues here. It feels like a good workaround for now might be for us to provide a way to override the checkout location manually, would that work?
hello @tomduncalf-figma , thanks for getting back to me. In the meantime, I used a hacky workaround as jyygang0 suggested to make it work. I only wanted to test the tool. Yes, that would be a workaround, but not very convenient, as finding the checkout location is not straightforward and AFAIK it can change (for instance after cleaning the derived data folder)
+1 that I'm also experiencing this issue while not using a Package.swift
file and instead adding the dependency directly in the project. The symbolic link workaround worked for me as well but this blocks our CI from doing the same thing.
Hi,
When running
figma connect
commands in my Xcode project root directory, I get the following:It fails because
code-connect
is not checked out to this location. I am using Swift Package Manager (SPM) and the actual location is:Looking at your implementation, I see the following steps are occurring:
xcodeProjFile
is being defined viagetFileIfExists(cwd, '*.xcodeproj')
xcodebuild -project ${xcodeProjFile} -showBuildSettings
is being run to determine:BUILD_DIR
is (/Users/jordikitto/Repos/<project>/build
)/Users/jordikitto/Repos/<project>/build/../../SourcePackages/checkouts/code-connect
Again, unfortunately, this path is not the correct location. The correct location is in the DerivedData folder located above.
From my understanding, this is because of Swift Package Manager checking out the repo? Does Code Connect support SPM installation? If not, what is the correct way to use Code Connect with Xcode projects/workspaces?
Happy to provide any further details.
--
I did manage to get Code Connect to work with a hack symbolic link, for reference:
Please provide:
1.0.6