I’m struggling with linking multiple gradle module...
# kotlin-native
p
I’m struggling with linking multiple gradle modules together. I have 3 gradle modules that I want to merge into a single ios framework. How would I do that? Right now I have created an
ios
gradle module that just depends on the 3 modules:
Copy code
kotlin {
  sourceSets {
    named("iosMain") {
      dependencies {
        api(project(":percent-distribution"))
        api(project(":podcast"))
        api(project(":units"))
      }
    }
  }
}
But that produces no frameworks
a
p
Thanks. I tried to adopt that but it generates nothing in the bin folder
a
Did you run
<target_name>MainBinaries
task?
p
There is no Mainbinaries task
a
Like iosX64MainBinaries ? It should be there, if you configured binaries correctly
p
Copy code
Build tasks
-----------
allMetadataJar - Assembles a jar archive containing the metadata for all Kotlin source sets.
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
clean - Deletes the build directory.
compileKotlinIos - Compiles a klibrary from the 'main' compilation for target 'native'.
compileTestKotlinIos - Compiles a klibrary from the 'test' compilation for target 'native'.
iosMainKlibrary - Assembles outputs for compilation 'main' of target 'ios'
iosTestKlibrary - Assembles outputs for compilation 'test' of target 'ios'
jvmJar - Assembles an archive containing the main classes.
jvmMainClasses - Assembles outputs for compilation 'main' of target 'jvm'
jvmTestClasses - Assembles outputs for compilation 'test' of target 'jvm'
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'.
metadataCommonMainClasses - Assembles outputs for compilation 'commonMain' of target 'metadata'
metadataJar - Assembles an archive containing the main classes.
metadataMainClasses - Assembles outputs for compilation 'main' of target 'metadata'
These are the tasks avilable for the ios module
I can run ./gradlew ios:iosMainBinaries but it generates nothing in the build folder
a
Perhaps you should setup for each target. iosX64 and iosArm64
There is no such a target
ios
p
Hm thats the same. 😞
Oh wow what a crap 😄
This is the solution 🙈
a
Ah yes! Totally forgot about this 😀
r
I don’t know if there’s an issue tracking that but I’m pretty sure JB is aware. The updated new project wizard adds an empty dummy source file to iOS targets in shared code when you also included an iOS application module.