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

kevinskrei

12/17/2020, 7:25 PM
Does anyone know how I can resolve an issue running
pod lib lint
on the podspec for a kotlin native mpp project? I have the framework built in the
build/cocoapods/framework
folder successfully. I'm looking to deploy it to our private pod repo. I run
pod lib lint
on the podspec and it errors out at:
- ERROR | xcodebuild: Returned an unsuccessful exit code.
Copy code
/bin/sh -c /Users/kevinskrei/Library/Developer/Xcode/DerivedData/App-bvyatnpkzbcdlihdrsoatdifsqvt/Build/Intermediates.noindex/Pods.build/Release-watchsimulator/arccosAbShared.build/Script-46EB2E000002E0.sh
                    REPO_ROOT="$PODS_TARGET_SRCROOT"
                    "$REPO_ROOT/../gradlew" -p "$REPO_ROOT" :shared:syncFramework                     -Pkotlin.native.cocoapods.target=$KOTLIN_TARGET                     -Pkotlin.native.cocoapods.configuration=$CONFIGURATION                     -Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS"                     -Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS"                     -Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Gradle could not start your build.
    > Could not create service of type CrossBuildFileHashCache using BuildSessionServices.createCrossBuildFileHashCache().
       > Failed to create parent directory '/.gradle' when creating directory '/.gradle/6.4.1/fileHashes'
Has anyone run into this before when trying to publish a pod? This is using the pod spec from the cocoapods plugin
a

Artyom Degtyarev [JB]

12/21/2020, 9:06 AM
Hello, @kevinskrei! The problem looks like the Gradle cannot create its cache folder at the
<ProjectDir>/.gradle
. Does this directory exist when you open the project directory with Finder?
k

kevinskrei

12/21/2020, 4:30 PM
@Artyom Degtyarev [JB] thank you for responding. Yes, it does exist and contains a few folders like 6.4.1, checksums, and buildOutputCleanup. I also tried deleting it and that did not resolve the issue
However, the
.gradle
is folder is that the root of the project and I'm running
pod lib lint
from the shared directory of the project where the podspec is. I wonder if that could be the issue.
project/shared/podspec
It looks like in the podspec it has this:
Copy code
REPO_ROOT="$PODS_TARGET_SRCROOT"
                "$REPO_ROOT/../gradlew" -p "$REPO_ROOT" :shared:syncFramework
Do I need to change the REPO_ROOT path if running this from inside a shared directory?
a

Artyom Degtyarev [JB]

12/22/2020, 8:29 AM
Yes I’m also thinking that incorrect
$PODS_TARGET_SRCROOT
contents. As far as I can get, this should be resolved to
project/shared
automatically. Found several issues on the CocoaPods GH(like this one: https://github.com/CocoaPods/CocoaPods/issues/7905), but I’m not sure how exactly this should be changed to work as expected.
v

Vitor Prado

03/22/2021, 7:04 PM
@kevinskrei did you solved the issue?
k

kevinskrei

03/22/2021, 8:58 PM
@Vitor Prado I did not. I abandoned the MPP because of this. But will probably revisit soon
v

Vitor Prado

03/22/2021, 9:01 PM
i found a solution:
Copy code
Pod::Spec.new do |spec|
    spec.name                     = '...'
    spec.version                  = "1.0.0"
    spec.homepage                 = '<https://github.com/org/name>'
    spec.source                   = { :git => 'git@github.com:org/name.git',
                                      :tag => "#{spec.version}"
                                    }
    spec.authors                  = { }
    spec.summary                  = '...'

    spec.static_framework         = true
    spec.vendored_frameworks      = "pods/name.framework"
    spec.framework                = 'name'
    spec.libraries                = "c++"
    spec.module_name              = "#{spec.name}_umbrella"

    spec.platform = :ios
    spec.ios.deployment_target = '13.5'

    spec.pod_target_xcconfig = {
        'KOTLIN_TARGET[sdk=iphonesimulator*]' => 'ios_x64',
        'KOTLIN_TARGET[sdk=iphoneos*]' => 'ios_arm'
    }

    spec.prepare_command = <<-SCRIPT
        set -ev
        ./gradlew --no-daemon -Pframework=#{spec.name}.framework linkReleaseFrameworkIos --stacktrace --info
        cp -R name/build/bin/ios/releaseFramework/name.framework pods/name.framework
        SCRIPT
end
with this I can generate and push to private repo without problems
👍 1
👀 1
95 Views