I’m trying to build an umbrella framework that bun...
# ios
a
I’m trying to build an umbrella framework that bundles two subprojects. Here’s my project structure:
Copy code
|- shared-libraries
 \- network
  |- network-core
  |  |- src
  |  |  \- commonMain
  |  \- build.gradle.kts
  |
  |- network-ktor
  |  |- src
  |  |   \- commonMain
  |  \- build.gradle.kts
  |
   \- build.gradle.kts
The
network
module build script has the following dependencies: •
api(project(":shared-libraries:network:network-core"))
api(project(":shared-libraries:network:network-ktor"))
Basically,
network
is an umbrella module that contains no source code. For Android, all works fine. I’m able to import
:shared-libraries:network
without issues. For iOS, I’m leveraging
FatFrameworkTask
(registered as
fatFramework
) to build the umbrella framework. When I run
./gradlew :shared-libraries:network:fatFramework
, Gradle compiles the code but it doesn’t create any iOS framework. I’m not sure why. Is there a better/easier way to create an iOS umbrella framework for a project structure like the one above?
r
You might need to add a source file to
network
. Can be empty.
a
Will try that. Thanks!
r
Alternatively, you might need to explicitly export the project dependencies in your framework block
a
I have
export(project(":shared-libraries:network:network-core"))
and
export(project(":shared-libraries:network:network-ktor"))
in the
network
script file. Gradle compiles the source code but it look like the link step is never executed.
Adding a source file to
network
is actually triggering
linkDebugFrameworkIosSim
. simple smile Now, I need to solve the following error:
Copy code
Following dependencies exported in the debugFramework binary are not specified as API-dependencies of a corresponding source set
r
oh yeah I guess you needed both those things 🙂
That error sounds like it's not seeing your framework exports as the same thing as the project dependencies. Not sure why that would be off-hand
Might be you need to use the groupartifactversion syntax instead of project
a
I’ll try that and see what happens.
Actually, during my tests, I ended up adding
export(project(":shared-libraries:network:network-core"))
. Which was likely the reason of the above Gradle error (I guess due to a circular dependency).
Adding an empty source file, as you initially suggested, appears to do the trick. Gradle is now generating
granular_auth.framework
.
r
nice!
a
Thanks again @russhwolf!
👍 1
s
Also please avoid using
network
as module name. There are known issues in stable releases, it might clash with
Network
platform library.
a
Will do. Thanks!