Hello :wave: Im using <KonfigBuild> , and I want t...
# multiplatform
i
Hello 👋 Im using KonfigBuild , and I want to pass the build flavor when xcode build using
-Pbuildkonfig.flavor=flavor
so I added
noPodspec()
to cocoapods {} in build.gradle.kts and manually edit shared.podspec -Pbuildkonfig.flavor=flavor to the build phase hardcoding the flavor is working but I want to set ENV VAR from the target in xcode, is it possible?
Copy code
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" \
                    -Pbuildkonfig.flavor=$APP_ENV
            SCRIPT
        }
    ]
Another question Is it possible to customize the
script_phases
from build.gradle so I can keep the podspec gen?
a
Yes, something like this should work:
Copy code
tasks.withType<org.jetbrains.kotlin.gradle.tasks.PodspecTask>().configureEach {
    doLast {
        editScriptPhases(outputFile)
    }
}
i
Thanks! will need to work on a podspec de/serializer 😬 will be a weekend activity