Monorepo workflow using SPM


(Georgios Moschovitis) #1

The Swift Package Manager is a great addition to the Swift programmer's toolbelt and in general I like the integration with Git.

However, since SPM promotes a separate Git repo per package and actually leverages Git tags to resolve dependency versions, I am wondering if it's possible to use the popular(?) 'monorepo' workflow with SPM.

thanks,
-g.


(none) #2

+swift-build-dev

Not right now but we're considering adding support for multiple packages in
a repository. It would be good if you can explain your
requirements/features/flow are you looking for.

···

On Friday 4 November 2016, Georgios Moschovitis via swift-users < swift-users@swift.org> wrote:

The Swift Package Manager is a great addition to the Swift programmer's
toolbelt and in general I like the integration with Git.

However, since SPM promotes a separate Git repo per package and actually
leverages Git tags to resolve dependency versions, I am wondering if it's
possible to use the popular(?) 'monorepo' workflow with SPM.

thanks,
-g.

--
Ankit


(Erica Sadun) #3

I want less of a monorepo than an ability to build a group of orthogonal elements into a single repo so I don't have to create a separate repo for every single Swift library I build, especially when there are logical relationships between subfolders and partial incorporation into builds For example, I'm messing with core graphics geometry right now. I have basic types & extensions, some experimental stuff, and other misc things for (for example) doing playground visualization support. Rather than over-conditionalize my code, I'd rather conditionalize the package, so that everything pulls, compiles, and works fine on, say, a macOS build but bits that don't belong (iOS playground visualization support) can be omitted from a specific configuration *for* *that* *repo* instead of me having to make really ugly code conditions in files which are intended specifically for known targets and may be excluded from package builds because of their intended targets.

-- E

···

On Nov 3, 2016, at 2:31 PM, Ankit Agarwal via swift-users <swift-users@swift.org> wrote:

+swift-build-dev

Not right now but we're considering adding support for multiple packages in a repository. It would be good if you can explain your requirements/features/flow are you looking for.

On Friday 4 November 2016, Georgios Moschovitis via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
The Swift Package Manager is a great addition to the Swift programmer's toolbelt and in general I like the integration with Git.

However, since SPM promotes a separate Git repo per package and actually leverages Git tags to resolve dependency versions, I am wondering if it's possible to use the popular(?) 'monorepo' workflow with SPM.

thanks,
-g.

--
Ankit

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Georgios Moschovitis) #4

It would be good if you can explainyour requirements/features/floware you looking for.

Well the flow is simple, just put all your packages in one root repository. I guess, SPM could be updated to allow
linking to a local dependency by file path, not only by Git tag.

Actually this feature would be useful even when developing multiple dependent packages in separate repos. Currently you have to create new tags and refetch all the time when you work on multiple packages at the same time, a small annoyance.


(Daniel Dunbar) #5

I want less of a monorepo than an ability to build a group of orthogonal elements into a single repo so I don't have to create a separate repo for every single Swift library I build, especially when there are logical relationships between subfolders and partial incorporation into builds For example, I'm messing with core graphics geometry right now. I have basic types & extensions, some experimental stuff, and other misc things for (for example) doing playground visualization support. Rather than over-conditionalize my code, I'd rather conditionalize the package, so that everything pulls, compiles, and works fine on, say, a macOS build but bits that don't belong (iOS playground visualization support) can be omitted from a specific configuration *for* *that* *repo* instead of me having to make really ugly code conditions in files which are intended specifically for known targets and may be excluded from package builds because of their intended targets.

Can you explain the interaction between conditional compilation and monorepo / multi-package repos? They seem somewhat orthogonal to me.

- Daniel

···

On Nov 3, 2016, at 2:06 PM, Erica Sadun via swift-users <swift-users@swift.org> wrote:

-- E

On Nov 3, 2016, at 2:31 PM, Ankit Agarwal via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

+swift-build-dev

Not right now but we're considering adding support for multiple packages in a repository. It would be good if you can explain your requirements/features/flow are you looking for.

On Friday 4 November 2016, Georgios Moschovitis via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:
The Swift Package Manager is a great addition to the Swift programmer's toolbelt and in general I like the integration with Git.

However, since SPM promotes a separate Git repo per package and actually leverages Git tags to resolve dependency versions, I am wondering if it's possible to use the popular(?) 'monorepo' workflow with SPM.

thanks,
-g.

--
Ankit

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Daniel Dunbar) #6

(+ swift-build-dev)

Hi Georgios,

This is a very timely question, because I have been working on a proposal for solving exactly this problem.

Can you take a look at:
  https://github.com/ddunbar/swift-evolution/blob/multi-package-repos/proposals/NNNN-swiftpm-multi-package-repos.md
and see if you feel it would meet your needs?

- Daniel

···

On Nov 3, 2016, at 10:08 PM, Georgios Moschovitis via swift-users <swift-users@swift.org> wrote:

It would be good if you can explainyour requirements/features/floware you looking for.

Well the flow is simple, just put all your packages in one root repository. I guess, SPM could be updated to allow
linking to a local dependency by file path, not only by Git tag.

Actually this feature would be useful even when developing multiple dependent packages in separate repos. Currently you have to create new tags and refetch all the time when you work on multiple packages at the same time, a small annoyance.

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Georgios Moschovitis) #7

Can you take a look at:
... and see if you feel it would meet your needs?

Thanks, it looks great :slight_smile:

One minor thing, I am not sure about the

.Package(url: “…”, subpackage: ..., …)

syntax, maybe the subpackage name should be included in the url? I am not sure…

-g.