Try to tighten up the project for another project by using Tuist

Question or Problem

I am having trouble connecting the library AAATuist from a remote repository to my project BBBTuist using Tuist. I can’t figure out what exactly is wrong with my Tuist configuration. I’ve been working on this issue for several days now, and I would appreciate any help.

Expectation

I expected that Tuist would allow me to easily integrate AAATuist as an external dependency into my BBBTuist project without encountering errors.

Context

  • Tuist version: 4.38.1

I was trying to set up my project and link it with AAATuist when I stumbled upon the issue.

Reproduction

Here’s the code I am working with:

import PackageDescription

#if TUIST
    import struct ProjectDescription.PackageSettings

    let packageSettings = PackageSettings(
        productTypes: [:]
    )
#endif

let package: Package = .init(
    name: "AAATuist",
    dependencies: []
)

import ProjectDescription

let project = Project(
    name: "AAATuist",
    targets: [
        .target(
            name: "AAATuist",
            destinations: .iOS,
            product: .framework,
            bundleId: "RI.AAATuist",
            infoPlist: .default,
            sources: ["AAATuist/Sources/**/*.swift"],
            dependencies: []
        )
    ]
)

import PackageDescription

#if TUIST
import struct PackageDescription.PackageSettings

let packageSettings: PackageSettings = [
    productTypes: ["AAATuist": .framework]
]
#endif

let package: Package = .init(
    name: "BBBTuist",
    dependencies: [
        .package(url: "https://github.com/Alexandr-Ivantsov/AAA.git", branch: "main")
    ]
)

import ProjectDescription

let project = Project(
    name: "BBBTuist",
    targets: [
        .target(
            name: "BBBTuist",
            destinations: .iOS,
            product: .app,
            bundleId: "RI.BBBTuist",
            infoPlist: .default,
            sources: ["BBBTuist/Sources/**/*.swift"],
            dependencies: [
                .external(name: "AAATuist")
            ]
        )
    ]
)

tuist generate
Loading and constructing the graph
It might take a while if the cache is empty
`AAATuist` is not a valid configured external dependency

If you need any additional information to assist with my issue, I would be happy to provide it.

Additionally, I want to mention that both AAATuist and BBBTuist are empty projects I created manually. Each project has its own Package.swift, Project.swift, and a Sources folder. In the Sources folder, I included AppDelegate.swift and main.swift with the following code:

import UIKit

UIApplicationMain(
    CommandLine.argc,
    CommandLine.unsafeArgv,
    nil,
    NSStringFromClass(AppDelegate.self)
)

import UIKit

class AppDelegate: UIResponder, UIApplicationDelegate {
    
    var window: UIWindow?
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.rootViewController = UIViewController()
        window?.makeKeyAndVisible()
        
        return true
    }
}

Hey @Alexandr-Ivantsov!

To integrate a project from a different repository, you can either:

  • Use git submodules to integrate the external project as if it was local
  • Make sure the external project is a valid package. If you want to keep the Tuist definition, it does mean partly duplicating the structure in Package.swift and Project.swift . FWIW, that’s what we do and it doesn’t cost us a lot of maintenance.

From the code you shared, AAATuist Package.swift definition has no products, so it’s expected that it’s not found when integrated with external target dependency.

1 Like