Bradleycorn
11/20/2023, 6:02 PMisStatic = false
).
I tried that, but that leads to additional (worse) problems. My framework cannot be found at all.
Has anyone else run into this? Is there a solution/workaround?kpgalligan
11/21/2023, 1:54 PMBradleycorn
11/21/2023, 2:00 PMNote: It is highly recommended that you run(That leads me to another question, but I’ll post that separately) Once I did that, it fixed those other problems and my previews are working in xcode too. I’m publishing a new version of my library with dynamic linking enabled right now and we’ll see if that takes care of it. 🤞orlinkPodDebugFrameworkIosX64
, depending on your Mac architecture, before you runlinkPodDebugFrameworkIosSimulatorArm64
, due to a minor issue with the Kotlin CocoaPods integration.pod install
kpgalligan
11/21/2023, 2:06 PMI’m publishing a new version of my library with dynamic linking enabled right now and we’ll see if that takes care of it.This is kind of a special case as you're using previews in dev, but using KMMBridge to publish, which defaults to more of a "release" use case. The build defaults to RELEASE. that kind of thing. That should work fine, but I'm starting to think through maybe different KMMBridge config for dev vs release uses. In production, I generally prefer static frameworks. It's not a huge deal, but I could see wanting dynamic in dev, to get SwiftUI previews, and static in release builds.
kpgalligan
11/21/2023, 2:07 PM> Note: It is highly recommended that you runThat's a Kotlin thing, just FYI. Has nothing to do with KMMBridge.orlinkPodDebugFrameworkIosX64
, depending on your Mac architecture, before you runlinkPodDebugFrameworkIosSimulatorArm64
, due to a minor issue with the Kotlin CocoaPods integration.pod install
Bradleycorn
11/21/2023, 2:10 PMbut I’m starting to think through maybe different KMMBridge config for dev vs release usesThat would seem like a good idea. if I understand things correctly, a statically linked framework loads faster, which would be nice in a release build. So being able to do dynamically linked debug builds and statically linked release builds might be desireable.
kpgalligan
11/21/2023, 2:11 PMa statically linked framework loads fasterYes, generally. There's also the potential for a smaller overall binary size if the compiler can do some more DCE, although in practice, that is usually not significant, assuming you don't have tons of code that never gets called.
Bradleycorn
11/21/2023, 2:16 PMisStatic = true
by default, and then in the podspec that is genertated for the local dev flow, set it up to pass in a property to the gradle task it runs to build the framework, and use that to set isStatic = false
??kpgalligan
11/21/2023, 2:20 PMisStatic=prodBuild
and
kmmbridge {
buildType.set(if(prodBuild){RELEASE}else{DEBUG})
}
Bradleycorn
11/21/2023, 2:20 PMkpgalligan
11/21/2023, 2:20 PMBradleycorn
11/21/2023, 2:20 PMkpgalligan
11/21/2023, 2:21 PMkpgalligan
11/21/2023, 2:22 PMBradleycorn
11/21/2023, 2:22 PMBradleycorn
11/21/2023, 2:27 PMxcodeConfigurationToNativeBuildType["TS-DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["DK-DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["KS-DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["OA-DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["BA-DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["TS-PROD"] = NativeBuildType.RELEASE
xcodeConfigurationToNativeBuildType["DK-PROD"] = NativeBuildType.RELEASE
xcodeConfigurationToNativeBuildType["KS-PROD"] = NativeBuildType.RELEASE
xcodeConfigurationToNativeBuildType["OA-PROD"] = NativeBuildType.RELEASE
xcodeConfigurationToNativeBuildType["BA-PROD"] = NativeBuildType.RELEASE
I tried and tried to figure out a way to do something effectively like:
if (configuration.endsWith("DEBUG")) {
NativeBuildType.DEBUG
} else {
NativeBuildType.RELEASE
}
But I couldn’t come up anything. Any ideas?kpgalligan
11/21/2023, 2:30 PMconfiguration
would be one of the values listed in the keys for xcodeConfigurationToNativeBuildType
? Does the xcodeConfigurationToNativeBuildType
map work? If so, I don't see why if (configuration.endsWith("DEBUG"))
wouldn't be correct. Try logging out configuration
.Bradleycorn
11/21/2023, 2:33 PMxcodeConfigurationToNativeBuildType
does work, it’s just verbose, and everytime I add a new “product flavor”, I have to remember to add it to the library config as well.
Assuming configuration
has what I need, would I then just set the build type in the kmmbridge config block, like this?
kmmbridge {
buildType.set( if(configuration).... )
...
}
kpgalligan
11/21/2023, 3:00 PMconfiguration
is. That's what I was asking. Where is that coming from? What's the value? I don't see why your if statement wouldn't work, so I'm trying to figure this out.Bradleycorn
11/21/2023, 3:08 PM