Description
We have started using Kotlin Multiplatform (KMP) as an external library for our project. Everything works fine locally, and resources are accessible when using CocoaPods and referencing the local KMP project. However, when we publish the pod to Artifactory using the podPublishReleaseXCFramework command, the resources (e.g., localized strings) are not available in the iOS code.
Steps to Reproduce
Add localized strings as resources to be shared across all platforms.
Use CocoaPods to reference the local KMP project in the Podfile:
pod 'shared', :path => '../shared'
Run pod install and verify that the resources are available and accessible in the iOS code.
Publish the pod to Artifactory using the following process:
val versionName: String = "0.1.1"
println("Version name: $versionName")
val cocoapodDir: String = project.layout.buildDirectory.dir("cocoapods/publish").get().toString()
val artifactApiKey: String = artifactoryCocoapodsApiKey
val artifactUrl = "${artifactoryCocoapodsUrl}ios-libs-releases-local/Shared/$versionName/"
val tarFileName = "shared.tar.gz"
// Instructions
val changeToDirectory = "cd $cocoapodDir"
val listDirectoryContent = "ls"
val archiveReleaseDirectoryContent = "tar -czvf $tarFileName -C release \$(ls release)"
val printUploadMessage = "echo 'Now, upload the file to the artifact $artifactUrl'"
val uploadFileToRepo =
"curl -H 'X-JFrog-Art-Api:$artifactApiKey' -XPUT $artifactUrl -T $tarFileName"
val printRemoveMessage = "echo 'now, remove the file from local'"
val removeArchive = "rm $tarFileName"
exec {
commandLine("sh", "-c", "" +
"$changeToDirectory && " +
"$listDirectoryContent && " +
"$archiveReleaseDirectoryContent && " +
"$printUploadMessage && " +
"$uploadFileToRepo && " +
"$printRemoveMessage && " +
"$removeArchive"
)
}
Generated Podspec
Pod::Spec.new do |spec|
spec.name = 'shared'
spec.version = '0.1.1'
spec.homepage = ''
spec.source = { :http => '' }
spec.authors = ''
spec.license = { :type => 'MIT', :text => 'License text' }
spec.summary = 'Some description for a Kotlin/Native module'
spec.vendored_frameworks = 'build/cocoapods/framework/shared.framework'
spec.libraries = 'c++'
spec.ios.deployment_target = '13.0'
if !Dir.exist?('build/cocoapods/framework/shared.framework') || Dir.empty?('build/cocoapods/framework/shared.framework')
raise "
Kotlin framework 'shared' doesn't exist yet, so a proper Xcode project can't be generated.
'pod install' should be executed after running ':generateDummyFramework' Gradle task:
./gradlew :shared:generateDummyFramework
Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
end
spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':shared',
'PRODUCT_MODULE_NAME' => 'shared',
}
spec.script_phases = [
{
:name => 'Build shared',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
exit 0
fi
set -ev
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
-Pkotlin.native.cocoapods.archs="$ARCHS" \
-Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
SCRIPT
}
]
spec.resources = ['build/compose/cocoapods/compose-resources']
end
Expected Behavior
The resources, such as localized strings, should be available and accessible in the iOS project both when using the local KMP project and when using the published version from Artifactory.
Actual Behavior
The resources are available and accessible when using the local KMP project. However, after publishing the pod to Artifactory and using the published version, the resources are not available in the iOS project.
Additional Information
Any insights or solutions to ensure the resources are included and accessible when the pod is published to Artifactory would be greatly appreciated.
Description We have started using Kotlin Multiplatform (KMP) as an external library for our project. Everything works fine locally, and resources are accessible when using CocoaPods and referencing the local KMP project. However, when we publish the pod to Artifactory using the
podPublishReleaseXCFramework
command, the resources (e.g., localized strings) are not available in the iOS code.Steps to Reproduce
Podfile
:pod 'shared', :path => '../shared'
pod install
and verify that the resources are available and accessible in the iOS code.Generated Podspec
Expected Behavior The resources, such as localized strings, should be available and accessible in the iOS project both when using the local KMP project and when using the published version from Artifactory.
Actual Behavior The resources are available and accessible when using the local KMP project. However, after publishing the pod to Artifactory and using the published version, the resources are not available in the iOS project.
Additional Information Any insights or solutions to ensure the resources are included and accessible when the pod is published to Artifactory would be greatly appreciated.