https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

Azur Haljeta

11/28/2020, 1:47 PM
The
frameworkName
specified in
cocoapods{}
is ignored when building the
.podspec
file via
./gradlew podspec
. It uses the name of the gradle project, which is also the default value. Any ideas?
a

Artyom Degtyarev [JB]

11/30/2020, 8:15 AM
Hello, @Azur Haljeta! This is strange, can you please share a project to play with?
a

Azur Haljeta

12/02/2020, 8:13 AM
@Artyom Degtyarev [JB] thanks for reaching out. It's easy to reproduce as there is nothing specific about it. Basically, create a blank new KMM project and integrate CocoaPods then. Here's a repository which is created just like that: https://github.com/azurqsd/PodRename I think that this line is sporadic: https://github.com/azurqsd/PodRename/blob/main/shared/shared.podspec#L2 I expect this to match the value configured here: https://github.com/azurqsd/PodRename/blob/main/shared/build.gradle.kts#L23
a

Artyom Degtyarev [JB]

12/04/2020, 1:40 PM
Finally managed to take a look at this. Here goes the problem - the project is using KMM Application from AS wizard as a base. This mean a lot of Xcode project aspects are configured to work with no CocoaPods integration. I mean, it is still trying to utilize framework named
shared
, located in /shared/build/xcode-frameworks/, execute
packForXcode
script. I would guess this is the reason you see the wrong name - iosApp.xcodeproj is still looking for it and remembering it. I’ve written an instruction on making standard project usable with cocoapods some time ago, maybe you could look it through for some advice. It can be found here.
a

Azur Haljeta

12/04/2020, 2:23 PM
thanks @Artyom Degtyarev [JB] I've tried the fixes in the ticket above, but it seems to me that you haven't understood the issue correctly. I want to rename the pod. The 
frameworkName
 specified in 
cocoapods{}
 is ignored when building the 
.podspec
 file via 
./gradlew podspec
 . It uses the name of the gradle project, which is also the default value. If I have
frameworkName = MyOwnPod
in the
cocoapods{}
block, I also want to reference that same pod in the
Podfile
like this:
pod 'MyOwnPod', :path => '../shared'
. But I'm not able to do this since
shared.podspec
has
spec.name
equal to
'shared'
I have a feeling that this shouldn't be related to Xcode? It's up to the cocoapods gradle plugin which generates the
.podspec
file
🤔 1
Because other properties from
cocoapods{}
are parsed well in the
.podspec
file. For example,
spec.summary
is set to '`A nice pod'` which is exactly what's specified in
cocoapods { summary }
. It's the same for other properties - but not for
frameworkName
a

Artyom Degtyarev [JB]

12/04/2020, 3:16 PM
Yes, you are completely right! The thing is, deriving spec.name from project’s name is now hard-coded into the plugin(see here and here). I was unable to find a corresponding issue on YouTrack. Please create one, if possible. From the current state of things, maybe it will be a good advice to change podspec contents directly, by hand or Gradle task(operating it as an ordinary text file). Not sure how it would affect the project, but it’s the only idea I get right now.
a

Azur Haljeta

12/04/2020, 3:18 PM
@Artyom Degtyarev [JB] thanks for the quick reply and for the advice. I'll open a ticket and reference it here as well.
🙏 1
Here's the ticket url for reference: https://youtrack.jetbrains.com/issue/KT-43815