Isolating kotlin api called by swift to iosapi module to improve compile time
From 14 minutes to 15 seconds!
This commit is contained in:
54
iosapi/iosapi.podspec
Normal file
54
iosapi/iosapi.podspec
Normal file
@@ -0,0 +1,54 @@
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'iosapi'
|
||||
spec.version = '1.0.0'
|
||||
spec.homepage = 'https://example.com'
|
||||
spec.source = { :http=> ''}
|
||||
spec.authors = ''
|
||||
spec.license = ''
|
||||
spec.summary = 'iOS facade'
|
||||
spec.vendored_frameworks = 'build/cocoapods/framework/shared.framework'
|
||||
spec.libraries = 'c++'
|
||||
spec.ios.deployment_target = '14.0'
|
||||
spec.dependency 'GoogleMaps'
|
||||
|
||||
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 :iosapi:generateDummyFramework
|
||||
|
||||
Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
|
||||
end
|
||||
|
||||
spec.xcconfig = {
|
||||
'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
|
||||
}
|
||||
|
||||
spec.pod_target_xcconfig = {
|
||||
'KOTLIN_PROJECT_PATH' => ':iosapi',
|
||||
'PRODUCT_MODULE_NAME' => 'shared',
|
||||
}
|
||||
|
||||
spec.script_phases = [
|
||||
{
|
||||
:name => 'Build iosapi',
|
||||
: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
|
||||
}
|
||||
]
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user