https://kotlinlang.org logo
#touchlab-tools
Title
# touchlab-tools
t

Tushar Saha

01/25/2023, 9:12 AM
Hi team, I’m trying to get a build locally from
KMMBridgeKickStart
by running
./gradlew spmDevBuild
and importing the
KMMBridgeKickStart.xcframework
build to an existing Xcode project but seems that Xcode doesn’t find
allshared
reference. Except editing the
GROUP
in gradle.properties, I didn’t do any other configuration setup. Do I need the SPM setup from this page prior to run the
spmDevBuild
task? My team is trying to have a local setup to distribute the
xcframework
with iOS without setting up the entire CI infra (one of the reason is we use Gitlab). Any help please? TIA 🙂
k

kpgalligan

01/25/2023, 2:19 PM
How did you import the xcframework? I haven’t tried directly importing an xcframework. For local spm dev, you’d want to drag the folder in, so Xcode sees the
Package.swift
, but TBH, it’s been a little while since we’ve done only local SPM dev. For KMMBridge, it’s in the context of a published binary, so there may be simpler ways to do it. We do have a fully local dev build for one of our client projects, but we’d need to sync up with them for a better answer.
l

Landry Norris

01/25/2023, 3:02 PM
My team used a local Swift Package for a while before switching to a remote Cocoapod setup. The best way we found was to go to XCode: file -> Add Packages -> Add Local -> Select the package.swift, then click the target (top of the xcode navigation) -> General -> ‘Frameworks, Libraries, and embedded content’ -> + -> Select your package, then Build Phases -> Link Binary with Libraries -> + -> Select your package.
Every once in a while, if the package is not present when you open XCode, it will automatically remove the Link Binary with Libraries selection and you’ll have to repeat the process.
If you’re just trying to avoid CI, you can create another GitLab repo and manually publish a cocoapod/swift package locally and push it to that repo.
t

Tushar Saha

01/25/2023, 3:47 PM
Thanks Kevin and Landry for the detail explanation. Landry, I’m following the instructions you provided but Finder doesn’t allow me to select the package.swift file rather forces me select the entire project (there are 2 package.swift files, one is at the root and another is inside the
allshared
module). To go forward, I select the entire project so that Xcode can recognise the package.swift at the root (which has the local build path to xcframework written). Next, in Frameworks, Libraries, and embedded content option from the General tab, It doesn’t show the framework available meaning was not successfully imported to the project. Is there anything I’m missing?
l

Landry Norris

01/25/2023, 3:48 PM
It’s been a while, but I can check again to make sure I didn’t forget anything.
Looks like you should select the folder that has the Package.swift in it, not the file itself. Make sure you select the right project under ‘Add to project’
Interestingly, I see the same. Following the steps in the old document doesn’t seem to work. I wonder if this is another XCode 14 issue? XCode 14's been causing a lot of headaches.
t

Tushar Saha

01/25/2023, 4:17 PM
do you use the command
./gradlew spmDevBuild
or something else to get the xframework build?
l

Landry Norris

01/25/2023, 4:18 PM
I used an older gradle plugin called multiplatform-swift-package, since this project is older than KMM-Bridge. The spmDevBuild should work similarly.
k

kpgalligan

01/25/2023, 4:19 PM
spmDevBuild
is specific to KMMBridge, so for sure you’d need to be using that for that task to show up. There’s also a flag to pass in so you only build the target you want. It’s a bit hacky, but it is the fastest dev turnaround you can do locally.
KMMBridge was designed mostly for CI, so it’ll do release builds by default, but the local spm dev was added because we wanted something that minimally worked. That task does a debug build, which you want for local dev.
l

Landry Norris

01/25/2023, 4:20 PM
+1 on using a flag to build only the current target. My builds took 10+ minutes usually using the multiplatform-swift-package plugin.
k

kpgalligan

01/25/2023, 4:20 PM
We have another release that needs to go out that does a better job of separating local and CI dev. Long story.
37 Views