Hello everyone,
Using the latest Tuist version. I have a private repository with framework A created via Tuist. Framework B and the app are also built using Tuist. Framework B depends on A, and the app depends on B. After running tuist install --update
, all dependencies are fetched. Importing frameworkA
in the app works without errors, but inside framework B, importing frameworkA
causes a compiler error — code from A is not visible. To fix this, I had to make repository A public. Is there a way to keep repository A private and avoid the compilation error?
Thanks in advance for your help!
How is FrameworkB integrating FrameworkA? Using SwiftPM? Would you mind expanding a bit how the dependencies between different targets are declared?
Hi! Thanks for the follow-up. The integration of dependencies is done via Swift Package Manager. For example, in App
’s Package.swift
, I declare a dependency on Bframework
like this:
// swift-tools-version: 6.0
import PackageDescription
#if TUIST
import struct ProjectDescription.PackageSettings
let packageSettings = PackageSettings(
productTypes: [
"Bframework": .framework
]
)
#endif
let package = Package(
name: "App",
products: [
.library(name: "App", targets: ["App"])
],
dependencies: [
.package(url: "https://github.com/Alexandr-Ivantsov/Bframework.git", .upToNextMajor(from: "1.0.0"))
],
targets: [
.target(name: "App", dependencies: [
"Bframework"
])
]
)
In Project.swift
, I add Bframework
using .external(name: "Bframework")
.
Similarly, Bframework
depends on Aframework
declared like this in Bframework
’s Package.swift
:
// swift-tools-version: 6.0
import PackageDescription
#if TUIST
import struct ProjectDescription.PackageSettings
let packageSettings = PackageSettings(
productTypes: [
"Aframework": .framework
]
)
#endif
let package = Package(
name: "Bframework",
products: [
.library(name: "Bframework", targets: ["Bframework"])
],
dependencies: [
.package(url: "https://github.com/Alexandr-Ivantsov/Aframework.git", .upToNextMajor(from: "1.0.0"))
],
targets: [
.target(name: "Bframework", dependencies: [
"Aframework"
])
]
)
And again, in Project.swift
, I add Aframework
via .external(name: "Aframework")
.
The Aframework
package itself looks like this:
// swift-tools-version: 6.0
import PackageDescription
#if TUIST
import struct ProjectDescription.PackageSettings
let packageSettings = PackageSettings(
productTypes: [:]
)
#endif
let package = Package(
name: "Aframework",
products: [
.library(name: "Aframework", targets: ["Aframework"])
],
dependencies: [],
targets: [
.target(name: "Aframework", dependencies: [])
]
)
Just to clarify, App, Bframework, and Aframework are placeholder names to illustrate the setup — the actual libraries and app in my project have different names. The core of the issue remains the same with my private repositories: I can import the framework at the app level, but inside the intermediate framework it fails unless the dependency is made public.
When you say public, do you mean making the repository public? That should have no effect on the build – after you run tuist install
, all the packages you depend on should be locally resolved and during tuist generate
, we only look up packages in the Tuist/.build
directory.
I’d double check you end up resolving the right packages. Otherwise, if you can create a reproducible sample, that would enable us to look into this further.
Thank you very much for your help! I managed to solve the issue with the private repository by adding my main.swift
and AppDelegate.swift
files, which I had overlooked earlier. I believe that was the cause of the problem. Appreciate your guidance!