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

Lukasz Kalnik

12/01/2021, 1:51 PM
When I change the shared module, what Gradle task can I use to rebuild the shared Framework for XCode to notice the changes?
s

Stefan Oltmann

12/01/2021, 4:12 PM
Copy code
assembleSharedReleaseXCFramework
l

Lukasz Kalnik

12/01/2021, 4:29 PM
Hmm, task not found...
Copy code
Build tasks
-----------
assemble - Assemble main outputs for all the variants.
assembleAndroidTest - Assembles all the Test applications.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildKotlinToolingMetadata - Build metadata json file containing information about the used Kotlin tooling
buildNeeded - Assembles and tests this project and all projects it depends on.
clean - Deletes the build directory.
compileDebugAndroidTestSources
compileDebugSources
compileDebugUnitTestSources
compileKotlinIos - Compiles a klibrary from the 'main' compilation for target 'native'.
compileReleaseSources
compileReleaseUnitTestSources
compileTestKotlinIos - Compiles a klibrary from the 'test' compilation for target 'native'.
extractDebugAnnotations - Extracts Android annotations for the debug variant into the archive file
extractReleaseAnnotations - Extracts Android annotations for the release variant into the archive file
iosMainKlibrary - Assembles outputs for compilation 'main' of target 'ios'
iosTestKlibrary - Assembles outputs for compilation 'test' of target 'ios'
linkDebugFrameworkIos - Links a framework 'debugFramework' for a target 'ios'.
linkDebugTestIos - Links a test executable 'debugTest' for a target 'ios'.
linkReleaseFrameworkIos - Links a framework 'releaseFramework' for a target 'ios'.
metadataJar - Assembles an archive containing the main classes.
metadataMainClasses - Assembles outputs for compilation 'main' of target 'metadata'
Currently I just click the "Run iosApp" button. The app obviously fails, but the framework is built and then I can make relevant changes in XCode. But there should be a "cleaner" way.
s

Stefan Oltmann

12/01/2021, 5:21 PM
Do you have a XCFramework configured? This is my config:
Copy code
val xcf = XCFramework()

/* App Store */
iosArm64 {
    binaries.framework {
        baseName = "shared"
        embedBitcode("bitcode")
        xcf.add(this)
    }
}

/* Intel iOS Simulator */
iosX64 {
    binaries.framework {
        baseName = "shared"
        xcf.add(this)
    }
}
That should add an
assemble*Shared*ReleaseXCFramework
if your framework also is named "shared".
l

Lukasz Kalnik

12/01/2021, 5:22 PM
Ah ok
I have the default setup generated by the KMM plugin
Copy code
iosTarget("ios") {
        binaries {
            framework {
                baseName = "shared"
            }
        }
    }
I will add the xcf setup, thanks!
8 Views