How to generate and keep structured (folders) local packages?

Question or problem

With XcodeGen can generate structure local packages

Packages
│
└───Common
│   │
│   └───CommonUI
│   └───CommonCore
│   
└───Main
│   │
│   └───FeatureA
│   └───FeatureB
...

Tuist generate structure:

Packages
│
└───CommonUI
└───CommonCore
└───FeatureA
└───FeatureB
...

Expectation

How to generate custom folders structure with Tuist?

Packages
│
└───Common
│   │
│   └───CommonUI
│   └───CommonCore
│   
└───Main
│   │
│   └───FeatureA
│   └───FeatureB
...

Context

  • Tuist version: 4.31.0

Reproduction (mandatory for problems)

  • Create project
  • init Tuist
  • add local SPM module
  • configure dependencies in Project.swift
  • generate project

Hey @Josh :wave:

Are you using the XcodeProj-based integration or Xcode’s default integration? Dependencies · Projects · Develop · Guides · Tuist

If you could provide a sample of the project you’re trying to have, that would help as well :crossed_fingers:

Sure here is sample project on Github

I will be only glad, If you have any ideas on how to achieve the expected result :slight_smile:

Note: Root folder name Modules or Packages doesn’t matter, main thing to keep layered structure of local SPM modules (Common, Shared, Flows and etc.)

Expected result:
expected

Hi @marekfort :wave:
Is there any updates?) or any suggestions on this topic?

Hey @Josh :wave:

I took a look and this is currently not possible. However, we’d love to take a contribution if you want to take a stab at it.

The issue is the Packages group is currently hardcoded here.

To preserve the package’s location, we’d need to add a group based on the package’s path, as XcodeGen is doing: XcodeGen/Sources/XcodeGenKit/SourceGenerator.swift at 126339f1c8ad9a78a4270f243ad7840cf626aa11 · yonaskolb/XcodeGen · GitHub

All the necessary changes should happen in the linked generateSwiftPackageReferences, so the scope of the PR should be relatively small.