einar
09/26/2019, 1:06 PMNo enum constant org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.PREPROD
. (Im using cocoapods)Kris Wong
09/26/2019, 1:26 PMKris Wong
09/26/2019, 1:27 PMeinar
09/26/2019, 1:50 PMKris Wong
09/26/2019, 1:53 PMKris Wong
09/26/2019, 1:53 PMeinar
09/26/2019, 3:00 PMilya.matveev
09/27/2019, 9:02 AMI’d be fine if it would just use release framework for preProd but I cannot figure out how.Currently adding a custom configuration (aka build type) to an MPP project is not supported. But you can edit a podspec generated by the CocoaPods plugin. The MPP build is started from a regular script phase (see
spec.script_phases
in the generated podspec). This script starts a Gradle build parametrized by the build configuration:
$REPO_ROOT/gradlew ::syncFramework -Pkotlin.native.cocoapods.configuration=$CONFIGURATION
Since it's just a shell script, you can add a custom logic and set kotlin.native.cocoapods.configuration
to RELEASE
, if a preProd
build is being executed.einar
09/27/2019, 9:11 AM-Pkotlin.native.cocoapods.configuration="${CONFIGURATION/Release}"
when building my PreProd configuration I still get the same error (ive done pod install in between)einar
09/27/2019, 9:28 AM-Pkotlin.native.cocoapods.configuration="Release"
it worked!Kris Wong
09/27/2019, 12:53 PM-Pkotlin.native.cocoapods.configuration="${CONFIGURATION/Secure}"
Kris Wong
09/27/2019, 12:53 PMdarkmoon_uk
01/04/2021, 10:47 AMStaging
configuration and failed - I'll use the podspec workaround too, but feels like this could be supported more gracefully.... production Apps often want to define extra configurations.louiscad
01/04/2021, 1:44 PMMayank
01/10/2021, 5:59 PMdarkmoon_uk
01/11/2021, 7:31 AMpodspec
file, including the Gradle invocation to build the shared framework.darkmoon_uk
01/11/2021, 7:32 AMnoPodspec()
in the cocoapods {...}
section to prevent the podspec
file being overwritten - and to keep this change:
spec.script_phases = [
{
:name => 'Build shared',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
set -ev
[ $CONFIGURATION == "Staging" ] && KOTLIN_CONFIG="RELEASE" || KOTLIN_CONFIG="$CONFIGURATION"
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" :shared:syncFramework \
-Pkotlin.native.cocoapods.target=$KOTLIN_TARGET \
-Pkotlin.native.cocoapods.configuration=$KOTLIN_CONFIG \
-Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS" \
-Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS" \
-Pkotlin.native.cocoapods.paths.frameworks="$FRAMEWORK_SEARCH_PATHS"
SCRIPT
}
svyatoslav.scherbina
01/11/2021, 8:14 AMIs there any YouTrack issue for that?https://youtrack.jetbrains.com/issue/KT-42023?